> ## Documentation Index
> Fetch the complete documentation index at: https://langchain-5e9cc07a-preview-cta2-1778260809-ad7a43f.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# Event Streaming

> Stream real-time updates from LangChain agent runs with typed projections.

LangChain agents are built on LangGraph, so they support the same Event Streaming model with agent-focused projections for messages, tool calls, state, and custom updates.

For most application and frontend use cases, use Event Streaming through `stream_events(..., version="v3")`. Event Streaming returns a run object with typed projections, so you can choose the view you need instead of parsing stream-mode tuples.

<Tip>
  Check out the [streaming cookbook](https://github.com/langchain-ai/streaming-cookbook) for runnable examples and links to detailed reference documentation.
</Tip>

<Note>
  Interested in streaming Pregel modes such as `updates`, `messages`, or `custom` directly? See the [Streaming page](/oss/python/langchain/streaming).
</Note>

```python theme={null}
from langchain.agents import create_agent


def get_weather(city: str) -> str:
    """Get weather for a city."""
    return f"It's always sunny in {city}!"


agent = create_agent(
    model="gpt-5-nano",
    tools=[get_weather],
)

run = agent.stream_events(
    {"messages": [{"role": "user", "content": "What is the weather in SF?"}]},
    version="v3",
)

for message in run.messages:
    for delta in message.text:
        print(delta, end="", flush=True)

final_state = run.output
```

## What you can stream

| Projection           | Use                                                                        |
| -------------------- | -------------------------------------------------------------------------- |
| `for event in run`   | Raw protocol events when you need exact arrival order.                     |
| `run.messages`       | Model message streams, one per LLM call.                                   |
| `message.text`       | Text deltas and final text for a message.                                  |
| `message.reasoning`  | Reasoning deltas for models that expose reasoning content.                 |
| `message.tool_calls` | Tool-call argument chunks and finalized tool calls.                        |
| `message.output`     | Final message object after the model call completes.                       |
| `message.usage`      | Token usage metadata when the provider returns it.                         |
| `run.values`         | Agent state snapshots.                                                     |
| `run.output`         | Final agent state.                                                         |
| `run.extensions`     | Custom transformer projections.                                            |
| `run.tool_calls`     | Tool execution lifecycle, inputs, output deltas, final output, and errors. |

`run.messages` yields `ChatModelStream` objects. Each message stream exposes `.text`, `.reasoning`, `.tool_calls`, and `.output`. Sync projections are iterable for live deltas and drainable for final values.

## Stream agent messages

Use `run.messages` when you want model output from each LLM call.

```python theme={null}
run = agent.stream_events(input, version="v3")

for message in run.messages:
    print(f"[{message.node}] ", end="")
    for delta in message.text:
        print(delta, end="", flush=True)

    full_message = message.output
    usage = full_message.usage_metadata
    if usage:
        print(usage)
```

## Stream tool calls

There are two useful tool-call projections:

* `message.tool_calls` streams tool-call argument chunks while the model is producing the tool call.
* `run.tool_calls` streams the lifecycle of tool execution after the tool call starts.

```python theme={null}
run = agent.stream_events(input, version="v3")

for message in run.messages:
    for chunk in message.tool_calls:
        print(f"tool call chunk: {chunk}")

    finalized = message.tool_calls.get()
    if finalized:
        print(f"finalized tool calls: {finalized}")

for call in run.tool_calls:
    print(f"{call.tool_name}({call.input})")
    for delta in call.output_deltas:
        print(delta, end="", flush=True)
    print(call.output, call.error)
```

## Stream state and final output

Use `run.values` for state snapshots and `run.output` for the final agent state.

```python theme={null}
run = agent.stream_events(input, version="v3")

for snapshot in run.values:
    print(snapshot)

final_state = run.output
```

## Related

* [Streaming cookbook](https://github.com/langchain-ai/streaming-cookbook) shows runnable Event Streaming examples.
* [LangChain Streaming](/oss/python/langchain/streaming) covers lower-level Pregel stream modes.
* [LangGraph Event Streaming](/oss/python/langgraph/streaming/event-streaming) explains the underlying graph streaming model.

***

<div className="source-links">
  <Callout icon="terminal-2">
    [Connect these docs](/use-these-docs) to Claude, VSCode, and more via MCP for real-time answers.
  </Callout>

  <Callout icon="edit">
    [Edit this page on GitHub](https://github.com/langchain-ai/docs/edit/main/src/oss/langchain/event-streaming.mdx) or [file an issue](https://github.com/langchain-ai/docs/issues/new/choose).
  </Callout>
</div>
