> ## Documentation Index
> Fetch the complete documentation index at: https://docs.cosmon.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Multi-agent handoff

> Attribute a run that spans a handoff chain via event.agent.

A run can span a **handoff chain** — one agent delegating to another mid-run.
Both event types carry `agent` (which agent produced the event), so multi-agent
output stays attributable. Label the stream by the agent in control:

```python theme={null}
from cosmon_agent_sdk import Client, TextChunk

with Client() as client:
    speaker = ""
    for event in client.run("Set up the model, then hand off to COMSOL to solve it", agent="solidworks"):
        if event.agent and event.agent != speaker:   # who's talking now
            speaker = event.agent
            print(f"\n[{speaker}]")
        if isinstance(event, TextChunk):
            print(event.text, end="", flush=True)
```

In a session, later turns follow the agent in control — so a handoff carries
into the next turn, the same as in the app. `.text(live=True)` prints these
`[agent]` labels for you.

<Card title="Guide: streaming the run" icon="book-open" href="/sdk/guide#streaming-the-run">
  Agent attribution across a handoff chain.
</Card>
