Skip to content

Subagents

Order (which agent runs before which) lives in workflows/ — see Workflows. This page covers the one multi-agent thing that lives in agent frontmatter: tool delegation, subagents: — "this agent may call that one," unrelated to run order. The agents reachable through subagents: form the agent's delegation tree.

Delegation

Declare which other agents this one can call with subagents: in the YAML frontmatter — there is no Jinja call for this in the prompt body. Plain strings reference an agent with no overrides; a single-key mapping applies per-dependency overrides (see below). agents/incident-coordinator.md:

---
name: incident-coordinator
description: Routes investigations to specialists.
subagents:
  - github-investigator
  - montecarlo-investigator
---

For code-related issues, delegate to `github-investigator`.
For data quality issues, delegate to `montecarlo-investigator`.

The two specialists are ordinary agents. A minimal pair, agents/github-investigator.md and agents/montecarlo-investigator.md:

---
description: Searches code and pull requests on GitHub.
---

You investigate code changes and pull requests.
---
description: Investigates data quality alerts.
---

You investigate data quality incidents.

Without them, compile stops with ERROR: Agent 'incident-coordinator' delegates to unknown agent 'github-investigator'. For specialists that call GitHub through MCP, see MCP integrations.

Each subagents: entry becomes a tool the coordinator's model can call at runtime. Its name and description come from the subagent's own frontmatter.

You can also declare subagents in an agent schema YAML file (agents/*.yaml) under the agent's entry. This has the same union-merge semantics: entries already declared in the .md file take precedence, and schema YAML adds any remaining ones.

Running with delegation

abt run -s <agent> runs exactly that agent plus its full declared subagents: tree, unbounded — there is no partial-depth option and no flag anywhere (in run or test) that strips subagents from an agent that declares them. abt run is "isolation" only in the workflow sense: it never runs anything outside this agent's own subagents: closure — no workflow neighbor is ever pulled in.

Example — agents/refund-handler.md declares subagents: [refund-policy]:

abt run -s refund-handler -p "Refund my last order"

refund-policy is wired as a task-tool target refund-handler's model may call; nothing outside this pair runs.

Agent-level overrides on dependencies

Override model_id, temperature, recursion_limit (LangGraph step budget for that subagent), and mode (sync | async | fork dispatch — see Background (async) subagents and Fork subagents) per dependency by switching a plain string entry to a single-key mapping in subagents::

subagents:
  - github-investigator:
      model_id: bedrock_converse:eu.anthropic.claude-haiku-5-5
      temperature: 0.1
      recursion_limit: 80
      mode: async

Which pattern to use?

Situation Use
Coordinator routes work to specialists based on the query subagents: — bare name for the full tree
Investigate then format, post, or branch workflows/ — see Workflows
Test one agent alone, no delegation abt run -s <agent> — this is already isolation

Token usage and artifacts

The orchestrator records per-agent token counts. total_input_tokens / total_output_tokens sum recursively across all subagent calls.

Test configuration

Every test run wires the agent's full declared subagents: tree; abt test --only-agent only narrows which agent's suite executes, it does not strip the wiring. See Testing.

Compile-time validation

abt compile checks that: - Every dependency target listed in subagents: exists in the manifest - The delegation tree is acyclic. A cycle fails the compile (exit 2) with ERROR: Agent dependency cycle detected: a -> b -> a, so abt doctor never sees one.

Disabling the general-purpose subagent

abt adds a built-in general-purpose subagent to every delegating agent. It gives the delegating agent a task tool for open-ended subtasks that aren't part of your delegation tree.

To make the agent delegate only to the explicit subagents you declared, you can turn the auto-injected subagent off.

Project-wide (abt.yaml)

config:
  general_purpose_subagent: false

Per-agent (frontmatter)

---
description: Focused orchestrator — delegates only to declared dependencies
general_purpose_subagent: false
---

The frontmatter setting always wins over the project default. Setting true in frontmatter re-enables the subagent even if the project default is false.

Guardrails

The general-purpose subagent calls the delegating agent's tools under that agent's tool guardrails: tool error formatting, the tool result cache, per-tool runtime caps (execution_timeout) and approvals. When the delegating agent declares compaction, the general-purpose subagent gets its own compaction instead of the default summarizer.

It also runs the delegating agent's declared middleware, each as an instance of its own: tool_call_limit, model_call_limit, token_budget, loop_detection, run_timeout, model_rate_limit, progress_tracker, model_retry, tool_retry, compaction and any other middleware the agent declares. A middleware added later is covered without a change here. Three are left out because they belong to the delegating agent:

Not applied Why
rubric It grades the delegating agent's final answer; the subagent's report is not that answer.
todo_list The plan (write_todos) belongs to the delegating agent.
code_interpreter It adds the eval tool to an agent; the subagent's tool surface stays that of the delegating agent.

Each task call starts from zero, as a call to a declared subagent does with its own guardrails: a tool_call_limit of 3 allows three calls per task, and token_budget counts only the subagent's own tokens, not the delegating agent's. These limits are enforced per task call, not as a cap across calls, so repeated delegation multiplies them. When a global bound matters, cap the task tool itself:

yaml middleware: - tool_call_limit: task: 4 # at most four delegations in the run search: 3 # and three `search` calls inside each of them A run_timeout clock starts at the subagent's first model call; the hard timeout on the whole run still applies on top. The delegating agent's output_schema is not applied: a guard that ends the subagent ends it with a plain answer, and with no synthesis_model that answer is a fixed sentence saying the subagent stopped early, so the delegating agent does not read an empty result as a finished one.

When the general-purpose subagent is disabled and no other synchronous subagents are configured, the task tool is not exposed to the delegating agent at all.

Background subagent tools

A delegating agent that has at least one mode: async subagent gets four tools for managing background runs (see Background (async) subagents):

Tool Use
start_subagent_task(description, subagent_type) Start a background run. Returns a task_id.
check_subagent_task(task_id) Read a task's status and result. Reports lost if abt restarted while it ran, and timeout after the hard timeout.
update_subagent_task(task_id, additional_instructions) Restart a running task with extra instructions appended.
cancel_subagent_task(task_id) Cancel a running task.

A start_subagent_task call lists the subagent under Agents called: in the run footnote, like a task delegation.

Delegation depth

Nested delegation stops at ABT_MAX_DELEGATION_DEPTH levels (default 10).

See also