Background Sessions
13.4. Background Sessions — Without Blocking the Parent Session
The problem with the original synchronous version
The original delegate_task was synchronous: the parent agent calls the tool and stands frozen, waiting until every child finishes its work. A session that is handed both a research task and a documentation-writing task at the same time has to wait for one to finish before starting the other — the user can’t ask a follow-up question, can’t redirect a running task, and can’t start a third job while the first two are still being processed.
Async delegation — solving exactly that bottleneck
The async_delegation toolset lets the parent call delegate_task_async, immediately receive a task_id, and keep processing other messages while the child runs independently in the background — its full lifecycle managed through tools: spawn, check, steer, collect, cancel, list.
Results no longer lost when the process restarts
An important recent improvement: completions of background delegation are now durable — if the process is restarted mid-way, results are restored and delivered through a ledger with ownership checks, instead of disappearing completely. Along with that, each subagent dispatch now returns a transcript file directly — you can tail -f it to watch every tool call and every reply of the child in real time, an easy-to-read log for each child.
On the Desktop app
There is a dedicated “watch window” that streams the live activity of background subagents (delegate_task(background=true)) — visual monitoring without having to open a terminal and read raw logs.
Notes
- For work that must run fully independently — capable of running while the terminal is disconnected (not just “not blocking the current session” but also “surviving a full process restart”) — use a cron job (12.1) or
terminal(background=True, notify_on_complete=True)instead of async delegation — because async delegation is still bound to the running parent process (process-local), unlike cron, which runs completely independently. - Take advantage of
tail -fon each subagent’s transcript file when you need to debug a running background child without interrupting its process. - For long workloads running many background subagents at once, check with
/agents(/tasks) periodically — the visual tree shows which child is running and which has finished, so you don’t lose track with many parallel tasks.