Sub-Agents

Agents can delegate to other agents. Sub-agents are just another type of tool.


Why Sub-Agents?

Complex tasks benefit from specialization:

code
1Main Agent2 Research Agent (gathers information)3 Writing Agent (creates content)4 Editor Agent (reviews and polishes)

Each focuses on what it does best.


How to Add a Sub-Agent

Sub-agents are added through the unified Tools tab:

  1. Open your agent's settings
  2. Go to the Tools tab
  3. Click Add ToolAgent Tool
  4. Select another agent

The main agent can now delegate to it.


How Delegation Works

code
1You: Write a blog post about AI trends23Main Agent: I'll delegate this.4            [Calling research-agent: "Find AI trends 2024"]5            [Calling writing-agent: "Write post about these trends"]6            [Calling editor-agent: "Review and polish"]7            8            Here's your blog post!

Each sub-agent:

  1. Receives the task from the parent
  2. Works independently using its own tools
  3. Returns results via the finish tool

Sub-Agent Results

When a sub-agent completes, it calls finish with:

  • status: succeeded, failed, or cancelled
  • result: the output to send back

The parent agent receives this and continues.


Nested Agents

Sub-agents can have their own sub-agents:

code
1Orchestrator2 Project Manager3     Developer Agent4        Code Review Agent5     Designer Agent

Keep nesting shallow for clarity.


Parallel execution

When the parent agent emits multiple tool calls in a single turn, the runtime runs them in parallel. The parent does not continue until every call in that turn has finished.

Model outputWhat happens
Three sub-agent calls in one assistant messageThree sub-agents run at the same time
One sub-agent call per turn across three turnsThree sequential runs

Parallelism is controlled by the model and your instructions, not by a separate concurrency API. To fan out work, prompt the coordinator to invoke several sub-agents (or app tools) in one response.

Each sub-agent runs in its own chat with its own context. Siblings do not share state; the parent only sees structured results returned through finish. A sub-agent can fan out again in its own turn.

Parallel research, sequential synthesis is a common pattern:

code
1Turn 1: [research-a, research-b, research-c]    parallel2Turn 2: [synthesis-agent(combined results)]   waits for turn 1

Sub-agents and app tools both participate in the same join behavior: mixed parallel turns (for example, two sub-agents plus one app run) complete together before the next coordinator turn.


When to Use Sub-Agents

  • Complex workflows with distinct phases
  • Specialized expertise for different tasks
  • Reusable components across multiple agents

When NOT to Use Sub-Agents

  • Simple tasks a single agent can handle
  • When an app tool would suffice
  • Over-engineering for its own sake

Start without sub-agents. Add them when you need specialization.


Next

Chatting with Agents

we use cookies

we use cookies to ensure you get the best experience on our website. for more information on how we use cookies, please see our cookie policy.

by clicking "accept", you agree to our use of cookies.
learn more.