test_async_emulates_specified_tool_by_name() — langchain Function Reference
Architecture documentation for the test_async_emulates_specified_tool_by_name() function in test_tool_emulator.py from the langchain codebase.
Entity Profile
Dependency Diagram
graph TD 80990747_28fe_8c53_dc58_e85096274724["test_async_emulates_specified_tool_by_name()"] b8b6edb5_5f70_2c98_97cd_e94de900fbeb["TestLLMToolEmulatorAsync"] 80990747_28fe_8c53_dc58_e85096274724 -->|defined in| b8b6edb5_5f70_2c98_97cd_e94de900fbeb style 80990747_28fe_8c53_dc58_e85096274724 fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
libs/langchain_v1/tests/unit_tests/agents/middleware/implementations/test_tool_emulator.py lines 424–453
async def test_async_emulates_specified_tool_by_name(self) -> None:
"""Test that tools specified by name are emulated in async mode."""
agent_model = FakeModel(
messages=cycle(
[
AIMessage(
content="",
tool_calls=[
{"name": "get_weather", "id": "1", "args": {"location": "Paris"}}
],
),
AIMessage(content="The weather has been retrieved."),
]
)
)
emulator_model = FakeEmulatorModel(responses=["Emulated: 72°F, sunny in Paris"])
emulator = LLMToolEmulator(tools=["get_weather"], model=emulator_model)
agent = create_agent(
model=agent_model,
tools=[get_weather, calculator],
middleware=[emulator],
)
result = await agent.ainvoke({"messages": [HumanMessage("What's the weather in Paris?")]})
# Should complete without raising NotImplementedError
assert isinstance(result["messages"][-1], AIMessage)
Domain
Subdomains
Defined In
Source
Frequently Asked Questions
What does test_async_emulates_specified_tool_by_name() do?
test_async_emulates_specified_tool_by_name() is a function in the langchain codebase, defined in libs/langchain_v1/tests/unit_tests/agents/middleware/implementations/test_tool_emulator.py.
Where is test_async_emulates_specified_tool_by_name() defined?
test_async_emulates_specified_tool_by_name() is defined in libs/langchain_v1/tests/unit_tests/agents/middleware/implementations/test_tool_emulator.py at line 424.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free