feat(middleware): @threadplane/middleware/langgraph — LangGraph.js client-tools middleware#667
Merged
Conversation
…Nx tsc/vitest package Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
This was referenced Jun 16, 2026
blove
added a commit
that referenced
this pull request
Jun 17, 2026
… retry budget (#667 regression) (#677) @langchain/langgraph-sdk 1.9.x (bumped from 1.7.4 in #667) wraps every connect attempt — including the initial run stream — in AsyncCaller's p-retry (default 4 retries, exponential backoff ~15s) before throwing a ConnectionError. A failed stream therefore no longer fails fast: the error alert surfaces ~15-20s late instead of immediately, which broke examples/chat e2e `error-handling` (15s assertion window) and degrades the real UX of a dropped connection. Production keeps the SDK's resilient default. Add a `clientOptions.maxRetries` knob on `provideAgent` / `agent()` (threaded → FetchStreamTransport → createLangGraphClient → SDK `callerOptions`). examples/chat reads a localStorage flag (`THREADPLANE_E2E_MAX_RETRIES`) to opt into fail-fast (0 retries) under test; the e2e sets it via addInitScript so the alert surfaces immediately. - libs/langgraph: LangGraphClientOptions type + clientOptions on AgentOptions / AgentConfig; createLangGraphClient maps maxRetries → callerOptions. - examples/chat: e2eClientOptions() helper (+ unit tests); DemoShell switches to factory-form provideAgent so the flag is read at injection time. - api-docs regenerated for the new public surface. Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
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.
Plan B core (plan · spec). The TypeScript/LangGraph.js twin of the Python
threadplane-middleware.What's in
libs/middleware→ npm@threadplane/middleware, imported as@threadplane/middleware/langgraph(vendor-first subpath). Built with@nx/js:tsc+ tested with@nx/vitest(mirrorslibs/telemetry); excluded from the Angularpublishablelockstep group — independent cadence.clientToolSpecs,clientToolNames,lastMessage,hasClientToolCall,hasServerToolCall,bindClientTools,routeAfterAgent(same semantics incl. the server-vs-client precedence rule and theserverToolNamesparameter).clientToolsChannel()(anAnnotationstate fragment for thetools/client_toolschannels) andclientToolsRouter()(a prebuilt conditional-edge factory).@langchain/core+@langchain/langgraphare peer deps; no runtime deps.Verification
StateGraphwith a scripted fake model through the full loop: bind → client-only tool call → route toEND→ appendToolMessage→ re-invoke → final content. 23 total, all green.nx lint+nx buildgreen; the built package exposes the./langgraphexport with emitted.d.ts.Follow-ups (separate, after merge): the
examples/ag-ui/nodedemo server + live-LLM smoke, and the staged npm publish workflow.🤖 Generated with Claude Code