docs(langsmith): event-streaming API page for langgraph-api 0.9.0rc1#4132
Open
Nick Hollon (nick-hollon-lc) wants to merge 3 commits into
Open
docs(langsmith): event-streaming API page for langgraph-api 0.9.0rc1#4132Nick Hollon (nick-hollon-lc) wants to merge 3 commits into
Nick Hollon (nick-hollon-lc) wants to merge 3 commits into
Conversation
- Add Tip at the top of langsmith/streaming.mdx pointing new applications to /langsmith/event-streaming for langgraph-api 0.9.0rc1+; rest of the legacy page untouched. - Add "langsmith/event-streaming" to the Agent deployment → Core capabilities nav group in src/docs.json, immediately before the legacy "langsmith/streaming" entry (mirrors OSS nav ordering). - Add an Event streaming Card to core-capabilities.mdx above the legacy Streaming API Card; reframe the legacy entry as supported alongside. - Fix em-dash spacing in the event-streaming intro and the new Tip (LangChain.DashesSpaces Vale rule).
Validate the Python SDK examples against the v3 streaming code in langchain-ai/langgraph#7884 and the JS SDK examples against langchain-ai/langgraphjs main, and fix the divergences. Python SDK - thread.run.respond uses (response, *, interrupt_id=...) — namespace is derived from the matched interrupt, not a parameter. - thread.subscribe(...) returns an AsyncIterator; iterate it directly instead of opening as an async context manager. JS SDK - client.threads.stream(...) is synchronous and takes either an options object or (threadId, options) — drop spurious await and undefined first arg. - Interrupt resume goes through thread.input.respond({...}); the interrupt object surfaces interruptId in camelCase while the wire param keeps snake_case interrupt_id. - await thread.subscribe([...]) — subscribe returns a Promise. Wire protocol (cURL) - Stream-open POST body is {"channels": [...]} (plus optional namespaces / depth). Replace the fabricated assistant_id/input bodies in every per-projection example. - run.start is a separate command on POST /threads/{id}/commands with a JSON-RPC envelope: {"id": N, "method": "run.start", "params": { "assistant_id": ..., "input": ...}}. - Interrupt resume uses {"id": N, "method": "input.respond", "params": {"namespace": ..., "interrupt_id": ..., "response": ...}} instead of the fabricated command/type shape. Other corrections - Drop thread.audio / images / video / files from the projections table — they don't exist in the SDK. - Note thread.subagents is an alias for thread.subgraphs. - Remove "running" from the lifecycle event list — v3 emits started, completed, failed, interrupted. - Rewrite "Resume from last event": since= is internal to the SDK, and the wire protocol does not use Last-Event-ID for resumption; the server replays buffered events on every new subscription and the SDK dedupes by seq / event_id. Also tweak core-capabilities and streaming intro wording for consistency with the corrected page.
Contributor
|
Thanks for opening a docs PR, Nick Hollon (@nick-hollon-lc)! When it's ready for review, please add the relevant reviewers:
|
Contributor
|
Mintlify preview branch generated: Site preview: https://langchain-5e9cc07a-preview-nhlang-1779401817-6c3eb92.mintlify.app Preview links may take a few minutes to start working while the deployment finishes. Changed documentation pages (preview deep links): |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
New
langsmith/event-streamingpage covering the v3 thread-centric streaming API in the LangGraph SDK (client.threads.stream(...)) forlanggraph-api>=0.9.0rc1, plus the surrounding nav wiring and a Tip on the legacystreamingpage pointing new applications at it.The page (Python, JavaScript, and cURL) was validated against:
nh/sdk-py-v3-streaming-integration-pytest), diffed againstmain— covers the full v3 streaming stack underlibs/sdk-py/langgraph_sdk/_async/,_sync/, andstream/.langchain-ai/langgraphjsmain(libs/sdk/src/client/stream/,libs/sdk/src/client/threads/), plus the canonicalexamples/streaming/src/human-in-the-loop/remote.tsandexamples/streaming/src/basic/remote.tsexamples.libs/sdk-py/langgraph_sdk/stream/transport/http.pyfor the URL shape,build_event_stream_bodyfor the/stream/eventsbody, andsend_commandfor the/commandsJSON-RPC envelope.Notable corrections vs. the initial scaffold
thread.run.respond(response, *, interrupt_id=...)— namespace is derived from the matched interrupt, not a parameter.thread.input.respond({...})(theInputModule), andinterrupt.interruptIdis camelCase on the JS side while the wire param staysinterrupt_id.client.threads.stream(...)in JS is synchronous and takes either(options)or(threadId, options)— dropped spuriousawaitandundefinedfirst arg.thread.subscribe([...])is anAsyncIteratorin Python (iterate, do notasync with) and aPromise<SubscriptionHandle>in JS (must beawait-ed).POST /stream/eventswith{"channels": [...]}opens the SSE subscription, andPOST /commandscarries the JSON-RPCrun.start/input.respondenvelopes.thread.audio/images/video/filesprojections.runningfrom the lifecycle event list — v3 emitsstarted,completed,failed,interrupted.since=is internal to the SDK; reopening the subscription with the samethread_idis the public path.thread.subagentsis an alias forthread.subgraphs.Worth a careful look
Note(langgraph-api>=0.9.0rc1,langgraph>=1.2.0,langgraph-sdk>=0.3.14,@langchain/langgraph-sdk>=1.9.2) — PR 7884 doesn't bump version files, so please confirm against the release notes / package manifests before merging.Resume from last eventrewrite still says reopening replays from the start of the run — confirm against the production buffering policy if there's a TTL.main) was drafted with Claude Code.Test plan
make lint_prose FILES="src/langsmith/event-streaming.mdx"— cleanmake broken-links— no broken linksQuickstartsnippet against alanggraph-api>=0.9.0rc1deploymentQuickstartsnippet against the same deployment