test_async_decorators_integration() — langchain Function Reference
Architecture documentation for the test_async_decorators_integration() function in test_decorators.py from the langchain codebase.
Entity Profile
Dependency Diagram
graph TD 3b78c7d3_6f08_cbee_73db_35517ba4b5ab["test_async_decorators_integration()"] 85a104a3_11cf_6539_d0c0_ba69a17a41d4["test_decorators.py"] 3b78c7d3_6f08_cbee_73db_35517ba4b5ab -->|defined in| 85a104a3_11cf_6539_d0c0_ba69a17a41d4 style 3b78c7d3_6f08_cbee_73db_35517ba4b5ab fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
libs/langchain_v1/tests/unit_tests/agents/middleware/core/test_decorators.py lines 352–379
async def test_async_decorators_integration() -> None:
"""Test async decorators working together in an agent."""
call_order = []
@before_model
async def track_async_before(*_args: Any, **_kwargs: Any) -> None:
call_order.append("async_before")
@wrap_model_call
async def track_async_on_call(
request: ModelRequest,
handler: Callable[[ModelRequest], Awaitable[ModelResponse]],
) -> ModelCallResult:
call_order.append("async_on_call")
return await handler(request)
@after_model
async def track_async_after(*_args: Any, **_kwargs: Any) -> None:
call_order.append("async_after")
agent = create_agent(
model=FakeToolCallingModel(),
middleware=[track_async_before, track_async_on_call, track_async_after],
)
# Agent is already compiled
await agent.ainvoke({"messages": [HumanMessage("Hello")]})
assert call_order == ["async_before", "async_on_call", "async_after"]
Domain
Subdomains
Source
Frequently Asked Questions
What does test_async_decorators_integration() do?
test_async_decorators_integration() is a function in the langchain codebase, defined in libs/langchain_v1/tests/unit_tests/agents/middleware/core/test_decorators.py.
Where is test_async_decorators_integration() defined?
test_async_decorators_integration() is defined in libs/langchain_v1/tests/unit_tests/agents/middleware/core/test_decorators.py at line 352.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free