test_tool_runtime_with_store() — langchain Function Reference
Architecture documentation for the test_tool_runtime_with_store() function in test_injected_runtime_create_agent.py from the langchain codebase.
Entity Profile
Dependency Diagram
graph TD 9c25eccb_7873_1816_c5f7_bc0aa9488b83["test_tool_runtime_with_store()"] a4d83fe9_0a39_5761_b1a5_de54f81974c9["test_injected_runtime_create_agent.py"] 9c25eccb_7873_1816_c5f7_bc0aa9488b83 -->|defined in| a4d83fe9_0a39_5761_b1a5_de54f81974c9 style 9c25eccb_7873_1816_c5f7_bc0aa9488b83 fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
libs/langchain_v1/tests/unit_tests/agents/test_injected_runtime_create_agent.py lines 153–196
def test_tool_runtime_with_store() -> None:
"""Test ToolRuntime provides access to store."""
# Note: create_agent doesn't currently expose a store parameter,
# so runtime.store will be None in this test.
# This test demonstrates the runtime injection works correctly.
@tool
def store_tool(key: str, value: str, runtime: ToolRuntime) -> str:
"""Tool that uses store."""
if runtime.store is None:
return f"No store (key={key}, value={value})"
runtime.store.put(("test",), key, {"data": value})
return f"Stored {key}={value}"
@tool
def check_runtime_tool(runtime: ToolRuntime) -> str:
"""Tool that checks runtime availability."""
has_store = runtime.store is not None
has_context = runtime.context is not None
return f"Runtime: store={has_store}, context={has_context}"
agent = create_agent(
model=FakeToolCallingModel(
tool_calls=[
[{"args": {"key": "foo", "value": "bar"}, "id": "call_1", "name": "store_tool"}],
[{"args": {}, "id": "call_2", "name": "check_runtime_tool"}],
[],
]
),
tools=[store_tool, check_runtime_tool],
system_prompt="You are a helpful assistant.",
)
result = agent.invoke({"messages": [HumanMessage("Test store")]})
# Find the tool messages
tool_messages = [msg for msg in result["messages"] if isinstance(msg, ToolMessage)]
assert len(tool_messages) == 2
# First tool indicates no store is available (expected since create_agent doesn't expose store)
assert "No store" in tool_messages[0].content
# Second tool confirms runtime was injected
assert "Runtime:" in tool_messages[1].content
Domain
Subdomains
Source
Frequently Asked Questions
What does test_tool_runtime_with_store() do?
test_tool_runtime_with_store() is a function in the langchain codebase, defined in libs/langchain_v1/tests/unit_tests/agents/test_injected_runtime_create_agent.py.
Where is test_tool_runtime_with_store() defined?
test_tool_runtime_with_store() is defined in libs/langchain_v1/tests/unit_tests/agents/test_injected_runtime_create_agent.py at line 153.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free