diff --git a/libs/prebuilt/langgraph/prebuilt/tool_node.py b/libs/prebuilt/langgraph/prebuilt/tool_node.py index fe190aa96..6c2d35df7 100644 --- a/libs/prebuilt/langgraph/prebuilt/tool_node.py +++ b/libs/prebuilt/langgraph/prebuilt/tool_node.py @@ -992,6 +992,17 @@ class InjectedState(InjectedToolArg): class InjectedStore(InjectedToolArg): """Annotation for injecting persistent store into tool arguments. + .. deprecated:: 0.2.0 + Use reserved keyword 'runtime' instead of InjectedStore annotation. + The annotation-based approach will be removed in a future version. + + Instead of: + def tool(x: int, store: Annotated[BaseStore, InjectedStore()]) -> str: + + Use: + def tool(x: int, runtime) -> str: + # Access store via runtime.store + This annotation enables tools to access LangGraph's persistent storage system without exposing storage details to the language model. Tools annotated with InjectedStore receive the store instance automatically during execution while @@ -1329,3 +1340,4 @@ def _get_runtime_arg(tool: BaseTool) -> Optional[str]: +