What a subagent shares, and what it does not
Subagents cannot start subagents of their own. Delegation is one level deep.
Turn it on
Examples on this page assumeclient is an OpenAI client configured as in Build with the API.
Set multi_agent on the agent. max_concurrent_subagents limits how many helpers run at once; it is 6 if you leave it out.
The limit is not a queue. When the agent tries to start a helper while that many are already running, the new helper is refused with “Session subagent concurrency limit reached”, and the agent sees that as a failed call. If a task can need more helpers than the limit, tell the agent to start them in batches and wait for each batch to return, as the review team recipe does.
See what the helpers did
The parent’s history shows its own messages plus the calls it made to start and talk to helpers (create_subagent_call items and related types). Each helper’s own conversation is stored separately under the session:
sessions.subagents.turns.retrieve(turn_id, session_id=session_id, subagent_id=child.id) gets its state, and sessions.subagents.turns.items.list(...) lists its items. The sessions reference has the full route table.
Watch out for
- Helper turns appear in the session’s turn list. They have a
subagent_id. When you wait for your own turn to finish, skip them, or you may stop waiting too early. See turns and statuses. - A closed helper is not a successful helper. The
agent.session.subagent.closedevent means the helper stopped. Check its turns to see whether it completed or failed. - Cost and time. Every helper makes its own model calls, on the parent’s model and paid for the same way. Delegation can finish sooner but usually uses more tokens.
- Same trust level. A helper has the same tools and sandbox as its parent. Delegation is not a security boundary.
- Keep the session until you have read the helper histories and downloaded any artifacts you need.
agent.session.subagent.* events.