---
question: How do I pass another agent for the parent to use?
kind: task
via_web: na
via_cli: na
via_python: available
via_api: na
via_config: na
ref_python: agents=[...]
prereq: Both agents are engine agents, classes with a `New()` method. See [Create an agent](/user-guide/build/agents/creating-an-agent?via=python).
next:
  - /capabilities/build/agents/give-it-tools
  - /capabilities/build/agents/test-an-agent
---

# Add sub-agents

A parent agent can hand the conversation to another agent. Build that agent in the parent's `New()` and pass it in `agents`. Only engine agents have sub-agents.

## Web UI

Not applicable. Edit Agent lists an engine agent's **Subagents** read-only, and a workspace agent has none: use Python on this page.

## CLI

Not applicable. No `abi` command attaches a sub-agent: fill the `agents` list that `abi new agent` scaffolds, as in the Python steps.

## Python

### Build the sub-agent in New()

Import the other agent inside `New()`, not at the top of the file: the engine loads every `Expose` class of your package that an `agents/` file holds as an agent of its own.

```python title="agents/ReviewerAgent.py"
    @classmethod
    def New(cls, agent_shared_state=None, agent_configuration=None) -> "ReviewerAgent":
        from my_module.agents.HelperAgent import HelperAgent

        ...
        agents: list = [HelperAgent.New()]
```

### Pass it to the constructor

```python title="agents/ReviewerAgent.py"
        return cls(
            name=cls.name,
            description=cls.description,
            chat_model=chat_model,
            tools=tools,
            agents=agents,
            memory=None,
            state=agent_shared_state,
            configuration=agent_configuration,
        )
```

An agent passed in `tools` is treated the same way.

### Route by intent

An `IntentAgent` can send a message straight to a sub-agent when it matches an intent of type `AGENT`, without asking the model:

```python
Intent(
    intent_value="review a contract",
    intent_type=IntentType.AGENT,
    intent_target="Helper",   # the sub-agent's name
    intent_scope=IntentScope.DIRECT,
)
```

See [Routing between agents](/user-guide/build/agents/creating-an-agent#routing-between-agents-with-intentagent).

## REST API

Not applicable. No HTTP call attaches a sub-agent: the list is built in `New()`, and the loaded parent delegates on its own.

## Config

Not applicable. `config.yaml` does not list an agent's sub-agents; it only loads the modules that hold them.

## How delegation works

- The parent gets one tool per sub-agent, `transfer_to_<name>`. When the model calls it, the sub-agent takes the conversation, with its history, and keeps it on the next turns of the thread.
- With `sequential_supervisor = True` on the parent class, each sub-agent returns to the parent when it finishes, so the parent can delegate to several of them in one turn.
- `onAImessage(message, agent_name)` on the parent also receives the sub-agents' messages: `agent_name` tells them apart.
