Agent Architecture/Multi-Agent Patterns
Advanced16 min

Async Subagents: Background Task Delegation

Async subagents (Deep Agents v0.5) let a supervisor delegate long-running tasks to background agents while continuing to chat with the user. This article covers the decision criteria for when async is worth the complexity, token cost math, production error handling, five concrete failure modes and their defenses, three orchestration patterns with code, and the five metrics you need to monitor before something breaks.

Quick Reference

  • Use async subagents when a task takes >10 seconds and the user shouldn't be blocked — anything shorter, sync is simpler
  • Correct API: subagents=[AsyncSubAgent(name=..., description=..., graph_id=...)] in create_deep_agent()
  • 5-tool lifecycle injected per subagent: start_async_task, check_async_task, update_async_task, cancel_async_task, list_async_tasks
  • ASGI transport = co-deployed, in-process (default); HTTP transport = remote Agent Server (add url= param)
  • Each subagent gets its own context window — parallel N agents means N × system prompt overhead
  • Stale task IDs after context compaction: always recover with list_async_tasks() before checking a specific task
  • Monitor: task completion rate, duration P95, polling overhead ratio, error rate by subagent, orphaned task count
  • Deep Agents v0.5, April 2026 — async subagents are a preview feature; APIs may change

Should I Use Async Subagents?

Async subagents add real complexity: each one injects 5 tools into the supervisor's context, introduces polling logic, and requires lifecycle cleanup. Sync subagents (the task() tool) or a direct tool call are often the right answer. The question to ask first is whether the user actually needs to keep interacting while the work runs.

SupervisorContinues chattingstart_async_taskLaunchcheck_async_taskStatus?update_async_taskRefinecancel_async_taskStoplist_async_tasksAll tasksSubagentRunning inbackground

Supervisor manages background subagents via 5 lifecycle tools — continues chatting while tasks run

SignalPoints to asyncPoints to sync
Task duration>15–30 seconds<10 seconds
User experienceMust keep chatting during workUser can wait for the result
Parallelism3+ independent subtasksSequential or single subtask
Error isolationOne failure shouldn't block othersAll-or-nothing is fine
DeploymentSubagent needs independent scalingCo-deployed is sufficient
State persistenceWork survives supervisor restartRestart is acceptable
AspectSync subagent (task())Async subagent
ExecutionBlocks supervisor until completeRuns in background, supervisor continues
User experienceUser waits for all subtasksUser chats while tasks run
Tooling1 tool (task)5 tools per subagent
Error handlingError propagates immediatelySupervisor polls status, handles errors
Context overheadSubagent result in one messageN × system prompts + polling messages
Start with sync, migrate to async

Ship with sync subagents (task() calls) first. Add async only when you have measured evidence that users are waiting too long. The 10-second heuristic is a starting point — your workload may be different.