Quick start
An agent loop, from the new-loop screen to a deployed chatAgent.
1. Create the loop
From your loops list, create a loop and pick New Agent Loop. Name it something like health-chat.
The editor opens on a starter file. Replace it with the agent below.
2. The agent
The file calls chatAgent(), so it is an agent. Each message runs execute. messages is the thread. submit is the model call for that turn.
import { chatAgent, model } from "@loops/sdk";
export const healthChatAgent = chatAgent({
id: "health-chat",
execute: async ({ submit, messages }) =>
submit({
messages,
instructions:
"You are a friendly health concierge. Keep replies short. Never diagnose.",
model: model("gpt-4o-mini"),
}),
});3. Deploy
Click Deploy. The platform stores the version and opens the loop. The next message uses that version.
4. Send a message
Open the loop and send a message in its chat. A message runs execute. messages is the thread so far, and the reply from submit stays on the thread. The next message sees it.
To send one from your own system, see Calling an agent.
Where to go next
- What is an agent — turns, tools, and threads.
- Tools for an agent — let the model act.
- Calling a workflow — start the scan workflow from this agent.
Last updated on