import { ... } from "@langchain/langgraph-sdk";Overrides the fetch implementation used for LangSmith calls. You should use this if you need to use an implementation of fetch other than the default global (e.g. for dealing with proxies).
Get the API key from the environment. Precedence:
Base stream interface shared by all stream types.
Contains core properties for state management, messaging, and stream control that are common to CompiledStateGraph, ReactAgent, and DeepAgent streams.
This interface provides the foundation that all stream types build upon:
values, isLoading, error)messages)interrupt)submit, stop)branch, history)An interrupt thrown inside a thread.
Stream interface for ReactAgent instances created with createAgent.
Extends UseGraphStream with tool calling capabilities. Tool calls are automatically typed based on the agent's tools configuration.
Use this interface when streaming from an agent created with createAgent.
For subagent streaming capabilities, use UseDeepAgentStream with createDeepAgent.
This interface is subject to change.
Options for configuring an agent stream.
Use this options interface when calling useStream with a ReactAgent
created via createAgent.
This interface is subject to change.
Stream interface for DeepAgent instances created with createDeepAgent.
Extends UseAgentStream with subagent streaming capabilities. Subagent streams are automatically typed based on the agent's subagent configuration, enabling type-safe access to subagent state and messages.
Use this interface when streaming from an agent created with createDeepAgent
that orchestrates multiple specialized subagents.
This interface is subject to change.
Options for configuring a deep agent stream.
Use this options interface when calling useStream with a DeepAgent
created via createDeepAgent. Includes all agent options plus
subagent-specific configuration.
AI message type that can be parameterized with custom tool call types.
Template for the bag type.
Streaming custom data from inside the nodes.
Stream event with detailed debug information.
Stream event with error information.
Stream event with events occurring during execution.
Stream event with a feedback key to signed URL map. Set feedbackKeys in
the RunsStreamPayload to receive this event.
Infer the Bag type from an agent, defaulting to the provided Bag.
Currently returns the provided Bag for all types. Can be extended in the future to extract Bag from agent types.
Infer the node names from a compiled graph.
Extracts the ~NodeType phantom property from CompiledGraph instances,
providing a union of all node names defined in the graph.
Infer the per-node return types from a compiled graph.
Extracts the ~NodeReturnType phantom property from CompiledGraph instances,
which is a mapped type of { [nodeName]: ReturnType } for each node.
Infer the state type from an agent, graph, or direct state type.
Detection order:
~agentTypes) → InferAgentState~RunOutput) → Extract RunOutput~OutputType) → Extract OutputTypeInfer subagent state map from a DeepAgent.
For DeepAgent, creates a map of subagent names to their state types. For non-DeepAgent, returns DefaultSubagentStates.
Infer tool call types from an agent.
For agents, extracts typed tool calls from the agent's tools. For non-agents, returns DefaultToolCall.
Union of all message types.
Stream event with message chunks coming from LLM invocations inside nodes.
Metadata stream event with information about the run and thread
Resolves the appropriate stream interface based on the agent/graph type.
This type automatically selects the correct stream interface based on
the type of agent or graph passed to useStream:
DeepAgent (~deepAgentTypes) → UseDeepAgentStream
ReactAgent (~agentTypes) → UseAgentStream
CompiledGraph (~RunOutput/~OutputType) → UseGraphStream
~NodeType for type-safe accessDefault → UseGraphStream
Resolves the appropriate options interface based on the agent/graph type.
This type automatically selects the correct options interface based on the type of agent or graph:
DeepAgent → UseDeepAgentStreamOptions
filterSubagentMessages optionReactAgent → UseAgentStreamOptions
CompiledGraph / Default → UseGraphStreamOptions
import type { SubgraphCheckpointsStreamEvent } from "./types.stream.subgraph.js";
Stream event with updates to the state after each step. The streamed outputs include the name of the node that produced the update as well as the update.
Stream event with values after completion of each step.
Message stream event specific to LangGraph Server.