TypeError: Type is not msgpack serializable: Send occurs when using create_react_agent with a tool that uses BaseStore. #918

Closed
opened 2026-02-20 17:42:22 -05:00 by yindo · 7 comments
Owner

Originally created by @VMinB12 on GitHub (Aug 13, 2025).

Originally assigned to: @sydney-runkle on GitHub.

Checked other resources

  • This is a bug, not a usage question. For questions, please use the LangChain Forum (https://forum.langchain.com/).
  • I added a clear and detailed title that summarizes the issue.
  • I read what a minimal reproducible example is (https://stackoverflow.com/help/minimal-reproducible-example).
  • I included a self-contained, minimal example that demonstrates the issue INCLUDING all the relevant imports. The code run AS IS to reproduce the issue.

Example Code

from typing import Annotated

from langchain_core.tools import tool
from langchain_openai import ChatOpenAI
from langgraph.checkpoint.memory import InMemorySaver
from langgraph.prebuilt import InjectedStore, create_react_agent
from langgraph.store.base import BaseStore
from langgraph.store.memory import InMemoryStore


@tool
def add(
    a,
    b,
    store: Annotated[BaseStore, InjectedStore],
):
    """Add 2 numbers"""
    return str(a + b)


agent = create_react_agent(
    model=ChatOpenAI(model="gpt-4.1-nano"),
    tools=[add],
    checkpointer=InMemorySaver(),
    store=InMemoryStore(),
    # version="v1",
)


for event in agent.stream(
    input={"messages": ["What is 1 + 1?"]},
    config={"configurable": {"thread_id": "abc"}},
):
    print(event)

Error Message and Stack Trace (if applicable)

Traceback (most recent call last):
  File "/Users/vincent.min/Projects/langgraph-fullstack/backend/../dev/serde_send.py", line 30, in <module>
    for event in agent.stream(
                 ~~~~~~~~~~~~^
        input={"messages": ["What is 1 + 1?"]},
        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
        config={"configurable": {"thread_id": "abc"}},
        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    ):
    ^
  File "/Users/vincent.min/Projects/langgraph-fullstack/backend/.venv/lib/python3.13/site-packages/langgraph/pregel/main.py", line 2582, in stream
    with SyncPregelLoop(
         ~~~~~~~~~~~~~~^
        input,
        ^^^^^^
    ...<17 lines>...
        cache_policy=self.cache_policy,
        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    ) as loop:
    ^
  File "/Users/vincent.min/Projects/langgraph-fullstack/backend/.venv/lib/python3.13/site-packages/langgraph/pregel/_loop.py", line 1060, in __exit__
    return self.stack.__exit__(exc_type, exc_value, traceback)
           ~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/vincent.min/.local/share/uv/python/cpython-3.13.2-macos-aarch64-none/lib/python3.13/contextlib.py", line 619, in __exit__
    raise exc
  File "/Users/vincent.min/.local/share/uv/python/cpython-3.13.2-macos-aarch64-none/lib/python3.13/contextlib.py", line 604, in __exit__
    if cb(*exc_details):
       ~~^^^^^^^^^^^^^^
  File "/Users/vincent.min/Projects/langgraph-fullstack/backend/.venv/lib/python3.13/site-packages/langgraph/pregel/_executor.py", line 118, in __exit__
    task.result()
    ~~~~~~~~~~~^^
  File "/Users/vincent.min/.local/share/uv/python/cpython-3.13.2-macos-aarch64-none/lib/python3.13/concurrent/futures/_base.py", line 449, in result
    return self.__get_result()
           ~~~~~~~~~~~~~~~~~^^
  File "/Users/vincent.min/.local/share/uv/python/cpython-3.13.2-macos-aarch64-none/lib/python3.13/concurrent/futures/_base.py", line 401, in __get_result
    raise self._exception
  File "/Users/vincent.min/Projects/langgraph-fullstack/backend/.venv/lib/python3.13/site-packages/langgraph/pregel/_executor.py", line 81, in done
    task.result()
    ~~~~~~~~~~~^^
  File "/Users/vincent.min/.local/share/uv/python/cpython-3.13.2-macos-aarch64-none/lib/python3.13/concurrent/futures/_base.py", line 449, in result
    return self.__get_result()
           ~~~~~~~~~~~~~~~~~^^
  File "/Users/vincent.min/.local/share/uv/python/cpython-3.13.2-macos-aarch64-none/lib/python3.13/concurrent/futures/_base.py", line 401, in __get_result
    raise self._exception
  File "/Users/vincent.min/.local/share/uv/python/cpython-3.13.2-macos-aarch64-none/lib/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/Users/vincent.min/Projects/langgraph-fullstack/backend/.venv/lib/python3.13/site-packages/langgraph/checkpoint/memory/__init__.py", line 403, in put_writes
    self.serde.dumps_typed(v),
    ~~~~~~~~~~~~~~~~~~~~~~^^^
  File "/Users/vincent.min/Projects/langgraph-fullstack/backend/.venv/lib/python3.13/site-packages/langgraph/checkpoint/serde/jsonplus.py", line 222, in dumps_typed
    raise exc
  File "/Users/vincent.min/Projects/langgraph-fullstack/backend/.venv/lib/python3.13/site-packages/langgraph/checkpoint/serde/jsonplus.py", line 216, in dumps_typed
    return "msgpack", _msgpack_enc(obj)
                      ~~~~~~~~~~~~^^^^^
  File "/Users/vincent.min/Projects/langgraph-fullstack/backend/.venv/lib/python3.13/site-packages/langgraph/checkpoint/serde/jsonplus.py", line 676, in _msgpack_enc
    return ormsgpack.packb(data, default=_msgpack_default, option=_option)
           ~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
TypeError: Type is not msgpack serializable: Send

Description

In encountered an issue due to an interplay between the checkpointer, store and Send objects, cause the error TypeError: Type is not msgpack serializable: Send.

The following snippet throws the error:

from typing import Annotated

from langchain_core.tools import tool
from langchain_openai import ChatOpenAI
from langgraph.checkpoint.memory import InMemorySaver
from langgraph.prebuilt import InjectedStore, create_react_agent
from langgraph.store.base import BaseStore
from langgraph.store.memory import InMemoryStore


@tool
def add(
    a,
    b,
    store: Annotated[BaseStore, InjectedStore],
):
    """Add 2 numbers"""
    return str(a + b)


agent = create_react_agent(
    model=ChatOpenAI(model="gpt-4.1-nano"),
    tools=[add],
    checkpointer=InMemorySaver(),
    store=InMemoryStore(),
    # version="v1",
)


for event in agent.stream(
    input={"messages": ["What is 1 + 1?"]},
    config={"configurable": {"thread_id": "abc"}},
):
    print(event)

Interestingly, commenting out store: Annotated[BaseStore, InjectedStore],, or uncommenting # version="v1", results in the issue disappearing.

System Info

System Information
------------------
> OS:  Darwin
> OS Version:  Darwin Kernel Version 24.2.0: Fri Dec  6 18:51:28 PST 2024; root:xnu-11215.61.5~2/RELEASE_ARM64_T8112
> Python Version:  3.13.2 (main, Mar 11 2025, 17:30:09) [Clang 20.1.0 ]

Package Information
-------------------
> langchain_core: 0.3.74
> langsmith: 0.4.14
> langchain_mcp_adapters: 0.1.9
> langchain_openai: 0.3.30
> langgraph_sdk: 0.2.0

Optional packages not installed
-------------------------------
> langserve

Other Dependencies
------------------
> httpx<1,>=0.23.0: Installed. No version info available.
> httpx>=0.25.2: Installed. No version info available.
> jsonpatch<2.0,>=1.33: Installed. No version info available.
> langchain-core<0.4,>=0.3.36: Installed. No version info available.
> langchain-core<1.0.0,>=0.3.74: Installed. No version info available.
> langsmith-pyo3>=0.1.0rc2;: Installed. No version info available.
> langsmith>=0.3.45: Installed. No version info available.
> mcp>=1.9.2: Installed. No version info available.
> openai-agents>=0.0.3;: Installed. No version info available.
> openai<2.0.0,>=1.99.9: Installed. No version info available.
> opentelemetry-api>=1.30.0;: Installed. No version info available.
> opentelemetry-exporter-otlp-proto-http>=1.30.0;: Installed. No version info available.
> opentelemetry-sdk>=1.30.0;: Installed. No version info available.
> orjson>=3.10.1: Installed. No version info available.
> orjson>=3.9.14;: Installed. No version info available.
> packaging>=23.2: Installed. No version info available.
> pydantic<3,>=1: Installed. No version info available.
> pydantic>=2.7.4: Installed. No version info available.
> pytest>=7.0.0;: Installed. No version info available.
> PyYAML>=5.3: Installed. No version info available.
> requests-toolbelt>=1.0.0: Installed. No version info available.
> requests>=2.0.0: Installed. No version info available.
> rich>=13.9.4;: Installed. No version info available.
> tenacity!=8.4.0,<10.0.0,>=8.1.0: Installed. No version info available.
> tiktoken<1,>=0.7: Installed. No version info available.
> typing-extensions>=4.14.0: Installed. No version info available.
> typing-extensions>=4.7: Installed. No version info available.
> vcrpy>=7.0.0;: Installed. No version info available.
> zstandard>=0.23.0: Installed. No version info available.
Originally created by @VMinB12 on GitHub (Aug 13, 2025). Originally assigned to: @sydney-runkle on GitHub. ### Checked other resources - [x] This is a bug, not a usage question. For questions, please use the LangChain Forum (https://forum.langchain.com/). - [x] I added a clear and detailed title that summarizes the issue. - [x] I read what a minimal reproducible example is (https://stackoverflow.com/help/minimal-reproducible-example). - [x] I included a self-contained, minimal example that demonstrates the issue INCLUDING all the relevant imports. The code run AS IS to reproduce the issue. ### Example Code ```python from typing import Annotated from langchain_core.tools import tool from langchain_openai import ChatOpenAI from langgraph.checkpoint.memory import InMemorySaver from langgraph.prebuilt import InjectedStore, create_react_agent from langgraph.store.base import BaseStore from langgraph.store.memory import InMemoryStore @tool def add( a, b, store: Annotated[BaseStore, InjectedStore], ): """Add 2 numbers""" return str(a + b) agent = create_react_agent( model=ChatOpenAI(model="gpt-4.1-nano"), tools=[add], checkpointer=InMemorySaver(), store=InMemoryStore(), # version="v1", ) for event in agent.stream( input={"messages": ["What is 1 + 1?"]}, config={"configurable": {"thread_id": "abc"}}, ): print(event) ``` ### Error Message and Stack Trace (if applicable) ```shell Traceback (most recent call last): File "/Users/vincent.min/Projects/langgraph-fullstack/backend/../dev/serde_send.py", line 30, in <module> for event in agent.stream( ~~~~~~~~~~~~^ input={"messages": ["What is 1 + 1?"]}, ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ config={"configurable": {"thread_id": "abc"}}, ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ): ^ File "/Users/vincent.min/Projects/langgraph-fullstack/backend/.venv/lib/python3.13/site-packages/langgraph/pregel/main.py", line 2582, in stream with SyncPregelLoop( ~~~~~~~~~~~~~~^ input, ^^^^^^ ...<17 lines>... cache_policy=self.cache_policy, ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ) as loop: ^ File "/Users/vincent.min/Projects/langgraph-fullstack/backend/.venv/lib/python3.13/site-packages/langgraph/pregel/_loop.py", line 1060, in __exit__ return self.stack.__exit__(exc_type, exc_value, traceback) ~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/Users/vincent.min/.local/share/uv/python/cpython-3.13.2-macos-aarch64-none/lib/python3.13/contextlib.py", line 619, in __exit__ raise exc File "/Users/vincent.min/.local/share/uv/python/cpython-3.13.2-macos-aarch64-none/lib/python3.13/contextlib.py", line 604, in __exit__ if cb(*exc_details): ~~^^^^^^^^^^^^^^ File "/Users/vincent.min/Projects/langgraph-fullstack/backend/.venv/lib/python3.13/site-packages/langgraph/pregel/_executor.py", line 118, in __exit__ task.result() ~~~~~~~~~~~^^ File "/Users/vincent.min/.local/share/uv/python/cpython-3.13.2-macos-aarch64-none/lib/python3.13/concurrent/futures/_base.py", line 449, in result return self.__get_result() ~~~~~~~~~~~~~~~~~^^ File "/Users/vincent.min/.local/share/uv/python/cpython-3.13.2-macos-aarch64-none/lib/python3.13/concurrent/futures/_base.py", line 401, in __get_result raise self._exception File "/Users/vincent.min/Projects/langgraph-fullstack/backend/.venv/lib/python3.13/site-packages/langgraph/pregel/_executor.py", line 81, in done task.result() ~~~~~~~~~~~^^ File "/Users/vincent.min/.local/share/uv/python/cpython-3.13.2-macos-aarch64-none/lib/python3.13/concurrent/futures/_base.py", line 449, in result return self.__get_result() ~~~~~~~~~~~~~~~~~^^ File "/Users/vincent.min/.local/share/uv/python/cpython-3.13.2-macos-aarch64-none/lib/python3.13/concurrent/futures/_base.py", line 401, in __get_result raise self._exception File "/Users/vincent.min/.local/share/uv/python/cpython-3.13.2-macos-aarch64-none/lib/python3.13/concurrent/futures/thread.py", line 59, in run result = self.fn(*self.args, **self.kwargs) File "/Users/vincent.min/Projects/langgraph-fullstack/backend/.venv/lib/python3.13/site-packages/langgraph/checkpoint/memory/__init__.py", line 403, in put_writes self.serde.dumps_typed(v), ~~~~~~~~~~~~~~~~~~~~~~^^^ File "/Users/vincent.min/Projects/langgraph-fullstack/backend/.venv/lib/python3.13/site-packages/langgraph/checkpoint/serde/jsonplus.py", line 222, in dumps_typed raise exc File "/Users/vincent.min/Projects/langgraph-fullstack/backend/.venv/lib/python3.13/site-packages/langgraph/checkpoint/serde/jsonplus.py", line 216, in dumps_typed return "msgpack", _msgpack_enc(obj) ~~~~~~~~~~~~^^^^^ File "/Users/vincent.min/Projects/langgraph-fullstack/backend/.venv/lib/python3.13/site-packages/langgraph/checkpoint/serde/jsonplus.py", line 676, in _msgpack_enc return ormsgpack.packb(data, default=_msgpack_default, option=_option) ~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ TypeError: Type is not msgpack serializable: Send ``` ### Description In encountered an issue due to an interplay between the checkpointer, store and `Send` objects, cause the error `TypeError: Type is not msgpack serializable: Send`. The following snippet throws the error: ``` from typing import Annotated from langchain_core.tools import tool from langchain_openai import ChatOpenAI from langgraph.checkpoint.memory import InMemorySaver from langgraph.prebuilt import InjectedStore, create_react_agent from langgraph.store.base import BaseStore from langgraph.store.memory import InMemoryStore @tool def add( a, b, store: Annotated[BaseStore, InjectedStore], ): """Add 2 numbers""" return str(a + b) agent = create_react_agent( model=ChatOpenAI(model="gpt-4.1-nano"), tools=[add], checkpointer=InMemorySaver(), store=InMemoryStore(), # version="v1", ) for event in agent.stream( input={"messages": ["What is 1 + 1?"]}, config={"configurable": {"thread_id": "abc"}}, ): print(event) ``` Interestingly, commenting out ` store: Annotated[BaseStore, InjectedStore],`, or uncommenting `# version="v1",` results in the issue disappearing. ### System Info ``` System Information ------------------ > OS: Darwin > OS Version: Darwin Kernel Version 24.2.0: Fri Dec 6 18:51:28 PST 2024; root:xnu-11215.61.5~2/RELEASE_ARM64_T8112 > Python Version: 3.13.2 (main, Mar 11 2025, 17:30:09) [Clang 20.1.0 ] Package Information ------------------- > langchain_core: 0.3.74 > langsmith: 0.4.14 > langchain_mcp_adapters: 0.1.9 > langchain_openai: 0.3.30 > langgraph_sdk: 0.2.0 Optional packages not installed ------------------------------- > langserve Other Dependencies ------------------ > httpx<1,>=0.23.0: Installed. No version info available. > httpx>=0.25.2: Installed. No version info available. > jsonpatch<2.0,>=1.33: Installed. No version info available. > langchain-core<0.4,>=0.3.36: Installed. No version info available. > langchain-core<1.0.0,>=0.3.74: Installed. No version info available. > langsmith-pyo3>=0.1.0rc2;: Installed. No version info available. > langsmith>=0.3.45: Installed. No version info available. > mcp>=1.9.2: Installed. No version info available. > openai-agents>=0.0.3;: Installed. No version info available. > openai<2.0.0,>=1.99.9: Installed. No version info available. > opentelemetry-api>=1.30.0;: Installed. No version info available. > opentelemetry-exporter-otlp-proto-http>=1.30.0;: Installed. No version info available. > opentelemetry-sdk>=1.30.0;: Installed. No version info available. > orjson>=3.10.1: Installed. No version info available. > orjson>=3.9.14;: Installed. No version info available. > packaging>=23.2: Installed. No version info available. > pydantic<3,>=1: Installed. No version info available. > pydantic>=2.7.4: Installed. No version info available. > pytest>=7.0.0;: Installed. No version info available. > PyYAML>=5.3: Installed. No version info available. > requests-toolbelt>=1.0.0: Installed. No version info available. > requests>=2.0.0: Installed. No version info available. > rich>=13.9.4;: Installed. No version info available. > tenacity!=8.4.0,<10.0.0,>=8.1.0: Installed. No version info available. > tiktoken<1,>=0.7: Installed. No version info available. > typing-extensions>=4.14.0: Installed. No version info available. > typing-extensions>=4.7: Installed. No version info available. > vcrpy>=7.0.0;: Installed. No version info available. > zstandard>=0.23.0: Installed. No version info available. ```
yindo added the bug label 2026-02-20 17:42:22 -05:00
yindo closed this issue 2026-02-20 17:42:22 -05:00
Author
Owner

@mostafa-amin-dt commented on GitHub (Aug 21, 2025):

I am getting exactly the same issue too (I prepared another minimal example, but seems redundant after checking the one above).

The insight I have so far is that: the issue occurs when serializing the writes object corresponding to the Send calling the tool. The write object would have arg that looks like {"a": 1, "b": 1, "store": ...}.

Another temporary solution would be using graph.invoke(..., durability="exit"), which skips saving the writes. Not ideal though (seems to be only applicable from >=0.6).

@mostafa-amin-dt commented on GitHub (Aug 21, 2025): I am getting exactly the same issue too (I prepared another minimal example, but seems redundant after checking the one above). The insight I have so far is that: the issue occurs when serializing the `writes` object corresponding to the `Send` calling the tool. The `write` object would have `arg` that looks like `{"a": 1, "b": 1, "store": ...}`. Another temporary solution would be using `graph.invoke(..., durability="exit")`, which skips saving the `writes`. Not ideal though (seems to be only applicable from `>=0.6`).
Author
Owner

@willianantunes commented on GitHub (Sep 4, 2025):

Facing the same issue. This is the value of data:

Send(node='tools', arg=[{'name': 'welcome_message', 'args': {'store': <langgraph.store.postgres.base.PostgresStore object at 0xffff7b405da0>}, 'id': 'call_b10ls4IZgSAv2JfdBi9pz4FP', 'type': 'tool_call'}])
Image
@willianantunes commented on GitHub (Sep 4, 2025): Facing the same issue. This is the value of `data`: ```python Send(node='tools', arg=[{'name': 'welcome_message', 'args': {'store': <langgraph.store.postgres.base.PostgresStore object at 0xffff7b405da0>}, 'id': 'call_b10ls4IZgSAv2JfdBi9pz4FP', 'type': 'tool_call'}]) ``` <img width="1299" height="444" alt="Image" src="https://github.com/user-attachments/assets/03199ad5-2139-4c2c-8b2e-23854ea6e40d" />
Author
Owner

@mostafa-amin-dt commented on GitHub (Sep 5, 2025):

After experimenting in the last days with the newer langgraph (0.6 or higher), it seems that the store is no longer meant to be passed using store: Annotated[BaseStore, InjectedStore], but rather should be retrieved from the Runtime[Context] .

Check the code below, and let me know if this works with you too.

from langchain_core.tools import tool
from langchain_openai import ChatOpenAI
from langgraph.checkpoint.memory import InMemorySaver
from langgraph.prebuilt import create_react_agent
from langgraph.runtime import get_runtime
from langgraph.store.memory import InMemoryStore


@tool
def add(
    a,
    b,
    # store: Annotated[BaseStore, InjectedStore]  # <-- removed
):
    """Add 2 numbers"""
    runtime = get_runtime()
    store = runtime.store  # <--- store is accessible like this
    return str(a + b)

agent = create_react_agent(
    model=ChatOpenAI(model="gpt-4.1-nano"),
    tools=[add],
    checkpointer=InMemorySaver(),
    store=InMemoryStore(),
    # version="v1",
)


for event in agent.stream(
    input={"messages": ["What is 1 + 1?"]},
    config={"configurable": {"thread_id": "abc"}},
):
    print(event)
@mostafa-amin-dt commented on GitHub (Sep 5, 2025): After experimenting in the last days with the newer langgraph (0.6 or higher), it seems that the `store` is no longer meant to be passed using `store: Annotated[BaseStore, InjectedStore]`, but rather should be retrieved from the `Runtime[Context]` . Check the code below, and let me know if this works with you too. ```python from langchain_core.tools import tool from langchain_openai import ChatOpenAI from langgraph.checkpoint.memory import InMemorySaver from langgraph.prebuilt import create_react_agent from langgraph.runtime import get_runtime from langgraph.store.memory import InMemoryStore @tool def add( a, b, # store: Annotated[BaseStore, InjectedStore] # <-- removed ): """Add 2 numbers""" runtime = get_runtime() store = runtime.store # <--- store is accessible like this return str(a + b) agent = create_react_agent( model=ChatOpenAI(model="gpt-4.1-nano"), tools=[add], checkpointer=InMemorySaver(), store=InMemoryStore(), # version="v1", ) for event in agent.stream( input={"messages": ["What is 1 + 1?"]}, config={"configurable": {"thread_id": "abc"}}, ): print(event) ```
Author
Owner

@willianantunes commented on GitHub (Sep 5, 2025):

@mostafa-amin-dt, the documentation about get_runtime does not recommend the approach you suggested. It says to read the memory guide instead. If you look at the InjectedStore class pydoc, it says its purpose and it seems the right way people are using it. Unless it's stale, we don't know.

Your approach might even work, but it could lead to serious concurrency and other issues.

@willianantunes commented on GitHub (Sep 5, 2025): @mostafa-amin-dt, the [documentation about get_runtime](https://langchain-ai.github.io/langgraph/agents/context/?h=get_runtime#dynamic-cross-conversation-context-store) does not recommend the approach you suggested. It says to read the [memory guide](https://langchain-ai.github.io/langgraph/how-tos/memory/add-memory/) instead. If you look at the [InjectedStore class pydoc](https://github.com/langchain-ai/langgraph/blob/36cf353d1965dcc50996445dbc9155b47b4bdb08/libs/prebuilt/langgraph/prebuilt/tool_node.py#L928), it says its purpose and it seems the right way people are using it. Unless it's stale, we don't know. Your approach might even work, but it could lead to serious concurrency and other issues.
Author
Owner

@mostafa-amin-dt commented on GitHub (Sep 5, 2025):

@willianantunes I agree that the InjectedStore is thus far the main recommended method of injecting the Store.

However, in langgraph 0.6, the Context and the Runtime (a wrapper around the Context) were introduced; and the Runtime is made to contain the Store. So now by default the Runtime object is always there (in a context variable) and will always have the injected store by default anyway, wether accessed or not. Given this, how would the concurrency issues be caused?

Btw, I was wondering/speculating if this is the future direction of using the store, without being properly documented if this is only a new option or if this is intended future use in general (without being properly handled yet, hence the bug above).

EDIT: Here is an example from langgraph of how to use the store from the Runtime as I suggested above.

@mostafa-amin-dt commented on GitHub (Sep 5, 2025): @willianantunes I agree that the `InjectedStore` is thus far the main recommended method of injecting the Store. However, in [langgraph 0.6](https://github.com/langchain-ai/langgraph/releases/tag/0.6.0), the `Context` and the `Runtime` (a wrapper around the `Context`) were introduced; and the `Runtime` is made to contain the Store. So now by default the `Runtime` object is *always there* (in a context variable) and will always have the *injected store by default* anyway, wether accessed or not. Given this, how would the concurrency issues be caused? Btw, I was wondering/speculating if this is the future direction of using the store, without being properly documented if this is only a new option or if this is intended future use in general (without being properly handled yet, hence the bug above). EDIT: [Here is an example](https://langchain-ai.github.io/langgraph/reference/runtime/#langgraph.runtime.Runtime) from langgraph of how to use the `store` from the `Runtime` as I suggested above.
Author
Owner

@sydney-runkle commented on GitHub (Sep 10, 2025):

Thanks for bringing this to our attention!

I'd definitely recommend using runtime as opposed to the annotated injected args. We're attempting to migrate to runtime as the source of all static run-scoped information long term to improve devx.

This (I think) is caused by the way that we proactively inject tool args via Send under the hood of create react agent. Even given the new recommendation to use Runtime, we should still fix this!

I've assigned myself as the owner here 👍

@sydney-runkle commented on GitHub (Sep 10, 2025): Thanks for bringing this to our attention! I'd definitely recommend using runtime as opposed to the annotated injected args. We're attempting to migrate to runtime as the source of all static run-scoped information long term to improve devx. This (I think) is caused by the way that we proactively inject tool args via `Send` under the hood of create react agent. Even given the new recommendation to use `Runtime`, we should still fix this! I've assigned myself as the owner here 👍
Author
Owner

@sydney-runkle commented on GitHub (Oct 7, 2025):

We're moving create_react_agent over to langchain as create_agent. This is fixed there via https://github.com/langchain-ai/langchain/pull/33344 :) and will be released in ~2 weeks.

Should be available in an alpha release tomorrow.

@sydney-runkle commented on GitHub (Oct 7, 2025): We're moving `create_react_agent` over to `langchain` as `create_agent`. This is fixed there via https://github.com/langchain-ai/langchain/pull/33344 :) and will be released in ~2 weeks. Should be available in an alpha release tomorrow.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: langchain-ai/langgraph#918