From 5597b277c5f8ae8fe5d4a6566a2bab85cadea4e0 Mon Sep 17 00:00:00 2001 From: Mason Daugherty Date: Mon, 11 Aug 2025 15:53:33 -0400 Subject: [PATCH] feat(docs): add subsection on Tool Artifacts vs. Injected State (#32468) Clarify the differences between tool artifacts and injected state in LangChain and LangGraph --- docs/docs/concepts/tools.mdx | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/docs/docs/concepts/tools.mdx b/docs/docs/concepts/tools.mdx index a3cf3872cfd..62c6158eee1 100644 --- a/docs/docs/concepts/tools.mdx +++ b/docs/docs/concepts/tools.mdx @@ -171,6 +171,26 @@ Please see the [InjectedState](https://langchain-ai.github.io/langgraph/referenc Please see the [InjectedStore](https://langchain-ai.github.io/langgraph/reference/prebuilt/#langgraph.prebuilt.tool_node.InjectedStore) documentation for more details. +## Tool Artifacts vs. Injected State + +Although similar conceptually, tool artifacts in LangChain and [injected state in LangGraph](https://langchain-ai.github.io/langgraph/reference/agents/#langgraph.prebuilt.tool_node.InjectedState) serve different purposes and operate at different levels of abstraction. + +**Tool Artifacts** + +- **Purpose:** Store and pass data between tool executions within a single chain/workflow +- **Scope:** Limited to tool-to-tool communication +- **Lifecycle:** Tied to individual tool calls and their immediate context +- **Usage:** Temporary storage for intermediate results that tools need to share + +**Injected State (LangGraph)** + +- **Purpose:** Maintain persistent state across the entire graph execution +- **Scope:** Global to the entire graph workflow +- **Lifecycle:** Persists throughout the entire graph execution and can be saved/restored +- **Usage:** Long-term state management, conversation memory, user context, workflow checkpointing + +Tool artifacts are ephemeral data passed between tools, while injected state is persistent workflow-level state that survives across multiple steps, tool calls, and even execution sessions in LangGraph. + ## Best practices When designing tools to be used by models, keep the following in mind: