test_wrap_tool_call_logging() — langchain Function Reference
Architecture documentation for the test_wrap_tool_call_logging() function in test_wrap_tool_call.py from the langchain codebase.
Entity Profile
Dependency Diagram
graph TD a3ca6526_608b_d606_fa35_98332d8894f5["test_wrap_tool_call_logging()"] e783c6bd_e3d7_7d3b_e64d_d062c5c12013["test_wrap_tool_call.py"] a3ca6526_608b_d606_fa35_98332d8894f5 -->|defined in| e783c6bd_e3d7_7d3b_e64d_d062c5c12013 style a3ca6526_608b_d606_fa35_98332d8894f5 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 77–112
def test_wrap_tool_call_logging() -> None:
"""Test logging tool call execution with wrap_tool_call decorator."""
call_log = []
@wrap_tool_call
def logging_middleware(
request: ToolCallRequest, handler: Callable[[ToolCallRequest], ToolMessage | Command[Any]]
) -> ToolMessage | Command[Any]:
assert isinstance(request.tool, BaseTool)
call_log.append(f"before_{request.tool.name}")
response = handler(request)
call_log.append(f"after_{request.tool.name}")
return response
model = FakeToolCallingModel(
tool_calls=[
[ToolCall(name="search", args={"query": "test"}, id="1")],
[],
]
)
agent = create_agent(
model=model,
tools=[search],
middleware=[logging_middleware],
checkpointer=InMemorySaver(),
)
result = agent.invoke(
{"messages": [HumanMessage("Search")]},
{"configurable": {"thread_id": "test"}},
)
assert call_log == ["before_search", "after_search"]
tool_messages = [m for m in result["messages"] if isinstance(m, ToolMessage)]
assert len(tool_messages) == 1
Domain
Subdomains
Source
Frequently Asked Questions
What does test_wrap_tool_call_logging() do?
test_wrap_tool_call_logging() 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_logging() defined?
test_wrap_tool_call_logging() is defined in libs/langchain_v1/tests/unit_tests/agents/middleware/core/test_wrap_tool_call.py at line 77.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free