Skip to content

feat(langgraph): single-source LANGGRAPH_CLIENT_OPTIONS for the SDK retry budget#681

Merged
blove merged 8 commits into
mainfrom
feat/langgraph-shared-client-options
Jun 18, 2026
Merged

feat(langgraph): single-source LANGGRAPH_CLIENT_OPTIONS for the SDK retry budget#681
blove merged 8 commits into
mainfrom
feat/langgraph-shared-client-options

Conversation

@blove

@blove blove commented Jun 18, 2026

Copy link
Copy Markdown
Contributor

What

Adds one app-wide DI token — LANGGRAPH_CLIENT_OPTIONS (LangGraphClientOptions, e.g. { maxRetries }) — that both the agent streaming transport and the LangGraphThreadsAdapter read, so the LangGraph SDK retry budget is configured in one place. Completes the knob started in #677 (which only covered the agent stream path; thread CRUD still hung ~15s on a hard failure).

How

  • client-options.ts — the LANGGRAPH_CLIENT_OPTIONS token + a pure resolveClientOptions(...layers) first-defined-wins helper (internal).
  • agent() resolves precedence: call-site agent({ clientOptions })provideAgent({ clientOptions }) → token → SDK default, and passes the resolved value into the bridge (override-after-spread).
  • LangGraphThreadsAdapter reads the token directly; the LANGGRAPH_CLIENT injected-client bypass is untouched.
  • examples/chat provides the token once at root from its existing e2eClientOptions() and reverts DemoShell to static provideAgent (unwinds the per-agent factory-form workaround from fix(langgraph): surface stream-connect failures fast (configurable retry budget) #677).

Consumers that don't provide the token are byte-for-byte unchanged (SDK default preserved).

Tests

  • resolveClientOptions precedence (4 cases).
  • LangGraphThreadsAdapter threads the token into createLangGraphClient; undefined when absent; LANGGRAPH_CLIENT bypass intact (3 cases).
  • agent-side resolution through the real FetchStreamTransport path (token-only, call-site-wins, AGENT_CONFIG middle layer, none-provided — 4 cases), spying createLangGraphClient.
  • Gates: langgraph lint+test (216 pass), nx build examples-chat-angular (green), examples/chat error-handling e2e (passes — the failed stream still surfaces the alert fast, now via the shared token).

Out of scope

  • The api-docs generator silently omits InjectionToken/const exports (so this token — like its siblings LANGGRAPH_CLIENT/LANGGRAPH_THREADS_CONFIG — is undocumented). Flagged as a separate follow-up; intentionally not bundled here to avoid 5 libraries of doc churn.
  • No SDK-default change; no apiUrl-wiring refactor; no thread-CRUD-abort e2e.

Design spec + plan: docs/superpowers/specs/2026-06-17-langgraph-shared-client-options-design.md, docs/superpowers/plans/2026-06-18-langgraph-shared-client-options.md.

🤖 Generated with Claude Code

blove and others added 7 commits June 17, 2026 22:29
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
…s helper

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
… > provider > token)

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…vert DemoShell to static provideAgent

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
… + override ordering

Adds a describe block in agent.fn.spec.ts that exercises the
FetchStreamTransport / createLangGraphClient path (no MockTransport)
with four precedence cases: token-only, call-site wins, none provided,
and AGENT_CONFIG middle layer. Also extends the LANGGRAPH_CLIENT_OPTIONS
JSDoc to mention the full call-site → provideAgent → token precedence chain.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@vercel

vercel Bot commented Jun 18, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
threadplane Ready Ready Preview, Comment Jun 18, 2026 3:04pm

Request Review

@blove blove enabled auto-merge (squash) June 18, 2026 14:59
@blove blove merged commit cd4db9b into main Jun 18, 2026
49 of 51 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant