test_decorator_async_only_works_async_path() — langchain Function Reference
Architecture documentation for the test_decorator_async_only_works_async_path() function in test_sync_async_wrappers.py from the langchain codebase.
Entity Profile
Dependency Diagram
graph TD e1f2aedd_7557_be86_1bbb_bd12fcbf5346["test_decorator_async_only_works_async_path()"] dcfb9efa_1e8c_d646_a0b4_9a9d7afddd2c["TestSyncAsyncMiddlewareComposition"] e1f2aedd_7557_be86_1bbb_bd12fcbf5346 -->|defined in| dcfb9efa_1e8c_d646_a0b4_9a9d7afddd2c style e1f2aedd_7557_be86_1bbb_bd12fcbf5346 fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
libs/langchain_v1/tests/unit_tests/agents/middleware/core/test_sync_async_wrappers.py lines 429–460
async def test_decorator_async_only_works_async_path(self) -> None:
"""Decorator-created async-only middleware works on async path."""
call_log = []
@wrap_tool_call
async def my_async_wrapper(
request: ToolCallRequest,
handler: Callable[[ToolCallRequest], Awaitable[ToolMessage | Command[Any]]],
) -> ToolMessage | Command[Any]:
call_log.append("decorator_async")
return await handler(request)
model = FakeToolCallingModel(
tool_calls=[
[ToolCall(name="search", args={"query": "test"}, id="1")],
[],
]
)
agent = create_agent(
model=model,
tools=[search],
middleware=[my_async_wrapper],
checkpointer=InMemorySaver(),
)
result = await agent.ainvoke(
{"messages": [HumanMessage("Search")]},
{"configurable": {"thread_id": "test"}},
)
assert "decorator_async" in call_log
assert len([m for m in result["messages"] if isinstance(m, ToolMessage)]) == 1
Domain
Subdomains
Source
Frequently Asked Questions
What does test_decorator_async_only_works_async_path() do?
test_decorator_async_only_works_async_path() is a function in the langchain codebase, defined in libs/langchain_v1/tests/unit_tests/agents/middleware/core/test_sync_async_wrappers.py.
Where is test_decorator_async_only_works_async_path() defined?
test_decorator_async_only_works_async_path() is defined in libs/langchain_v1/tests/unit_tests/agents/middleware/core/test_sync_async_wrappers.py at line 429.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free