]> git.giacomolli.uk - onechat/commit
Run subagents in the background with spawn
authorAnderson A. Giacomolli <agiacomolli@gmail.com>
Sun, 8 Nov 2026 13:33:12 +0000 (10:33 -0300)
committerAnderson A. Giacomolli <agiacomolli@gmail.com>
Sun, 8 Nov 2026 13:33:23 +0000 (10:33 -0300)
commitddd0a50f7b801112376d7fb27bfd05d2fc26c2fd
tree28a7e6850794d64c2c6cd451cec63edf3e780076
parent6e3e9c5c10f3d35bae7e9846334974a09418aef7
Run subagents in the background with spawn

The agent gets the spawn tool: spawn(tasks, effort) starts one subagent
for each task and returns their names at once. It waits until the view
has no pending summary, and gives that view to each subagent. Each
subagent runs in its own goroutine with its own request chain, its own
system prompt with the user's instructions at the end, and the tools
zoom, date, shell, read, write, and edit, in subagents/NAME/work. It
cannot start a subagent. Each request starts with the view, the state,
and the whole log of the subagent as "i|kind: text" lines, and the log
starts with the note "subagent" and the task.

At the end of a run, its final answer, or "failed: ERROR" after a failed
call such as a full context, goes to the agent as one work message:
"[Name]", the reply, and the zoom that gives its whole chat. The report
joins a running turn between its tool calls, or starts a new turn. A
report of a stopped subagent is logged but starts no turn. When the loop
ends at the stop of the daemon, the runs end with no report, and the
loop waits for them. The prompt gets the lines on subagents.

The efforts of spawn are low, medium, high, and xhigh: the efforts of
the reference design that the Responses API also takes.

Issue: b1ac698
README.rst
agent.go
prompt.go
prompt_test.go
subagent.go
subagent_run.go [new file with mode: 0644]
subagent_run_test.go [new file with mode: 0644]
tools.go
turn.go