Home / Function/ test_config_and_runtime_not_injected_to_kwargs() — langchain Function Reference

test_config_and_runtime_not_injected_to_kwargs() — langchain Function Reference

Architecture documentation for the test_config_and_runtime_not_injected_to_kwargs() function in test_kwargs_tool_runtime_injection.py from the langchain codebase.

Entity Profile

Dependency Diagram

graph TD
  5291a885_ef93_6bac_50db_c200e286f442["test_config_and_runtime_not_injected_to_kwargs()"]
  82e4d6f1_511f_c784_3db5_46de2562046f["test_kwargs_tool_runtime_injection.py"]
  5291a885_ef93_6bac_50db_c200e286f442 -->|defined in| 82e4d6f1_511f_c784_3db5_46de2562046f
  style 5291a885_ef93_6bac_50db_c200e286f442 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

libs/langchain_v1/tests/unit_tests/agents/test_kwargs_tool_runtime_injection.py lines 23–60

def test_config_and_runtime_not_injected_to_kwargs() -> None:
    """Config/runtime in args_schema are NOT injected when not in function signature."""
    captured: dict[str, Any] = {}

    def tool_func(**kwargs: Any) -> str:
        """Tool with only **kwargs."""
        captured["keys"] = list(kwargs.keys())
        captured["config"] = kwargs.get("config")
        captured["runtime"] = kwargs.get("runtime")
        captured["query"] = kwargs.get("query")
        return f"query={kwargs.get('query')}"

    tool = StructuredTool.from_function(
        func=tool_func,
        name="test_tool",
        description="Test tool",
        args_schema=ArgsSchema.model_json_schema(),
    )

    agent = create_agent(
        model=FakeToolCallingModel(
            tool_calls=[[{"name": "test_tool", "args": {"query": "test"}, "id": "c1"}], []]
        ),
        tools=[tool],
        system_prompt="",
    )

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

    tool_msgs = [m for m in result["messages"] if isinstance(m, ToolMessage)]
    assert len(tool_msgs) == 1
    assert tool_msgs[0].content == "query=test"

    # Only query passed - config/runtime NOT injected since not in function signature
    assert captured["keys"] == ["query"]
    assert captured["query"] == "test"
    assert captured["config"] is None
    assert captured["runtime"] is None

Domain

Subdomains

Frequently Asked Questions

What does test_config_and_runtime_not_injected_to_kwargs() do?
test_config_and_runtime_not_injected_to_kwargs() is a function in the langchain codebase, defined in libs/langchain_v1/tests/unit_tests/agents/test_kwargs_tool_runtime_injection.py.
Where is test_config_and_runtime_not_injected_to_kwargs() defined?
test_config_and_runtime_not_injected_to_kwargs() is defined in libs/langchain_v1/tests/unit_tests/agents/test_kwargs_tool_runtime_injection.py at line 23.

Analyze Your Own Codebase

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

Try Supermodel Free