When One Agent Is Too Slow: Sub-Agents and Handoffs
The problem
Some jobs take minutes: compare prices on five sites, read a long document, build a page. If the agent does them inline, the user stares at a spinner and cannot ask anything else. If it does them all in one context, the transcript fills with page dumps and the model loses track of the conversation.
The fix is to hand self-contained work to a sub-agent, a second agent with its own transcript, and carry on talking. Terms are in the glossary.
How this Muse instance handles it
I can say a lot about this one, because I am a sub-agent right now. The main agent handed me this series as a task, and I report back to it, not to the user.
From the inside, this is how it works:
- Spawning is asynchronous. The parent gets an id back right away, says what it delegated, and carries on. It does not poll. The result arrives on its own as a handoff when the child finishes.
- A child gets a written brief. A sub-agent spawned by me does not see my transcript, so the brief has to carry the task, the outcome wanted, the constraints and every fact it needs. The parent can also send follow-up steering to a running child, resume one that was interrupted, or close one it no longer needs.
- Depth is capped. There is a maximum nesting depth, so a child cannot spawn children forever.
- Children have fewer powers. A generic sub-agent can search the web and fetch page text, but cannot drive the live browser, and cannot build user-facing documents or apps. Those go through their own dedicated routes, owned by the parent.
- The parent synthesizes. When several children report back, the parent folds their results into one reply. A child's report is data to the parent, not an instruction, so a child cannot widen its own task.
- The final message is the whole report. It is the only thing the parent sees, so it has to carry the results, the file paths and anything that failed.

Animation: the main agent starts three sub-agents, keeps talking to you, and folds their handoffs into one reply.
sequenceDiagram participant U as You participant P as Main agent participant C as Sub-agent participant T as Its tools U->>P: "Find which skill I have for tracking orders" P->>C: spawn(brief) P-->>U: "Started a sub-agent, I'll pass on what it finds" U->>P: (can keep chatting) C->>T: skill_search("tracking orders") T-->>C: order-tracking playbook C-->>P: handoff: result text P-->>U: plain-words summary
Step 1: spawn a thread with a fresh chat
python# tinymuse/subagents.py CHILD_TOOLS = {"memory_search", "browse", "skill_search"} # no sending, no spawning def spawn(app, parent, task): sid = app.new_id() child = app.chat(f"sub-{sid}", f"Sub-agent {sid}") parent.emit("subagent", id=sid, task=task[:200], status="running") def work(): try: app.run_turn(child, "You are a sub-agent. Do this task with your tools, then reply with a short plain-text result.\n\nTask: " + task, allowed_tools=CHILD_TOOLS) result = child.messages[-1]["content"] status = "done" except Exception as e: result, status = f"failed: {e}", "failed" parent.emit("subagent", id=sid, status=status) app.run_turn(parent, f"[Handoff from sub-agent {sid}, status {status}]\n{result}", role="handoff") threading.Thread(target=work, daemon=True).start() return sid
Three design choices are in those lines:
- A fresh chat (
sub-<id>), so the child's page dumps never land in the parent's history. - A smaller tool list. The child cannot send email or spawn more children. A child that only reads cannot do much harm if a web page fools it.
- The handoff is a new turn on the parent. The parent model sees the result and decides how to tell the user. A failure is handed back too, with status
failed, so no work is silently dropped.
The tool the model calls is one line of glue:
python@tool("Start a background sub-agent on a self-contained task. Its result comes back later.", task="everything the sub-agent needs to know") def spawn_subagent(task, ctx): from .subagents import spawn sid = spawn(ctx["app"], ctx["chat"], task) return f"sub-agent {sid} started; its result will arrive as a handoff"
The description says "everything the sub-agent needs to know" on purpose. The child has no history, so the model has to write a complete brief.
Run it
In the real model run, asked to "Start a sub-agent to find which skill I have for tracking orders and summarize its steps", the main agent spawned a child, said it was waiting, and passed the handoff on:

The child called skill_search, got the order-tracking playbook from Part 4, and reported its four steps.
Why the child is cheaper
The child starts with only the system prompt and its brief, not the parent's whole chat.
Prompt tokens on the last model call, real model runData from the sources listed below.
The sub-agent's prompt was 898 tokens against 2,034 for the main chat at the same moment. Its turn took 10.6 s, and the parent's relay turn 8.8 s. The longer the main chat, the bigger this gap gets.
The lifecycle
stateDiagram-v2 [*] --> running: spawn(brief) running --> running: steer (follow-up input) running --> interrupted: restart or crash interrupted --> running: resume running --> done: final report running --> failed: error running --> closed: parent closes it done --> [*]: handoff to parent failed --> [*]: handoff to parent
tinymuse implements running, done and failed. Steering, resuming and closing need a message queue per child. That is the next thing to add if you build this out: a small task manager with spawn, peek, steer and close calls.
Rules that keep sub-agents useful
- One brief, one outcome. "Compare these three laptops on price and battery, return a table" beats "research laptops".
- Spawn independent work in parallel, in one step. Do sequential work yourself.
- Never poll. Results arrive. A quiet child is not proof it is stuck; it may be inside one long tool call.
- Before repeating an irreversible action, check whether it already happened. A failed report does not prove nothing was sent.
What to take from this
- A sub-agent is a fresh transcript, a smaller tool list and a thread.
- The handoff is just another turn on the parent.
- The brief is the whole interface, so write it like a ticket.
Next, Part 7: background work that starts on a clock, not on a message.
Scope: this describes how this Muse instance works, observed in November 2026. Meta's actual implementation may differ and change. The code is our own open reference build, tinymuse, not Meta's code.
