diff --git a/docs/_scripts/notebook_hooks.py b/docs/_scripts/notebook_hooks.py index 4e7fb697e..82196b17c 100644 --- a/docs/_scripts/notebook_hooks.py +++ b/docs/_scripts/notebook_hooks.py @@ -86,6 +86,8 @@ REDIRECT_MAP = { "cloud/how-tos/stream_events.md": "cloud/how-tos/streaming.md#stream-events", "cloud/how-tos/stream_debug.md": "cloud/how-tos/streaming.md#debug", "cloud/how-tos/stream_multiple.md": "cloud/how-tos/streaming.md#stream-multiple-modes", + "cloud/concepts/streaming.md": "concepts/streaming.md", + "agents/streaming.md": "how-tos/streaming.md", # prebuit redirects "how-tos/create-react-agent.ipynb": "agents/agents.md#basic-configuration", "how-tos/create-react-agent-memory.ipynb": "agents/memory.md", diff --git a/docs/docs/agents/streaming.md b/docs/docs/agents/streaming.md index 7c0b1265b..6b31ab5b6 100644 --- a/docs/docs/agents/streaming.md +++ b/docs/docs/agents/streaming.md @@ -25,198 +25,7 @@ Waiting is for pigeons. -## Agent progress -To stream agent progress, use the [`stream()`][langgraph.graph.state.CompiledStateGraph.stream] or [`astream()`][langgraph.graph.state.CompiledStateGraph.astream] methods with [`stream_mode="updates"`](https://langchain-ai.github.io/langgraph/how-tos/streaming/#updates). This emits an event after every agent step. - -For example, if you have an agent that calls a tool once, you should see the following updates: - -* **LLM node**: AI message with tool call requests -* **Tool node**: Tool message with execution result -* **LLM node**: Final AI response - -=== "Sync" - - ```python - agent = create_react_agent( - model="anthropic:claude-3-7-sonnet-latest", - tools=[get_weather], - ) - # highlight-next-line - for chunk in agent.stream( - {"messages": [{"role": "user", "content": "what is the weather in sf"}]}, - # highlight-next-line - stream_mode="updates" - ): - print(chunk) - print("\n") - ``` - -=== "Async" - - ```python - agent = create_react_agent( - model="anthropic:claude-3-7-sonnet-latest", - tools=[get_weather], - ) - # highlight-next-line - async for chunk in agent.astream( - {"messages": [{"role": "user", "content": "what is the weather in sf"}]}, - # highlight-next-line - stream_mode="updates" - ): - print(chunk) - print("\n") - ``` - -## LLM tokens - -To stream tokens as they are produced by the LLM, use `stream_mode="messages"`: - -=== "Sync" - - ```python - agent = create_react_agent( - model="anthropic:claude-3-7-sonnet-latest", - tools=[get_weather], - ) - # highlight-next-line - for token, metadata in agent.stream( - {"messages": [{"role": "user", "content": "what is the weather in sf"}]}, - # highlight-next-line - stream_mode="messages" - ): - print("Token", token) - print("Metadata", metadata) - print("\n") - ``` - -=== "Async" - - ```python - agent = create_react_agent( - model="anthropic:claude-3-7-sonnet-latest", - tools=[get_weather], - ) - # highlight-next-line - async for token, metadata in agent.astream( - {"messages": [{"role": "user", "content": "what is the weather in sf"}]}, - # highlight-next-line - stream_mode="messages" - ): - print("Token", token) - print("Metadata", metadata) - print("\n") - ``` - -## Tool updates - -To stream updates from tools as they are executed, you can use [get_stream_writer][langgraph.config.get_stream_writer]. - -=== "Sync" - - ```python - # highlight-next-line - from langgraph.config import get_stream_writer - - def get_weather(city: str) -> str: - """Get weather for a given city.""" - # highlight-next-line - writer = get_stream_writer() - # stream any arbitrary data - # highlight-next-line - writer(f"Looking up data for city: {city}") - return f"It's always sunny in {city}!" - - agent = create_react_agent( - model="anthropic:claude-3-7-sonnet-latest", - tools=[get_weather], - ) - - for chunk in agent.stream( - {"messages": [{"role": "user", "content": "what is the weather in sf"}]}, - # highlight-next-line - stream_mode="custom" - ): - print(chunk) - print("\n") - ``` - -=== "Async" - - ```python - # highlight-next-line - from langgraph.config import get_stream_writer - - def get_weather(city: str) -> str: - """Get weather for a given city.""" - # highlight-next-line - writer = get_stream_writer() - # stream any arbitrary data - # highlight-next-line - writer(f"Looking up data for city: {city}") - return f"It's always sunny in {city}!" - - agent = create_react_agent( - model="anthropic:claude-3-7-sonnet-latest", - tools=[get_weather], - ) - - async for chunk in agent.astream( - {"messages": [{"role": "user", "content": "what is the weather in sf"}]}, - # highlight-next-line - stream_mode="custom" - ): - print(chunk) - print("\n") - ``` - -!!! Note - If you add `get_stream_writer` inside your tool, you won't be able to invoke the tool outside of a LangGraph execution context. - -## Stream multiple modes - -You can specify multiple streaming modes by passing stream mode as a list: `stream_mode=["updates", "messages", "custom"]`: - -=== "Sync" - - ```python - agent = create_react_agent( - model="anthropic:claude-3-7-sonnet-latest", - tools=[get_weather], - ) - - for stream_mode, chunk in agent.stream( - {"messages": [{"role": "user", "content": "what is the weather in sf"}]}, - # highlight-next-line - stream_mode=["updates", "messages", "custom"] - ): - print(chunk) - print("\n") - ``` - -=== "Async" - - ```python - agent = create_react_agent( - model="anthropic:claude-3-7-sonnet-latest", - tools=[get_weather], - ) - - async for stream_mode, chunk in agent.astream( - {"messages": [{"role": "user", "content": "what is the weather in sf"}]}, - # highlight-next-line - stream_mode=["updates", "messages", "custom"] - ): - print(chunk) - print("\n") - ``` - -## Disable streaming - -In some applications you might need to disable streaming of individual tokens for a given model. This is useful in [multi-agent](./multi-agent.md) systems to control which agents stream their output. - -See the [Models](./models.md#disable-streaming) guide to learn how to disable streaming. ## Additional resources diff --git a/docs/docs/cloud/concepts/streaming.md b/docs/docs/cloud/concepts/streaming.md deleted file mode 100644 index 8654bda58..000000000 --- a/docs/docs/cloud/concepts/streaming.md +++ /dev/null @@ -1,138 +0,0 @@ -# Streaming - -Streaming is critical for making LLM applications feel responsive to end users. -When creating a streaming run, the **streaming mode** determines what kinds of data are streamed back to the API client. - -## Supported streaming modes - -LangGraph Platform supports the following streaming modes: - -| Mode | Description | LangGraph Library Method | -|----------------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------|-------------------------------------------------------------------------| -| **`values`** | Stream the full graph state after each [super-step](https://langchain-ai.github.io/langgraph/concepts/low_level/#graphs). [Guide](../how-tos/streaming.md#stream-graph-state) | `.stream()` / `.astream()` with `stream_mode="values"` | -| **`updates`** | Stream only the updates to the graph state after each node. [Guide](../how-tos/streaming.md#stream-graph-state) | `.stream()` / `.astream()` with `stream_mode="updates"` | -| **`messages-tuple`** | Stream LLM tokens for any messages generated inside the graph (useful for chat apps). [Guide](../how-tos/streaming.md#messages) | `.stream()` / `.astream()` with `stream_mode="messages"` | -| **`debug`** | Stream debug information throughout graph execution. [Guide](../how-tos/streaming.md#debug) | `.stream()` / `.astream()` with `stream_mode="debug"` | -| **`custom`** | Stream custom data. [Guide](../../how-tos/streaming.md#stream-custom-data) | `.stream()` / `.astream()` with `stream_mode="custom"` | -| **`events`** | Stream all events (including the state of the graph); mainly useful when migrating large LCEL apps. [Guide](../how-tos/streaming.md#stream-events) | `.astream_events()` | - -✅ You can also **combine multiple modes** at the same time. See the [how-to guide](../how-tos/streaming.md#stream-multiple-modes) for configuration details. - -## Stateless runs - -If you don't want to **persist the outputs** of a streaming run in the [checkpointer](../../concepts/persistence.md) DB, you can create a stateless run without creating a thread: - -=== "Python" - - ```python - from langgraph_sdk import get_client - client = get_client(url=, api_key=) - - async for chunk in client.runs.stream( - # highlight-next-line - None, # (1)! - assistant_id, - input=inputs, - stream_mode="updates" - ): - print(chunk.data) - ``` - - 1. We are passing `None` instead of a `thread_id` UUID. - -=== "JavaScript" - - ```js - import { Client } from "@langchain/langgraph-sdk"; - const client = new Client({ apiUrl: , apiKey: }); - - // create a streaming run - // highlight-next-line - const streamResponse = client.runs.stream( - // highlight-next-line - null, // (1)! - assistantID, - { - input, - streamMode: "updates" - } - ); - for await (const chunk of streamResponse) { - console.log(chunk.data); - } - ``` - - 1. We are passing `None` instead of a `thread_id` UUID. - -=== "cURL" - - ```bash - curl --request POST \ - --url /runs/stream \ - --header 'Content-Type: application/json' \ - --header 'x-api-key: ' - --data "{ - \"assistant_id\": \"agent\", - \"input\": , - \"stream_mode\": \"updates\" - }" - ``` - -## Join and stream - -LangGraph Platform allows you to join an active [background run](../how-tos/background_run.md) and stream outputs from it. To do so, you can use [LangGraph SDK's](https://langchain-ai.github.io/langgraph/cloud/reference/sdk/python_sdk_ref/) `client.runs.join_stream` method: - -=== "Python" - - ```python - from langgraph_sdk import get_client - client = get_client(url=, api_key=) - - # highlight-next-line - async for chunk in client.runs.join_stream( - thread_id, - # highlight-next-line - run_id, # (1)! - ): - print(chunk) - ``` - - 1. This is the `run_id` of an existing run you want to join. - - -=== "JavaScript" - - ```js - import { Client } from "@langchain/langgraph-sdk"; - const client = new Client({ apiUrl: , apiKey: }); - - // highlight-next-line - const streamResponse = client.runs.joinStream( - threadID, - // highlight-next-line - runId // (1)! - ); - for await (const chunk of streamResponse) { - console.log(chunk); - } - ``` - - 1. This is the `run_id` of an existing run you want to join. - -=== "cURL" - - ```bash - curl --request GET \ - --url /threads//runs//stream \ - --header 'Content-Type: application/json' \ - --header 'x-api-key: ' - ``` - -!!! warning "Outputs not buffered" - - When you use `.join_stream`, output is not buffered, so any output produced before joining will not be received. - -## API Reference - -For API usage and implementation, refer to the [API reference](../reference/api/api_ref.html#tag/thread-runs/POST/threads/{thread_id}/runs/stream). - diff --git a/docs/docs/cloud/how-tos/streaming.md b/docs/docs/cloud/how-tos/streaming.md index 74f5fd9eb..f654a0625 100644 --- a/docs/docs/cloud/how-tos/streaming.md +++ b/docs/docs/cloud/how-tos/streaming.md @@ -1,8 +1,12 @@ -# Stream outputs +# Streaming API -## Streaming API +[LangGraph SDK](https://langchain-ai.github.io/langgraph/cloud/reference/sdk/python_sdk_ref/) allows you to [stream outputs](../../concepts/streaming.md) from the LangGraph API server. -[LangGraph SDK](https://langchain-ai.github.io/langgraph/cloud/reference/sdk/python_sdk_ref/) allows you to stream outputs from the LangGraph API server. +!!! note + + LangGraph SDK and LangGraph Server are a part of [LangGraph Platform](../../concepts/langgraph_platform.md). + +## Basic usage Basic usage example: @@ -833,3 +837,121 @@ To stream all events, including the state of the graph: \"stream_mode\": \"events\" }" ``` + +## Stateless runs + +If you don't want to **persist the outputs** of a streaming run in the [checkpointer](../../concepts/persistence.md) DB, you can create a stateless run without creating a thread: + +=== "Python" + + ```python + from langgraph_sdk import get_client + client = get_client(url=, api_key=) + + async for chunk in client.runs.stream( + # highlight-next-line + None, # (1)! + assistant_id, + input=inputs, + stream_mode="updates" + ): + print(chunk.data) + ``` + + 1. We are passing `None` instead of a `thread_id` UUID. + +=== "JavaScript" + + ```js + import { Client } from "@langchain/langgraph-sdk"; + const client = new Client({ apiUrl: , apiKey: }); + + // create a streaming run + // highlight-next-line + const streamResponse = client.runs.stream( + // highlight-next-line + null, // (1)! + assistantID, + { + input, + streamMode: "updates" + } + ); + for await (const chunk of streamResponse) { + console.log(chunk.data); + } + ``` + + 1. We are passing `None` instead of a `thread_id` UUID. + +=== "cURL" + + ```bash + curl --request POST \ + --url /runs/stream \ + --header 'Content-Type: application/json' \ + --header 'x-api-key: ' + --data "{ + \"assistant_id\": \"agent\", + \"input\": , + \"stream_mode\": \"updates\" + }" + ``` + +## Join and stream + +LangGraph Platform allows you to join an active [background run](../how-tos/background_run.md) and stream outputs from it. To do so, you can use [LangGraph SDK's](https://langchain-ai.github.io/langgraph/cloud/reference/sdk/python_sdk_ref/) `client.runs.join_stream` method: + +=== "Python" + + ```python + from langgraph_sdk import get_client + client = get_client(url=, api_key=) + + # highlight-next-line + async for chunk in client.runs.join_stream( + thread_id, + # highlight-next-line + run_id, # (1)! + ): + print(chunk) + ``` + + 1. This is the `run_id` of an existing run you want to join. + + +=== "JavaScript" + + ```js + import { Client } from "@langchain/langgraph-sdk"; + const client = new Client({ apiUrl: , apiKey: }); + + // highlight-next-line + const streamResponse = client.runs.joinStream( + threadID, + // highlight-next-line + runId // (1)! + ); + for await (const chunk of streamResponse) { + console.log(chunk); + } + ``` + + 1. This is the `run_id` of an existing run you want to join. + +=== "cURL" + + ```bash + curl --request GET \ + --url /threads//runs//stream \ + --header 'Content-Type: application/json' \ + --header 'x-api-key: ' + ``` + +!!! warning "Outputs not buffered" + + When you use `.join_stream`, output is not buffered, so any output produced before joining will not be received. + +## API Reference + +For API usage and implementation, refer to the [API reference](../reference/api/api_ref.html#tag/thread-runs/POST/threads/{thread_id}/runs/stream). diff --git a/docs/docs/concepts/langgraph_platform.md b/docs/docs/concepts/langgraph_platform.md index 780d7f6a2..e8682c451 100644 --- a/docs/docs/concepts/langgraph_platform.md +++ b/docs/docs/concepts/langgraph_platform.md @@ -17,7 +17,7 @@ Develop, deploy, scale, and manage agents with **LangGraph Platform** — the pu LangGraph Platform makes it easy to get your agent running in production — whether it’s built with LangGraph or another framework — so you can focus on your app logic, not infrastructure. Deploy with one click to get a live endpoint, and use our robust APIs and built-in task queues to handle production scale. -- **[Streaming Support](../cloud/concepts/streaming.md)**: As agents grow more sophisticated, they often benefit from streaming both token outputs and intermediate states back to the user. Without this, users are left waiting for potentially long operations with no feedback. LangGraph Server provides multiple streaming modes optimized for various application needs. +- **[Streaming Support](../cloud/how-tos/streaming.md)**: As agents grow more sophisticated, they often benefit from streaming both token outputs and intermediate states back to the user. Without this, users are left waiting for potentially long operations with no feedback. LangGraph Server provides multiple streaming modes optimized for various application needs. - **[Background Runs](../cloud/how-tos/background_run.md)**: For agents that take longer to process (e.g., hours), maintaining an open connection can be impractical. The LangGraph Server supports launching agent runs in the background and provides both polling endpoints and webhooks to monitor run status effectively. diff --git a/docs/docs/how-tos/streaming.md b/docs/docs/how-tos/streaming.md index d85cb3000..78e240a4a 100644 --- a/docs/docs/how-tos/streaming.md +++ b/docs/docs/how-tos/streaming.md @@ -1,11 +1,208 @@ # Stream outputs -## Streaming API +You can [stream outputs](../concepts/streaming.md) from a LangGraph agent or workflow. + +## Stream from an agent + +### Agent progress + +To stream agent progress, use the [`stream()`][langgraph.graph.state.CompiledStateGraph.stream] or [`astream()`][langgraph.graph.state.CompiledStateGraph.astream] methods with [`stream_mode="updates"`](https://langchain-ai.github.io/langgraph/how-tos/streaming/#updates). This emits an event after every agent step. + +For example, if you have an agent that calls a tool once, you should see the following updates: + +* **LLM node**: AI message with tool call requests +* **Tool node**: Tool message with execution result +* **LLM node**: Final AI response + +=== "Sync" + + ```python + agent = create_react_agent( + model="anthropic:claude-3-7-sonnet-latest", + tools=[get_weather], + ) + # highlight-next-line + for chunk in agent.stream( + {"messages": [{"role": "user", "content": "what is the weather in sf"}]}, + # highlight-next-line + stream_mode="updates" + ): + print(chunk) + print("\n") + ``` + +=== "Async" + + ```python + agent = create_react_agent( + model="anthropic:claude-3-7-sonnet-latest", + tools=[get_weather], + ) + # highlight-next-line + async for chunk in agent.astream( + {"messages": [{"role": "user", "content": "what is the weather in sf"}]}, + # highlight-next-line + stream_mode="updates" + ): + print(chunk) + print("\n") + ``` + +### LLM tokens + +To stream tokens as they are produced by the LLM, use `stream_mode="messages"`: + +=== "Sync" + + ```python + agent = create_react_agent( + model="anthropic:claude-3-7-sonnet-latest", + tools=[get_weather], + ) + # highlight-next-line + for token, metadata in agent.stream( + {"messages": [{"role": "user", "content": "what is the weather in sf"}]}, + # highlight-next-line + stream_mode="messages" + ): + print("Token", token) + print("Metadata", metadata) + print("\n") + ``` + +=== "Async" + + ```python + agent = create_react_agent( + model="anthropic:claude-3-7-sonnet-latest", + tools=[get_weather], + ) + # highlight-next-line + async for token, metadata in agent.astream( + {"messages": [{"role": "user", "content": "what is the weather in sf"}]}, + # highlight-next-line + stream_mode="messages" + ): + print("Token", token) + print("Metadata", metadata) + print("\n") + ``` + +### Tool updates + +To stream updates from tools as they are executed, you can use [get_stream_writer][langgraph.config.get_stream_writer]. + +=== "Sync" + + ```python + # highlight-next-line + from langgraph.config import get_stream_writer + + def get_weather(city: str) -> str: + """Get weather for a given city.""" + # highlight-next-line + writer = get_stream_writer() + # stream any arbitrary data + # highlight-next-line + writer(f"Looking up data for city: {city}") + return f"It's always sunny in {city}!" + + agent = create_react_agent( + model="anthropic:claude-3-7-sonnet-latest", + tools=[get_weather], + ) + + for chunk in agent.stream( + {"messages": [{"role": "user", "content": "what is the weather in sf"}]}, + # highlight-next-line + stream_mode="custom" + ): + print(chunk) + print("\n") + ``` + +=== "Async" + + ```python + # highlight-next-line + from langgraph.config import get_stream_writer + + def get_weather(city: str) -> str: + """Get weather for a given city.""" + # highlight-next-line + writer = get_stream_writer() + # stream any arbitrary data + # highlight-next-line + writer(f"Looking up data for city: {city}") + return f"It's always sunny in {city}!" + + agent = create_react_agent( + model="anthropic:claude-3-7-sonnet-latest", + tools=[get_weather], + ) + + async for chunk in agent.astream( + {"messages": [{"role": "user", "content": "what is the weather in sf"}]}, + # highlight-next-line + stream_mode="custom" + ): + print(chunk) + print("\n") + ``` + +!!! Note + If you add `get_stream_writer` inside your tool, you won't be able to invoke the tool outside of a LangGraph execution context. + +### Stream multiple modes + +You can specify multiple streaming modes by passing stream mode as a list: `stream_mode=["updates", "messages", "custom"]`: + +=== "Sync" + + ```python + agent = create_react_agent( + model="anthropic:claude-3-7-sonnet-latest", + tools=[get_weather], + ) + + for stream_mode, chunk in agent.stream( + {"messages": [{"role": "user", "content": "what is the weather in sf"}]}, + # highlight-next-line + stream_mode=["updates", "messages", "custom"] + ): + print(chunk) + print("\n") + ``` + +=== "Async" + + ```python + agent = create_react_agent( + model="anthropic:claude-3-7-sonnet-latest", + tools=[get_weather], + ) + + async for stream_mode, chunk in agent.astream( + {"messages": [{"role": "user", "content": "what is the weather in sf"}]}, + # highlight-next-line + stream_mode=["updates", "messages", "custom"] + ): + print(chunk) + print("\n") + ``` + +### Disable streaming + +In some applications you might need to disable streaming of individual tokens for a given model. This is useful in [multi-agent](./multi-agent.md) systems to control which agents stream their output. + +See the [Models](./models.md#disable-streaming) guide to learn how to disable streaming. + +## Stream from a workflow + +### Basic usage example LangGraph graphs expose the [`.stream()`][langgraph.pregel.Pregel.stream] (sync) and [`.astream()`][langgraph.pregel.Pregel.astream] (async) methods to yield streamed outputs as iterators. -Basic usage example: - === "Sync" ```python @@ -94,7 +291,7 @@ The streamed outputs will be tuples of `(mode, chunk)` where `mode` is the name print(chunk) ``` -## Stream graph state +### Stream graph state Use the stream modes `updates` and `values` to stream the state of the graph as it executes. @@ -157,7 +354,7 @@ graph = ( ``` -## Subgraphs +### Stream subgraph outputs To include outputs from [subgraphs](../concepts/subgraphs.md) in the streamed outputs, you can set `subgraphs=True` in the `.stream()` method of the parent graph. This will stream outputs from both the parent graph and any subgraphs. @@ -233,7 +430,7 @@ for chunk in graph.stream( **Note** that we are receiving not just the node updates, but we also the namespaces which tell us what graph (or subgraph) we are streaming from. -## Debugging {#debug} +### Debugging {#debug} Use the `debug` streaming mode to stream as much information as possible throughout the execution of the graph. The streamed outputs include the name of the node as well as the full state. @@ -247,7 +444,7 @@ for chunk in graph.stream( ``` -## LLM tokens {#messages} +### LLM tokens {#messages} Use the `messages` streaming mode to stream Large Language Model (LLM) outputs **token by token** from any part of your graph, including nodes, tools, subgraphs, or tasks. @@ -307,7 +504,7 @@ for message_chunk, metadata in graph.stream( # (2)! 2. The "messages" stream mode returns an iterator of tuples `(message_chunk, metadata)` where `message_chunk` is the token streamed by the LLM and `metadata` is a dictionary with information about the graph node where the LLM was called and other information. -### Filter by LLM invocation +#### Filter by LLM invocation You can associate `tags` with LLM invocations to filter the streamed tokens by LLM invocation. @@ -391,7 +588,7 @@ async for msg, metadata in graph.astream( # (3)! 4. The `stream_mode` is set to "messages" to stream LLM tokens. The `metadata` contains information about the LLM invocation, including the tags. -### Filter by node +#### Filter by node To stream tokens only from specific nodes, use `stream_mode="messages"` and filter the outputs by the `langgraph_node` field in the streamed metadata: @@ -464,7 +661,7 @@ for msg, metadata in graph.stream( # (1)! 1. The "messages" stream mode returns a tuple of `(message_chunk, metadata)` where `message_chunk` is the token streamed by the LLM and `metadata` is a dictionary with information about the graph node where the LLM was called and other information. 2. Filter the streamed tokens by the `langgraph_node` field in the metadata to only include the tokens from the `write_poem` node. -## Stream custom data +### Stream custom data To send **custom user-defined data** from inside a LangGraph node or tool, follow these steps: @@ -541,7 +738,7 @@ To send **custom user-defined data** from inside a LangGraph node or tool, follo 3. Emit another custom key-value pair. 4. Set `stream_mode="custom"` to receive the custom data in the stream. -## Use with any LLM +### Use with any LLM You can use `stream_mode="custom"` to stream data from **any LLM API** — even if that API does **not** implement the LangChain chat model interface. @@ -701,7 +898,7 @@ for chunk in graph.stream( ``` -## Disable streaming for specific chat models +### Disable streaming for specific chat models If your application mixes models that support streaming with those that do not, you may need to explicitly disable streaming for models that do not support it. @@ -733,7 +930,7 @@ Set `disable_streaming=True` when initializing the model. 1. Set `disable_streaming=True` to disable streaming for the chat model. -## Async with Python < 3.11 { #async } +### Async with Python < 3.11 { #async } In Python versions < 3.11, [asyncio tasks](https://docs.python.org/3/library/asyncio-task.html#asyncio.create_task) do not support the `context` parameter. This limits LangGraph ability to automatically propagate context, and affects LangGraph’s streaming mechanisms in two key ways: diff --git a/docs/mkdocs.yml b/docs/mkdocs.yml index 131c86e3f..c6b0b241c 100644 --- a/docs/mkdocs.yml +++ b/docs/mkdocs.yml @@ -117,9 +117,7 @@ nav: - Application structure: concepts/application_structure.md - Scalability & resilience: concepts/scalability_and_resilience.md - Core capabilities: - - Streaming: - - concepts/streaming.md - - cloud/concepts/streaming.md + - Streaming: concepts/streaming.md - Persistence: concepts/persistence.md - Durable execution: concepts/durable_execution.md - Memory: concepts/memory.md @@ -130,7 +128,7 @@ nav: - Multi-agent: concepts/multi_agent.md - Platform capabilities: - Authentication & access control: concepts/auth.md - - Assistants: + - Assistants: #COMBINE - Overview: concepts/assistants.md - Threads: cloud/concepts/threads.md - Runs: cloud/concepts/runs.md @@ -147,7 +145,6 @@ nav: - Self-Hosted Control Plane: concepts/langgraph_self_hosted_control_plane.md - Standalone Container: concepts/langgraph_standalone_container.md - - Guides: - Prebuilt agents: - agents/run_agents.md @@ -157,9 +154,8 @@ nav: - Models: - Basic implementation: agents/models.md - Streaming: - - Basic implementation: agents/streaming.md - - Custom implementation: how-tos/streaming.md - - Production-ready implementation: cloud/how-tos/streaming.md + - Stream outputs: how-tos/streaming.md + - Use Server API: cloud/how-tos/streaming.md - Persistence: how-tos/persistence.ipynb - Context: - Basic implementation: agents/context.md