> For the complete documentation index, see [llms.txt](https://docs.paradime.io/app-help/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.paradime.io/app-help/products/dino-ai/programmable-agents/agent-to-agent-delegation.md).

# Agent-to-Agent Delegation

Programmable Agents can spawn and coordinate other agents, enabling complex multi-agent workflows where each agent has a focused responsibility.

***

### How Delegation Works

An agent with `invoke_agent` in its tool allowlist can spawn child agents. Each child runs in its own pod and — if a Slack channel is configured — posts to the same thread as the parent.

To allow delegation, two things must be configured in the parent agent's YAML:

1. `invoke_agent` must be included in `tools.list`
2. The child agent name must be listed under `agents_squad`

```yaml
tools:
  mode: allowlist
  list:
    - invoke_agent

agents_squad:
  - test-maintainer
```

***

### Callback / Resume Pattern

For workflows where the parent needs the child's result before continuing, pass `callback_session_id` to `invoke_agent`. The parent pod idles until the child completes, then wakes up with the child's output as its next input.

```mermaid
sequenceDiagram
    participant A as PR Reviewer (Session A)
    participant B as Test Maintainer pod
    participant S as Slack

    A->>B: invoke_agent("test-maintainer",<br/>callback_session_id=A)
    note over A: pod idles — awaiting callback
    B->>S: "Writing tests for stg_orders..."
    B->>B: Commit + run dbt test
    B->>S: "Tests passing ✓"
    B->>A: notify_parent_session("Tests complete. All passing.")
    note over A: wakes — receives child output<br/>as next user turn
    A-->>A: "All checks passed. PR approved ✓"

```

***

### Limiting Delegation Depth

Depth is implicitly limited by whether `invoke_agent` appears in a child agent's allowlist. If the `test-maintainer` above does not include `invoke_agent` in its tools, it cannot delegate further — the chain stops there.

This is the recommended approach: only give `invoke_agent` to orchestrator agents, not to leaf agents.

***

### Related

* [YAML Configuration](/app-help/products/dino-ai/programmable-agents/yaml-configuration.md) — `agents_squad` and `tools` fields
* [Tools Reference](/app-help/products/dino-ai/programmable-agents/tools-reference.md) — `invoke_agent`, `notify_parent_session`, `run_subagent`
* [Examples](/app-help/products/dino-ai/programmable-agents.md)  — See tutorials on how to get started deploying agents


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://docs.paradime.io/app-help/products/dino-ai/programmable-agents/agent-to-agent-delegation.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
