# Sub-Agents

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

**URL:** https://inference.sh/docs/agents/sub-agents
**Last updated:** 2026-09-18

---

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

---

## Why Sub-Agents?

Complex tasks benefit from specialization:

```
Main Agent
├── Research Agent (gathers information)
├── Writing Agent (creates content)
└── 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 Tool** → **Agent Tool**
4. Select another agent

The main agent can now delegate to it.

---

## How Delegation Works

```
You: Write a blog post about AI trends

Main Agent: I'll delegate this.
            [Calling research-agent: "Find AI trends 2024"]
            [Calling writing-agent: "Write post about these trends"]
            [Calling editor-agent: "Review and polish"]
            
            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:

```
Orchestrator
└── Project Manager
    ├── Developer Agent
    │   └── Code Review Agent
    └── 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 output | What happens |
|--------------|--------------|
| Three sub-agent calls in one assistant message | Three sub-agents run at the same time |
| One sub-agent call per turn across three turns | Three 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:

```
Turn 1: [research-a, research-b, research-c]   ← parallel
Turn 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](/docs/agents/chatting)
