Expand description
POST /api/v1/agent/spawn, the Agents tool’s spawn
(docs/specs/SPEC_AGENT_WORKERS_2026_10_15.md §3.1, Phase A): the calling
agent, the leader, opens a worker: a new agent built from its own
definition, on the model it names, in a pane to the right of its own.
A worker is not a fork (the pane’s Fork, an exact copy that carries the
conversation): it isn’t among the leader’s forks, and starts without the
leader’s conversation or Personal Memory, with the leader’s definition
(instructions, skills), Global Memory and, from the MCP server, the brief
it is sent as the leader’s own message.
Launching an agent spends tokens until someone stops it, so (§3.5): only
a verified agent spawns, host or container (a container leader gets container workers: same image,
each with its own container and workspace), a worker doesn’t, a leader has at most
MAX_LIVE_WORKERS, and unless the user’s own turn asked for it the user is told first, in the
leader’s pane, by a card with a countdown that goes ahead on its own (announce_start).
Modules§
- container 🔒
- Where a new agent runs: the
runtime,container_image,memory_mbandcpusofAgents spawn(a worker) andAgents create(a named agent from a template). - create 🔒
POST /api/v1/agent/create, theAgentstool’screate: a named agent made from a seeded template, the way the new-agent picker makes one (agentdefcreatefromtemplate), so an agent can add to My Agents without the operator’s hands. It is not a worker: it has no leader, takes no place among the caller’s live workers, can be given a seat (Agents set_seat) and is started withAgents open.- import 🔒
POST /api/v1/agent/import, theAgentstool’simport: an agent archive (.abf, kindagent, written byAgents export) put in My Agents (SPEC_MOVE_AN_AGENT_TO_ANOTHER_COMPUTER section 4 and 7, step B of the build).- many 🔒
POST /api/v1/agent/spawn_many, theAgentstool’sspawnwithworkers(SPEC_COUNTDOWN_BUTTONS_AND_BATCH_AGENT_ACTIONS_2026_10_28.md§5): several workers at once, one approval for all of them, and all of them or none. Everything that can be checked is checked before the first worker is made (the briefs, the names, the accounts, the leader’s limit, the room under the agent cap); a launch that still fails removes the workers already launched. The MCP process sends the briefs only after srv answers that all of them are open.- route 🔒
- The harness, model route and model a new agent is asked to run on, for
spawn,spawn_manyandcreate(docs/specs/SPEC_AGENT_MODEL_ROUTES_ANY_MODEL_SPAWN_AND_SWITCH_2026_11_06.mdsections 3 and 5). The rules aremodel_gateway::ask’s; this adds what a spawn knows: the leader, its remembered runtime and the Vault. - team 🔒
- Where a leader’s workers open: a tab of their own, “
team”, in the leader’s workspace, made the first time and reused after. Without it a leader that lives in the user’s main tab fills that tab with its workers.
Structs§
- Leader 🔒
- The leader as srv knows it: its pane and its definition.
- Spawn
Agent 🔒Result - Spawn
Error 🔒 - Worker
Account 🔒 - The account a worker runs on.
- Worker
Runtime 🔒 - The worker’s remembered runtime (
agentlastruntime): the leader’s, with the requested model and effort over it. - Worker
Summary 🔒 - One of a leader’s workers, for
Agentsworkers(§3.4).
Constants§
- COACHED_
BY_ 🔒META_ KEY - The worker pane’s leader,
{agent, id, block_id}: the leader’s name, its definition id and its pane. srv writes it when it opens the worker; no client can (browser_owner::srv_only_keys). - CREATED_
BY_ 🔒CONTENT - The agent that made this one with
Agents create,{agent, id}, kept on the new agent’s definition (agent content) so that agent can delete it again (Agents delete). srv writes it; a client may not, and a fork does not inherit it. - MAX_
LIVE_ 🔒WORKERS - Live workers a leader may have at once (§3.5).
- MAX_
NAME_ 🔒CHARS - RUN_
ACCOUNT_ 🔒META_ KEY - The account a pane’s run launched on (
agent_state::RUN_ACCOUNT_META_KEY). The account a pane’s run launched on, written at spawn (build_persistent_spawn_env), so a failure that run records counts against that account even after the agent is linked to another (run_accounts_of_block). - SETTING_
MAY_ 🔒START_ AGENTS agent:maystartagents: the person turned on “Agents may start agents” in Settings, so no agent’s start shows a card.- WORKER_
OF_ 🔒CONTENT - The leader a worker belongs to, and the content type that records it. They live in
backend::agent_seat, which reads them without namingserver/. The worker’s leader,{agent, id}, kept on the worker’s definition (agent content) as well as on its pane, so a worker reopened from My Agents, whose new pane has noagent:coached_by, is still a worker: it can’t spawn and still counts toward its leader’s limit. srv writes it;setagentcontentrefuses it from a client, and a fork of a worker doesn’t inherit it.
Statics§
- LEADER_
LOCKS 🔒 - One spawn at a time per leader, from counting its workers to opening the
new one, including the wait for the user. Like
agent_open’s locks, it serializes only this process’s calls.
Functions§
- account_
blocks 🔒 - The accounts that can’t take a worker now, and why: signed out (its
status), or a pane on it whose last run ended on the plan’s usage limit or
a refused sign-in (
agent:last_failure, which its next clean turn clears). A usage limit counts until its reset, when one is known, even with the pane still open (SPEC_UNRESPONSIVE_AGENTS_2026_10_23.md §6.3). - account_
blocks_ 🔒at account_blocksatnow_ms.- account_
for_ 🔒job - The account and provider the next worker of a
spawnjob led byleader_uidwould run on (choose_account), without opening it: what the spending caps weigh before the run starts (jobs spec §5.3).Nonewhen the leader isn’t running or no account can take a worker. - account_
label 🔒 - account_
label_ 🔒in account_labelwith the number that tells it from the other accounts of its provider and email (all).- account_
matches 🔒 wantednamesa: its id, name, display name or email, ignoring case.- agents_
may_ 🔒start_ agents - announce_
start 🔒 - Tell the person in the leader’s pane that it starts agents, and whether it may go ahead (docs/specs/SPEC_AGENT_SPAWN_NOTICE_IN_THE_PANE_2026_11_08.md). Nothing waits for a click:
- choose_
account 🔒 - The account to run the worker on (§3.5): the one asked for, else the
leader’s, else, when the leader’s can’t run (
account_blocks), the first of the user’s other accounts for the provider that can, with a note saying why. Refused when the one asked for can’t run, or none can. - client_
may_ 🔒write_ content setagentcontent’s check (a client’s write): which agent a worker reports to, and which agent made another, are srv’s to write: clearing the first would let a worker spawn and free its leader’s place, and writing the second would let an agent delete one it did not make.- coached_
by_ 🔒id - consent 🔒
- What the person is shown about one worker.
- consent_
message 🔒 - The facts of a start, from srv’s record: its model, placement, who pays.
- creator_
of 🔒 - The agent that made
def_id: the one that created it, or the leader it is a worker of. - discard_
worker 🔒 - Remove a worker whose open failed: the pane the open may have made in
tab_idbefore failing (closed as any pane is,delete_block), then its definition, as thedeleteagentRPC deletes one. - handle_
agent_ 🔒spawn - handle_
agent_ 🔒workers POST /api/v1/agent/workers: the caller’s own open workers. A caller that isn’t a leader gets an empty list.- launch 🔒
- Build the worker from the leader’s definition and open it. A worker that doesn’t open is removed again, with any pane the open made before it failed: the user didn’t get a worker, so there is no definition of one in My Agents and no marked pane taking up one of the leader’s places.
- leader_
at 🔒 - The leader whose pane is
block_id, if it may spawn: an agent of any kind, host or container, not a worker. A container leader’s worker is a container worker (copy_definitionkeeps the type and the image). - leader_
lock 🔒 - leader_
of 🔒 - The verified caller, if it may spawn: an agent’s own pane, host or container, not a worker’s.
- live_
workers_ 🔒of - How many open panes
leader_def_idcoaches: workers in some tab, or parked (still running). - next_
worker_ 🔒name - “
worker N”, the first N no agent is named. - one_
line 🔒 son one line, at mostmaxcharacters.- open_
worker 🔒 - Remember the worker’s runtime, then open it in
tab_id(right of the leader’s pane when that pane is in the tab), marked as the leader’s worker from the moment its block exists. - refuse 🔒
- requester_
here 🔒 - Whether the requester is still there to start things for: its pane exists and its agent was not stopped since (an explicit stop keeps the pane). A parked agent’s pane exists and it still runs.
- runtime_
of 🔒 native/containerfor a definition’sagent_type, and its image when it has one.- spawn_
beside_ 🔒leader - spawn_
for_ 🔒drone - Open a worker for a drone’s Spawn block: the path of
spawn_for_job, but the person is told first, by the card with a countdown that goes ahead on its own, unless their settings already allow agents to start agents. A drone run isn’t known to be one the operator started, so the block doesn’t count as their approval. - spawn_
for_ 🔒job - Open a worker for the job whose leader is
leader_uid, from its running pane: the same path as an agent’sspawn, without asking the user, since the operator created the job.MAX_LIVE_WORKERSand “workers can’t spawn” apply. - spawn_
with 🔒 - Open a worker for
leaderasreqasks.operator_approved: the operator made the decision beforehand (a job they created), so the user isn’t asked; the limits and the leader’s checks still apply. - spawn_
worker 🔒 - worker_
of 🔒 - The leader a worker belongs to, and the content type that records it. They live in
backend::agent_seat, which reads them without namingserver/. The leader definitiondef_idis a worker of, if any. - worker_
runtime 🔒 - workers_
of 🔒 leader_def_id’s workers open in a tab or parked: panes marked as its (on the pane or on their definition), with their state and last report.- written_
only_ 🔒by_ srv - Content only srv writes, and that a fork of the agent does not take along.