Plans
A plan is a goal and an ordered list of steps, stored with the conversation. The model manages it with four tools:
The plan is what the plan gate checks: in Agent mode a gated tool is refused unless an approved plan has a step in progress. Approving the plan also sets how it runs — asking before each call, or automatically.
The plan also drives the run itself. While steps remain, a run that reaches its step limit continues in a new iteration instead of stopping mid-task, and the plan with its statuses is part of every iteration’s system context. See Run lifecycle.
Subagents
A subagent is a separate run of an agent definition — with its own prompt, tools, skills and step budget — on one task, in the background. The main agent keeps working, or waits, while subagents run.The queue
Subagents are rows in anagent_subagents table, which is the queue: there is no separate broker.
- Dispatch inserts a
pendingrow and returns its id at once. A conversation may have at most ten subagents pending or running. - Runners inside each core API process claim pending rows with
FOR UPDATE SKIP LOCKED, up to four at a time per process, so several API replicas share the work without double-running a subagent. - Heartbeats every 30 seconds mark a run as alive. A row without a heartbeat for two minutes was interrupted — for example by an API restart — and is requeued, at most twice, then marked failed. A run has a hard limit of 20 minutes.
- Cancellation is seen at the next heartbeat. Stopping the conversation cancels all its pending and running subagents.
Briefs
The main agent does not hand over a free-form prompt.dispatch_subagent takes a structured brief — objective, expected output, context, what the subagent must do and must not do — plus optional targets, a step budget (at most 200) and the plan step the work serves. Targets go through the scope gate at dispatch. The brief is rendered into the subagent’s task, wrapped as data; see Resisting prompt injection.
Dependencies
A dispatch can name up to ten earlier subagents of the same conversation it must wait for (after). A pending row is claimed only when none of its dependencies is still pending or running; a failed or cancelled dependency still releases it, with that status, so a chain never deadlocks. Because dependencies can only point at rows that already exist in the same conversation, checked under a conversation lock, a cycle cannot form.
When a dependent subagent starts, its task is preceded by the results of the subagents it waited for.
The shared notebook
Every agent in the conversation — the main agent and each subagent — can append to a shared, append-only notebook withadd_workflow_note: facts, decisions and issues, each signed with its author. The newest entries are given to every subagent when it starts, within a size cap. The notebook lets parallel subagents share what they learn without routing everything through the main agent’s context. Subagents also share the conversation’s short-term memory.
Results
A subagent ends by callingsubmit_result with its answer, facts and open questions; facts and questions are also written to the notebook. Results are capped at 20,000 characters.
The main agent never polls. A result that finishes while the main run is going is handed to the model before its next step; one that finishes after the run ended is delivered with the user’s next message. When there is nothing left to do but wait, wait_for_subagents blocks until at least one finishes, for at most two minutes per call; one user turn waits at most eight minutes and resumes with results at most five times. continue_subagent sends a follow-up to a finished subagent, which runs again with its earlier task and answer in context.
Each subagent run keeps a transcript of its steps, capped in size, which the console shows in the side panel, and the conversation’s workflow snapshot API returns the plan, subagents, their dependencies and the notebook as one graph.
What a subagent may do
- It runs unattended: a call the guard escalates to a prompt is refused rather than waiting. See Unattended runs.
- A built-in definition runs the tools it declares, automatically. A custom definition does too in an Auto conversation, and gets read-only tools only in a Manual one.
- It never gets subagent tools — subagents cannot dispatch subagents — or long-term memory.
- It can load only the skills its definition declares.
Agent definitions
An agent definition is a Markdown prompt with frontmatter: name, description, mode (primary, subagent or both), the tools it may use, the skills it may load, and optionally a step budget and model. The main agent sees the list of subagent definitions and their descriptions, and picks one per task.
Built-in agents
Built-in definitions declare only the tools and skills their role needs; a test checks that every tool and skill they name exists.
Custom agents
Members can add their own definitions, private or shared with the workspace. Built-in names are reserved, and a personal agent may not shadow a workspace agent or the other way round, so@name always resolves to exactly one agent. A subagent’s model is resolved in order: the definition’s own model, the member’s subagent model setting, the conversation’s model, then the member’s default. See Agents.
Related
Guard and approvals
The plan gate and unattended runs
Side panel
The plan, subagents and workflow from the user’s side
Agents
Built-in and custom agent definitions
