run_stream and arun_stream take the same arguments as run and arun, and yield the events of the run as they happen: pieces of the answer, reasoning, tool calls starting and finishing. The last item is the complete AgentResponse.

Async

Events

Every event carries agent_id and run_id. In a stream, the events of sub-agents are forwarded live too, tagged with metadata["subagent_call_id"], so a UI can show what each one is doing. The same events are kept in response.events for a non-streaming run.

Stopping early

Breaking out of the loop, closing the generator or cancelling the task ends the run. Its response gets finish_reason="interrupted", and what was spent until then still counts in agent.total_usage and in the traces.

Streaming a model call

LLM clients stream too: llm.stream() and llm.astream() yield one ModelResponse per delta.
Inside a Temporal workflow, streaming is not available: use await agent.arun(). See Durable execution.