Skip to content

Agents as tools ​

Any agent can use other agents of the same project as tools. A support chatbot can call an order-lookup extraction agent, a router can delegate to specialist agents, a writer can call a translator. The model decides when to call them, like any other tool.

For fixed sequences (always extract, then translate, then summarize) use a workflow instead: it is deterministic, visible step by step and can pause.

Attaching an agent ​

Add an agent tool ref to the calling agent's configuration:

json
{
  "tools": [
    {
      "kind": "agent",
      "agentId": "7d0b…",
      "description": "Translates a text into a target language. Use it when the user asks for another language."
    }
  ]
}

What the model sees:

Tool propertyComes from
namethe target agent's slug
descriptionthe ref's description, else the agent's description, else Runs the agent "<name>".
parametersthe target's inputSchema; conversational targets take { "message": string }; no schema = any object

Callable targets: extraction, transform and conversational agents with a published version. Realtime and workflow agents cannot be tools. The current published version of the target runs, so publishing the target changes the behaviour of every agent that calls it.

Child runs ​

Each call is a child run of the calling run:

  • source: "agent", parentRunId set to the caller.
  • The API key and externalUserId of the root run are inherited.
  • The tool result is the child's output. A failed child run makes the tool call fail; the model sees the error and can react.

GET /v1/runs/{id} lists the direct children in children; GET /v1/runs/{id}/steps returns them too. Each child is also a normal run you can fetch by id.

Usage roll-up ​

A run's usage includes the usage of its child runs, so the root run shows the cost of the whole chain. Usage events and GET /v1/usage count every model call once, on the run that made it. The console's usage dashboard counts top-level runs only; the runs count of GET /v1/usage includes child runs.

Depth limit ​

Child runs nest at most 3 levels below the root run (the platform's MAX_RUN_DEPTH). Deeper calls fail as tool errors ("Maximum agent call depth reached"), which also stops accidental cycles (agent A calls B, B calls A) at run time. maxToolCalls of each agent still applies.

Hevkar public API v1