Home / Function/ test_tool_runtime_config_access() — langchain Function Reference

test_tool_runtime_config_access() — langchain Function Reference

Architecture documentation for the test_tool_runtime_config_access() function in test_injected_runtime_create_agent.py from the langchain codebase.

Entity Profile

Dependency Diagram

graph TD
  1705c504_b1c0_f330_9844_610b99c1ba42["test_tool_runtime_config_access()"]
  a4d83fe9_0a39_5761_b1a5_de54f81974c9["test_injected_runtime_create_agent.py"]
  1705c504_b1c0_f330_9844_610b99c1ba42 -->|defined in| a4d83fe9_0a39_5761_b1a5_de54f81974c9
  style 1705c504_b1c0_f330_9844_610b99c1ba42 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

libs/langchain_v1/tests/unit_tests/agents/test_injected_runtime_create_agent.py lines 246–282

def test_tool_runtime_config_access() -> None:
    """Test tools can access config through ToolRuntime."""
    config_data: dict[str, Any] = {}

    @tool
    def config_tool(x: int, runtime: ToolRuntime) -> str:
        """Tool that accesses config."""
        config_data["config_exists"] = runtime.config is not None
        config_data["has_configurable"] = (
            "configurable" in runtime.config if runtime.config else False
        )
        # Config may have run_id or other fields depending on execution context
        if runtime.config:
            config_data["config_keys"] = list(runtime.config.keys())
        return f"Config accessed for {x}"

    agent = create_agent(
        model=FakeToolCallingModel(
            tool_calls=[
                [{"args": {"x": 5}, "id": "config_call", "name": "config_tool"}],
                [],
            ]
        ),
        tools=[config_tool],
        system_prompt="You are a helpful assistant.",
    )

    result = agent.invoke({"messages": [HumanMessage("Test config")]})

    # Verify config was accessible
    assert config_data["config_exists"] is True
    assert "config_keys" in config_data

    # Verify tool executed
    tool_message = result["messages"][2]
    assert isinstance(tool_message, ToolMessage)
    assert tool_message.content == "Config accessed for 5"

Domain

Subdomains

Frequently Asked Questions

What does test_tool_runtime_config_access() do?
test_tool_runtime_config_access() 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_config_access() defined?
test_tool_runtime_config_access() is defined in libs/langchain_v1/tests/unit_tests/agents/test_injected_runtime_create_agent.py at line 246.

Analyze Your Own Codebase

Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.

Try Supermodel Free