---
question: How does an agent hand work to another agent?
kind: task
via_web: na
via_cli: na
via_python: available
via_api: na
via_config: na
ref_python: get_agent
prereq: Both agents are module agents, published while their modules run. See [Create an agent](/capabilities/build/agents/creating-an-agent?via=python).
next:
  - /capabilities/build/agents/give-it-tools
  - /capabilities/build/agents/test-an-agent
---

# Add sub-agents

An agent in a module has no local sub-agents: the SDK `Agent` refuses an `agents=[...]` list ("Local sub-agents are not supported yet; pass remote agents through tools"). Instead, an agent calls another agent as a tool. The other agent is published by a module, this one or another, and reached through discovery.

## Web UI

Not applicable. Edit Agent does not attach an agent to another, and a workspace agent has no tools: use Python on this page.

## CLI

Not applicable. No `abi` command attaches an agent: pass it in `tools`, as in the Python steps.

## Python

### Declare the other module

The module that calls the agent names the module that publishes it in its dependencies:

```python title="src/research/__init__.py"
dependencies = ModuleDependencies(
    services=("model_registry", "document", "triple_store"),  # the scaffold's services
    modules=("my_project.helper",),
)
```

A module dependency needs discovery, which `run_module` sets up when the module runs under `abi dev up` or Compose.

### Get the agent

In `on_initialized`, ask discovery for the agent by its published name:

```python title="src/research/__init__.py"
    async def on_initialized(self) -> None:
        helper = await self.engine.modules["my_project.helper"].get_agent("Helper")
```

It returns an `AgentProxy`. `get_agent` raises an `RPCError` when no `READY` instance of that module publishes the agent, so start the other module first.

### Pass it as a tool

```python title="src/research/__init__.py"
        reviewer = await ReviewerAgent.create_agent(self.engine, MODULE_ID, tools=[helper])
        self.expose_agent(ReviewerAgent.NAME, reviewer.as_handler())
```

The agent turns the proxy into one tool named after the other agent, described by its description. When the model calls it, the other agent runs the prompt in its own process and its answer comes back as the tool result.

You can also call it yourself: `await helper.invoke("...")` returns the answer, and `helper.stream_invoke(...)` yields its events.

## REST API

Not applicable. No HTTP call attaches an agent: the tool list is built in `create_agent`.

## Config

Not applicable. `config.yaml` does not list an agent's tools or the agents it calls.

## How it differs from a hand-off

- The other agent answers one prompt per call and does not take the conversation over: the calling agent keeps the thread.
- The other agent keeps its own memory, scoped to the calling thread.
- An `AGENT` intent other than `call_model` falls back to the model, since there is no local sub-agent to route to.
