Register specialist sub-agents and configure delegation depth, approval policies, and task queue routing
Sub-agents let a main agent delegate work to specialist agents — each with its own LLM, tools, prompts, and Temporal task queue. The main agent sees each specialist as a delegation tool the LLM can invoke.Use sub-agents for domain specialists (math, research, coding) without concentrating every capability into one prompt and tool list.
Each specialist needs a uniqueTaskQueue when using Temporal. Use clear WithName and WithDescription values — they appear in the delegation tool schema the LLM sees for routing decisions.
Conversation isolation — sub-agents do not inherit the main agent’s conversation ID. They run without session history from the parent.
Independent approval policies — parent and child policies are independent (see Approvals).
Worker pairing — with DisableLocalWorker, pair each NewAgentWorker with the same options as the NewAgent it runs.
Validation at build — sub-agent graphs are validated for cycles and depth violations at NewAgent. Errors fail fast.
Sub-agents do not share the parent’s conversation history. If you need the specialist to have context from the parent session, include it in the delegation prompt or tool call arguments.
When streaming, events from all delegated sub-agents fan in to the main agent’s stream, bracketed by STEP_STARTED and STEP_FINISHED. See Streaming for the full event reference and approval handling patterns.