> ## Documentation Index
> Fetch the complete documentation index at: https://noorle.com/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# Sub-Agents and Delegation

> Delegate tasks to other agents. Build multi-agent systems with handoffs.

Sub-agents enable multi-agent workflows. An agent can delegate work to other specialized agents.

## When to Use Sub-Agents

**Use sub-agents when:**

* Task has distinct phases needing different expertise
* Want to parallelize work
* Need specialized agents for specific tasks

**Example:**

* Main agent receives customer inquiry
* Delegates to Research sub-agent
* Delegates to Analysis sub-agent
* Compiles results

## Creating a Sub-Agent Call

Agents with access to compatible connector can call other agents:

```
Call sub-agent "data_analyzer" with prompt:
"Analyze this dataset and provide insights"
```

Agent automatically:

1. Creates execution context
2. Passes data/context
3. Waits for response
4. Uses results in own reasoning

## Configuration

### Enable Sub-Agent Delegation

1. **Agents** > Select main agent
2. **Settings** > **Capabilities**
3. Attach **Agent Caller** connector (if available)
4. Save

### Call Sub-Agent

In agent system prompt, add instructions:

```
When user provides data analysis request:
1. Delegate to "data_analyzer" agent
2. Wait for results  
3. Summarize findings
4. Provide recommendations
```

## Sub-Agent Handoff

Smooth handoff between agents:

```
"I'm passing you to our specialist agent..."
(calls sub-agent)
"They found: [results]"
```

## Best Practices

### Clear Specialization

Each sub-agent should have clear, specific role.

### Error Handling

Handle sub-agent failures gracefully:

```
If sub-agent fails:
1. Retry once
2. If still fails, inform user
3. Offer alternative approach
```

### Data Passing

Only pass necessary context to sub-agents. Too much context = higher costs.

### Avoid Infinite Loops

Sub-agents shouldn't call parent agent. Set recursion limit to 3.

## Architecture Example

```mermaid theme={null}
graph TD
    A["Main Agent<br/>Customer Service"]
    B["Sub-Agent:<br/>Knowledge Search"]
    C["Sub-Agent:<br/>Data Lookup"]
    D["Sub-Agent:<br/>Problem Solver"]

    A --> B
    A --> C
    A --> D
```

Each sub-agent handles specific type of task.

## Monitoring

Check sub-agent activity:

1. **Agents** > Select main agent
2. **Activity** tab
3. See sub-agent calls and responses

## Costs

For current pricing details, see [Pricing](https://noorle.com/pricing/).

Sub-agent calls are charged same as regular agent execution.

Monitor in **Account** > **Usage** dashboard.

## Delegation Details

### How Delegation Works

When an agent delegates to a sub-agent, the platform uses a synthetic `delegate_agent` tool. The parent passes a task description and context, the sub-agent executes with its own capabilities, and the result flows back to the parent.

### Delegation Depth

Sub-agents can delegate to their own sub-agents, creating a chain. The default maximum depth is **3 levels**. The platform tracks lineage (which agent called which) for observability and to enforce depth limits.

### Shared Work Budget

Parent and child agents share the same work budget. A sub-agent's token usage and tool calls count toward the parent's budget. This prevents runaway costs from deep delegation chains.

### Isolated Threads

Each sub-agent gets its own thread for execution. It doesn't see the parent's conversation history — only the task and context explicitly passed to it. This keeps sub-agents focused on their specific task.

## Limitations

* Sub-agents can't see parent conversation history
* Can't modify sub-agent behavior mid-call
* Sub-agent response must be usable by parent
* Maximum delegation depth: 3 levels (default)

## Next Steps

* [Creating Agents](/docs/run/agents/creating-an-agent)
* [System Prompts](/docs/run/agents/system-prompts)
* [Workflows](/docs/run/workflows/overview)
