@langchain/langgraph-sdk
1.17.0 · 17 Nov 2026MIT5.6M / weekRepositoryHomepagenpmAtom feed
1.17.0 is the newest release of 1.x.
In short
3 breaking24 new2 faster11 fixed
- Breaking
StreamOrchestrator(@langchain/langgraph-sdk/ui) now keeps a run going when its tab closes, and picks it up again: - Breaking
Runs are created with
streamResumableandonDisconnect: "continue", and each thread load joins the thread's running run from the loaded checkpoint. - BreakingTo check
stop()stops the stream at once and cancels the run on the server, also a run it picked up after a load. A run whose id hasn't arrived yet is cancelled once it does. A run the app joins withjoinStream()keeps going, andstop({ cancel: false })anddispose()leave any run going.
Release note
Minor Changes
New in
StreamOrchestrator(@langchain/langgraph-sdk/ui): subagent panels that stream only while they are open.scopes.acquire(namespace)holds the scope of a subgraph, such as a subagent's panel, and returns{ getSnapshot, subscribe, release }. A snapshot has the subgraph's messages, asBaseMessageinstances, and its latest values. All held scopes of a run share one join of it from its start, which the server filters to their namespaces when it can. A subagent no run is streaming is read once from the thread's history.scopedSubagents: truestreams each subagent only to its scopes and keeps its messages out of the main conversation, asfilterSubagentMessagesdoes. Runs then stream subgraphs, queued ones too, and on a server with thestream_namespacesandstream_lifecycleflags in/info, a run's own stream carries only the main conversation and the subagents' lifecycle events. A joined run does the same when it was created that way. It's off by default, sincesubagentsthen has a subagent's status and result but not its messages on such a server: they come from its scope.resolveSubagentNamespace(toolCallId)finds a subagent's namespace after a reload, from its tool message or one small page of the thread's history.Panel joins wait while four of the page's engine streams are open, so
stop()andrespond()keep a free connection on servers that speak only HTTP/1.1, such aslanggraph dev.
StreamOrchestrator(@langchain/langgraph-sdk/ui) reads subagent and tool events:With
filterSubagentMessages, runs ask the server forlifecycleevents, and withonToolEvent, fortoolsevents, when the server sends them on run streams. It reads/infoonce per client to know.onToolEventfires now: runs never asked fortoolsbefore. A server that refuses them with a 422, such as an older one during a rollout, gets the run again without them.Each subagent is tied to the tool call that started it, from its
lifecycleevents or from the tool call id deepagents puts on a subagent's tokens, so subagents with the same task text no longer swap. A subagent whose graph fails shows the error at once. Subagents still open when the server says their run failed or was cancelled, or whenstop()cancels it, end with an error. A run paused at an interrupt, a dropped connection orstop({ cancel: false })leaves them open.onChannelEvent(listener)hands every event of its streams to the listener in@langchain/react1.x's channel shape,{ method, params: { namespace, timestamp, data } }.CustomStreamOrchestratorhas it too.
In
StreamOrchestratorand theuseStreamhook from@langchain/langgraph-sdk/react, when the server restarts a run (a worker stops, or a deploy outlasts the run), the main conversation drops what the cut attempt half-streamed and keeps what its finished steps wrote, instead of showing both. A subagent card that only the cut attempt's message started goes too.Add
client.info(), which reads the server's version and the features it supports (flags) fromGET /info.client.runs.stream()andclient.runs.joinStream()take per-call reconnect options:maxReconnectAttempts(with0, a dropped stream throws instead of reconnecting),reconnectDelayMs,onReconnect(called withattempt,cause,lastEventIdanddelayMs) andonConnected.client.threads.joinStream()also sends its modes as one comma-joinedstream_modes, the only form older servers read. TheRuntype haskwargs.StreamOrchestrator(@langchain/langgraph-sdk/ui) now keeps a run going when its tab closes, and picks it up again:Runs are created with
streamResumableandonDisconnect: "continue", and each thread load joins the thread's running run from the loaded checkpoint.stop()stops the stream at once and cancels the run on the server, also a run it picked up after a load. A run whose id hasn't arrived yet is cancelled once it does. A run the app joins withjoinStream()keeps going, andstop({ cancel: false })anddispose()leave any run going.durableRuns: falsekeeps a run tied to its tab, as before this release.
New options:
onRunEnd({ runId, reason }), with"success","error","interrupt"or"stopped", andmaxReconnectAttempts,reconnectDelayMs,onReconnect,onConnectedandstreamIdleReconnect, passed to every run stream and join. New methods:hydrate(threadId?),hydrationPromiseand a StrictMode-safeactivate().A join of the run being submitted waits for its id, so the run doesn't stream twice, and a server-queued submit waits for that run to exist, so it can't overtake it. Runs it creates send
config.configurable.__event_streaming_v2: false, so a thread a v3 client used streams the shape this engine reads, unless they sendcontext, which the Agent Server doesn't take together withconfigurable.StreamOrchestrator(@langchain/langgraph-sdk/ui) now keeps metadata per message id inmessageMetadataStore:parentCheckpointIdis the checkpoint to fork from to edit the message. BetweentrackMessageMetadata()and its release, the engine reads it from the thread's history whenever it is idle with messages it hasn't placed yet: after a load, and after each run back to the checkpoints it already read. It reads what each step wrote, about 1 KB a step, and the whole messages only for messages no step wrote, such as ones added withupdateState. Messages more than about 500 steps back get none.optimisticStatusispendingfor an optimistic message until avaluesevent of its run holds it, thensent. A run that fails or is stopped before that marks itfailed, and one that succeeds or pauses marks itsent. A reload clears it.
Every message a submit sends now carries an id, also with
optimistic: falseand for a run queued on the server.MessageMetadataMapandOptimisticStatusare exported.New in
StreamOrchestrator(@langchain/langgraph-sdk/ui):respond(value, { interruptId? })answers an interrupt, the newest one when no id is given, andrespondAll({ [interruptId]: value })answers several in one run. Both takeupdate,goto,config,metadataandstrictResume. They ask for strict resume unlessstrictResumeisfalse, so an answer to an interrupt that is no longer waiting fails its run instead of running the step again. During a run, the answer waits in the queue instead of interrupting it. An answered interrupt is hidden until its run ends, and shows again if the answer fails. The promise resolves once the run is created or queued.A submit's input shows at once. Input messages without an id get one, so the run's copies replace them. Passing
optimisticValuesshows those instead, andoptimistic: falseturns this off.queue: "local"keeps a submit made during a run on the client and sends it once the run ends, instead of queueing it on the server.Interrupts carry the
namespacethey were raised in.
A submit with
multitaskStrategy: "interrupt"or"rollback"during a run now replaces that run's stream at once, asuseStreamdoes, instead of waiting for it to end. A submit queued behind a run now sends itsstrictResumetoo.StreamOrchestrator(@langchain/langgraph-sdk/ui) now follows its thread betweenactivate()and dispose:A run started elsewhere, such as in another tab or by a cron, is joined and streams here. A run that ended elsewhere reads the thread again, and an interrupt answered elsewhere is hidden at once.
It keeps one connection to the thread's
lifecyclestream, closed while a run streams here, while the queue holds runs and while the page is hidden, and it resumes from the last event it saw. On a server without a thread stream it stays off after one request.watchThread: falseturns it off.
Each thread load also lists the thread's queued runs, so a run queued before a reload shows in the queue again and streams when its turn comes. Since another client may have queued them, a thread switch leaves them on the server, while
cancelQueueItem()andclearQueue()still cancel them. The queue now also moves on when a joined run ends.@langchain/langgraph-sdk/uinow exports:SubgraphDiscovery, with itsSubgraphDiscoverySnapshot,SubgraphMapandSubgraphByNodeMaptypes. Itspush()takes any event with amethod,params.namespaceandparams.data, such as the onesStreamOrchestrator.onChannelEventgives.seedToolCallsFromMessages, which buildsAssembledToolCalls from messages, and theAssembledToolCallandToolCallStatustypes.AssembledToolCallFromTool, andInferAssembledToolCalls, which@langchain/langgraph-sdk/streamexports asInferToolCalls. TheInferToolCallsthat./uialready exports infers message tool calls and is unchanged.
@langchain/langgraph-sdk/streamexports the same names and types as before.
Patch Changes
After a reload,
useStreamnow requests only checkpoints and tasks from/historyto match subagents to their cards. The Python Agent Server 0.17.0 and later then leaves out the thread's values, so on a 20-turn thread the response drops from 55 MB to 298 KB. Subagent cards also no longer show another subagent's messages, or none, when another tool call in the same AIMessage was answered before the subagents started, for example one a human rejected. JS graphs need@langchain/langgraph1.7.2 or later for that case. On older versions, unfinished subagents from that step show no messages after a reload.StreamOrchestrator(@langchain/langgraph-sdk/ui) handles four cases the way@langchain/react1.x apps expect:A thread switch no longer shows the last thread's messages, error or selected branch while the new thread loads.
valuesfalls back toinitialValues, andisThreadLoadingistrueuntil the read lands.A thread id that doesn't exist yet, such as one minted in the browser for a new chat, loads as an empty thread with no error, and the first submit on it creates it with
POST /threadsand that id before its run, so the app'sthreads.createauth handler runs. A submit made while the thread loads waits for the load. A link to a deleted thread shows it empty, and its first submit creates it again. A thread that exists by the time of that create, such as one another tab created, is used as it is when the user's auth can read it, and refused otherwise.A tool call whose tool message has
status: "error"reads as failed, with the message's text aserror, instead of finished. This applies to@langchain/react1.x too: after a reload, and when a tool returns an error message of its own, which thetoolschannel reports as finished.resolveSubagentNamespace(toolCallId)shares one lookup between callers that ask for the same subagent at the same time, so the hooks of one subagent panel read the thread's history once after a reload.
StreamOrchestrator.joinStream(runId)now does nothing whenrunIdis the run it is already streaming (fromsubmit()or an earlier join, including the onereconnectOnMountstarts) or has queued, and returns that stream's promise. Previously the second join waited for the current stream to end and then replayed the whole run, with a second loading phase and another history read. A run whose streamstop()or a thread switch cut off can still be joined again right away.In
StreamOrchestrator(@langchain/langgraph-sdk/ui), a new thread's first message shows as soon as it is submitted, as in@langchain/react1.x. It showed only oncePOST /threadshad created the thread. A new thread's create that fails no longer leaves an unhandled promise rejection, and a submit made meanwhile creates a thread itself instead of rejecting.StreamOrchestrator.submit()withmultitaskStrategy: "reject"while another run is streaming now sends"reject"to the server instead of queuing the run, so the server's rejection reachesonError. Submits with no strategy are still queued.Runs that
StreamOrchestrator.submit()queues while another run is streaming now request the same stream modes as a direct submit. Previously the queued run was created withoutstreamMode, so the server only producedvaluesevents for it: once the queue drained, replies arrived in one piece instead of token by token, andupdates,custom, tool and message-tuple consumers received nothing.Resumable run streams and joins reconnect when the server sends no readable
Locationheader, as with the JS dev server or a CORS config that doesn't expose it. For a resumable run,client.runs.stream()rebuilds the reconnect path from the run'sContent-Location, threadless runs included, or from its thread and run id, andclient.runs.joinStream()reconnects to its own URL. WhenContent-Locationis hidden too,onRunCreatedfires with the run id from the run'smetadataevent. Aborting a stream during the wait before a reconnect now ends it at once, not after the wait.client.runs.stream()andclient.runs.joinStream()called withstreamNamespacesnow drop the events outside those namespaces themselves, by the same rule as the Agent Server. A server that doesn't support the filter (an older version, or the JS dev server) sent every event before, and now gives the same events as one that does.onToolEventno longer gets tool events of kinds other thanon_tool_start,on_tool_event,on_tool_endandon_tool_error, which older queue workers forward for Python graphs.sdk:
useStreamfrom@langchain/langgraph-sdk/reactnow calls theonErrorpassed tosubmit()when that run fails, after the hook's ownonError. It was typed and documented but never called, on both the LangGraph server and the customtransportpaths.
A whole project to check? Paste its package.json in the dependency check: every deprecated, outdated or vulnerable dependency, with what to upgrade to. Free, no account.