# Support passing runtime context in Send API

**URL:** <https://forum.langchain.com/t/support-passing-runtime-context-in-send-api/1735>\
**Category:** LangGraph\
**Tags:** self-hosted, langsmith-studio, intro-to-langgraph, product-feedback, python-help\
**Created:** [October 3, 2025, 12:16pm UTC](https://forum.langchain.com/t/support-passing-runtime-context-in-send-api/1735 "2025-10-03T12:16:49Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![codeonym](https://yyz1.discourse-cdn.com/flex007/user_avatar/forum.langchain.com/codeonym/32/1174_2.png) [@codeonym](https://forum.langchain.com/u/codeonym)\
**Post date:** [October 3, 2025, 12:16pm UTC](https://forum.langchain.com/t/support-passing-runtime-context-in-send-api/1735/1 "2025-10-03T12:16:49Z")

</div>

Currently, the `Send` API in LangGraph allows dynamically routing execution to other nodes or subgraphs by passing updated graph state (`arg`), but it does not support passing or updating the runtime context alongside the state. This limits the ability to modify or extend runtime context dynamically during graph execution.

**Proposed enhancement:**  
Add support for an optional `context` parameter in the `Send` API that allows passing a new or updated runtime context dictionary when routing to the next node(s).  
**Example usage:**

```python
return Send(
    "next_node",
    arg=updated_state, # or: state: updated_state,
    context={"user_id": "new_user_123", "session_id": "abc123"}
)

```

---

<div class="post-metadata">

**Author:** ![sydney-runkle](https://yyz1.discourse-cdn.com/flex007/user_avatar/forum.langchain.com/sydney-runkle/32/114_2.png) [@sydney-runkle](https://forum.langchain.com/u/sydney-runkle)\
**Post date:** [October 3, 2025, 12:28pm UTC](https://forum.langchain.com/t/support-passing-runtime-context-in-send-api/1735/2 "2025-10-03T12:28:04Z")

</div>

Thanks for the request. Hmm, I think `context` is intended to be run scoped. If something is changing during a graph invocation, it belongs in state I’d say!

---

<div class="post-metadata">

**Author:** ![codeonym](https://yyz1.discourse-cdn.com/flex007/user_avatar/forum.langchain.com/codeonym/32/1174_2.png) [@codeonym](https://forum.langchain.com/u/codeonym)\
**Post date:** [October 3, 2025, 1:29pm UTC](https://forum.langchain.com/t/support-passing-runtime-context-in-send-api/1735/3 "2025-10-03T13:29:20Z")

</div>

@sydney-runkle  
Yes, on second thought, I totally agree, my initial deduction was wrong. The context should remain **run-scoped**. At first, I completely overlooked that in a multi-agent system (orchestrator workflow), we’re still operating on a single thread run. Mutating the context in favor of one subgraph (agent) would break the context for all other subgraphs (agents).  
I initially thought we could isolate the contexts of the sub-agents, but that’s exactly what the **state** handles. Anyway, thanks for the clarification!

---

<div class="post-metadata">

**Author:** ![pawel-twardziak](https://yyz1.discourse-cdn.com/flex007/user_avatar/forum.langchain.com/pawel-twardziak/32/960_2.png) [@pawel-twardziak](https://forum.langchain.com/u/pawel-twardziak)\
**Post date:** [October 3, 2025, 4:04pm UTC](https://forum.langchain.com/t/support-passing-runtime-context-in-send-api/1735/4 "2025-10-03T16:04:13Z")

</div>

Hi @codeonym

@sydney-runkle is right.

Keep runtime context run‑scoped and immutable for the duration of a run. If something must change during execution, put it in state and pass it via `Send`/`Command`. This preserves consistency across concurrent subgraphs/agents within the same run.

- **Why not context in `Send`?**
  - In LangGraph, context is designed to be run‑scoped (set at `invoke`/`stream`), while state is the mutable, per‑run data that evolves across nodes. Allowing `Send` to mutate context mid‑run would create cross‑agent inconsistencies in orchestrations where multiple nodes/subgraphs share the same run.

- **What to do instead**
  - Put dynamic values (e.g., `user_id`, `session_id`, per‑agent knobs) into the graph state and forward them to the next node with `Send`.
  - Keep shared, run‑level resources/configuration (e.g., tools, clients, credentials, thread identifiers) in the context passed at the start of the run via `invoke`/`stream` config.

From the conceptual perspective, both of them are `context`:

- [**Static runtime context**](https://langchain-ai.github.io/langgraph/agents/context/#static-runtime-context)
- [**Dynamic runtime context (state)**](https://langchain-ai.github.io/langgraph/agents/context/#dynamic-runtime-context-state)

#### References

Official docs - Context is run‑scoped; state is the mutable, per‑run memory:

- LangGraph Agents: Context - [Redirecting...](https://langchain-ai.github.io/langgraph/agents/context/)
