RemoteGraph: cannot use context with stateful runs (missing fix from Python PR #6497) #398

Open
opened 2026-02-15 18:16:26 -05:00 by yindo · 0 comments
Owner

Originally created by @benAttarYuval on GitHub (Jan 25, 2026).

Problem

Python LangGraph fixed RemoteGraph in PR #6497 to allow using context with stateful runs. The JS version lacks this fix.

From the Python PR:

Otherwise, you cannot use context with stateful runs, because the server throws if you provide both configurable and context in a single call (due to ambiguous parameters)

Current JS Behavior (v1.1.2)

RemoteGraph only passes config to client.runs.stream(), not context:

// pregel/remote.js _streamIterator method
for await (const chunk of this.client.runs.stream(
  sanitizedConfig.configurable.thread_id, 
  this.graphId, 
  {
    config: sanitizedConfig,  // Only config, no context parameter
    ...
  }
))

The SDK client already supports context, but RemoteGraph doesn't expose/use it.

Expected Behavior

Port the Python fix:

  1. Pop thread_id from configurable
  2. Pass context parameter to client.runs.stream()
  3. Allow using context with stateful (checkpointed) runs

Use Case

When using RemoteGraph to call sub-agents, we need to propagate user context (userId, tenantId, featureFlags) via context to sub-agent middleware that uses contextSchema. Currently this fails with 400 error when combined with thread_id for checkpointing.

Related

Originally created by @benAttarYuval on GitHub (Jan 25, 2026). ## Problem Python LangGraph fixed RemoteGraph in PR [#6497](https://github.com/langchain-ai/langgraph/pull/6497) to allow using `context` with stateful runs. The JS version lacks this fix. From the Python PR: > Otherwise, you cannot use `context` with stateful runs, because the server throws if you provide both configurable and context in a single call (due to ambiguous parameters) ## Current JS Behavior (v1.1.2) RemoteGraph only passes `config` to `client.runs.stream()`, not `context`: ```javascript // pregel/remote.js _streamIterator method for await (const chunk of this.client.runs.stream( sanitizedConfig.configurable.thread_id, this.graphId, { config: sanitizedConfig, // Only config, no context parameter ... } )) ``` The SDK client already supports `context`, but RemoteGraph doesn't expose/use it. ## Expected Behavior Port the Python fix: 1. Pop `thread_id` from configurable 2. Pass `context` parameter to `client.runs.stream()` 3. Allow using context with stateful (checkpointed) runs ## Use Case When using RemoteGraph to call sub-agents, we need to propagate user context (userId, tenantId, featureFlags) via `context` to sub-agent middleware that uses `contextSchema`. Currently this fails with 400 error when combined with thread_id for checkpointing. ## Related - Python fix: https://github.com/langchain-ai/langgraph/pull/6497 - Original issue: https://github.com/langchain-ai/langgraph/issues/6342 - Context API PR: https://github.com/langchain-ai/langgraph/pull/5243
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: langchain-ai/langgraphjs#398