# stream

> **Method** in `@langchain/langgraph`

📖 [View in docs](https://reference.langchain.com/javascript/langchain-langgraph/index/CompiledStateGraph/stream)

Streams the execution of the graph, emitting state updates as they occur.
This is the primary method for observing graph execution in real-time.

Stream modes:
- "values": Emits complete state after each step
- "updates": Emits only state changes after each step
- "debug": Emits detailed debug information
- "messages": Emits messages from within nodes
- "custom": Emits custom events from within nodes
- "checkpoints": Emits checkpoints from within nodes
- "tasks": Emits tasks from within nodes

## Signature

```javascript
stream<TStreamMode extends StreamMode | StreamMode[] | undefined, TSubgraphs extends boolean, TEncoding extends "text/event-stream" | undefined>(input: ExtractUpdateType<I, ExtractStateType<I, I>> | CommandInstance<InferInterruptResumeType<InterruptType, false>, { [K in string | number | symbol]: U[K] }, N> | null, options?: Partial<PregelOptions<Record<"__start__" | N, PregelNode<S, U>>, Record<string | N, BaseChannel<unknown, unknown, unknown>>, ExtractStateType<C, C> & Record<string, any>, TStreamMode, TSubgraphs, TEncoding>>): Promise<IterableReadableStream<StreamOutputMap<TStreamMode, TSubgraphs, ExtractUpdateType<I, ExtractStateType<I, I>>, ExtractStateType<O, O>, "__start__" | N, NodeReturnType, InferWriterType<WriterType>, TEncoding>>>
```

## Parameters

| Name | Type | Required | Description |
|------|------|----------|-------------|
| `input` | `ExtractUpdateType<I, ExtractStateType<I, I>> \| CommandInstance<InferInterruptResumeType<InterruptType, false>, { [K in string \| number \| symbol]: U[K] }, N> \| null` | Yes | The input to start graph execution with |
| `options` | `Partial<PregelOptions<Record<"__start__" \| N, PregelNode<S, U>>, Record<string \| N, BaseChannel<unknown, unknown, unknown>>, ExtractStateType<C, C> & Record<string, any>, TStreamMode, TSubgraphs, TEncoding>>` | No | Configuration options for streaming |

## Returns

`Promise<IterableReadableStream<StreamOutputMap<TStreamMode, TSubgraphs, ExtractUpdateType<I, ExtractStateType<I, I>>, ExtractStateType<O, O>, "__start__" | N, NodeReturnType, InferWriterType<WriterType>, TEncoding>>>`

An async iterable stream of graph state updates

---

[View source on GitHub](https://github.com/langchain-ai/langgraphjs/blob/b689df0c41d70d758ba72477a96de6afd23789cd/libs/langgraph-core/src/pregel/index.ts#L2213)