Multi-agent Patterns

Multi-agent Streaming

Stream coordinator output while surfacing nested specialist-agent progress.

Use multi-agent streaming when one coordinator agent delegates work to specialist agents and the caller should see progress while the specialists run. The coordinator still owns the final answer, but the UI can show nested child-agent activity through agent_tool_event.

Scenario

An incident coordinator receives a customer-impact report. It delegates to support, engineering, and communications specialists. The user sees the coordinator's final brief stream in normally, while each specialist's progress appears in grouped status panels.

When to Use It

Use this pattern when:

  • one coordinator should decide which specialists to call
  • specialist work may take long enough that hidden progress feels stalled
  • the UI should group nested progress by specialist or tool call
  • the final answer should still come from one coordinator
  • child-agent progress should be replayable or inspectable after the run

Do not use this pattern just to run known independent work. Use parallel pipelines when every branch should run and the coordinator does not need to decide.

Architecture Shape

LayerResponsibility
coordinator agentdecides which specialists to call and writes the final response
specialist agentsown narrow role instructions and return focused findings
streaming agent toolsexpose specialists with asTool({ stream: true })
request runnerapplies trace metadata, tool concurrency, and stream response shape
UI stream consumerrenders parent events and groups nested agent_tool_event values
event storeoptionally persists parent and child events for replay and debugging

Requirements

Nested streaming requires:

  • the parent run uses .stream()
  • specialist tools are created with stream: true
  • the child model supports streaming

If nested streaming is unavailable, the specialist still behaves like a normal opaque asTool(...) call. The parent model receives only the final specialist output as the normal tool_result; intermediate child events are for the caller, trace, or event store.

Pages

Choose the Right Shape

ShapeUse it when
agent.asTool(...)child progress can stay hidden
agent.asTool({ stream: true })coordinator decides which specialists to call and the caller should see child progress
parallel pipelinesevery branch should always run and return typed outputs
separate Studio agentsoperators should run specialists manually during development