Home / Function/ test_wrap_tool_call_multiple_tools() — langchain Function Reference

test_wrap_tool_call_multiple_tools() — langchain Function Reference

Architecture documentation for the test_wrap_tool_call_multiple_tools() function in test_wrap_tool_call.py from the langchain codebase.

Entity Profile

Dependency Diagram

graph TD
  211d1a94_4b0b_fa51_9bf7_38b7e164cc86["test_wrap_tool_call_multiple_tools()"]
  e783c6bd_e3d7_7d3b_e64d_d062c5c12013["test_wrap_tool_call.py"]
  211d1a94_4b0b_fa51_9bf7_38b7e164cc86 -->|defined in| e783c6bd_e3d7_7d3b_e64d_d062c5c12013
  style 211d1a94_4b0b_fa51_9bf7_38b7e164cc86 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

libs/langchain_v1/tests/unit_tests/agents/middleware/core/test_wrap_tool_call.py lines 420–460

def test_wrap_tool_call_multiple_tools() -> None:
    """Test wrap_tool_call handles multiple tool calls correctly."""
    call_log = []

    @wrap_tool_call
    def log_tool_calls(
        request: ToolCallRequest, handler: Callable[[ToolCallRequest], ToolMessage | Command[Any]]
    ) -> ToolMessage | Command[Any]:
        assert isinstance(request.tool, BaseTool)
        call_log.append(request.tool.name)
        return handler(request)

    model = FakeToolCallingModel(
        tool_calls=[
            [
                ToolCall(name="search", args={"query": "test"}, id="1"),
                ToolCall(name="calculator", args={"expression": "1+1"}, id="2"),
            ],
            [],
        ]
    )

    agent = create_agent(
        model=model,
        tools=[search, calculator],
        middleware=[log_tool_calls],
        checkpointer=InMemorySaver(),
    )

    result = agent.invoke(
        {"messages": [HumanMessage("Use tools")]},
        {"configurable": {"thread_id": "test"}},
    )

    # Both tools should be logged
    assert "search" in call_log
    assert "calculator" in call_log
    assert len(call_log) == 2

    tool_messages = [m for m in result["messages"] if isinstance(m, ToolMessage)]
    assert len(tool_messages) == 2

Domain

Subdomains

Frequently Asked Questions

What does test_wrap_tool_call_multiple_tools() do?
test_wrap_tool_call_multiple_tools() is a function in the langchain codebase, defined in libs/langchain_v1/tests/unit_tests/agents/middleware/core/test_wrap_tool_call.py.
Where is test_wrap_tool_call_multiple_tools() defined?
test_wrap_tool_call_multiple_tools() is defined in libs/langchain_v1/tests/unit_tests/agents/middleware/core/test_wrap_tool_call.py at line 420.

Analyze Your Own Codebase

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

Try Supermodel Free