test_create_agent_async_jump() — langchain Function Reference
Architecture documentation for the test_create_agent_async_jump() function in test_framework.py from the langchain codebase.
Entity Profile
Dependency Diagram
graph TD 586a871a_2e04_1c8c_8f37_b0be5b847bb7["test_create_agent_async_jump()"] 8310d669_2524_e019_e333_8473b50a4990["test_framework.py"] 586a871a_2e04_1c8c_8f37_b0be5b847bb7 -->|defined in| 8310d669_2524_e019_e333_8473b50a4990 ef00a503_751e_81db_e7f3_3574b9b9827e["abefore_model()"] 586a871a_2e04_1c8c_8f37_b0be5b847bb7 -->|calls| ef00a503_751e_81db_e7f3_3574b9b9827e style 586a871a_2e04_1c8c_8f37_b0be5b847bb7 fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
libs/langchain_v1/tests/unit_tests/agents/middleware/core/test_framework.py lines 665–697
async def test_create_agent_async_jump() -> None:
"""Test async invoke with async middleware using jump_to."""
calls = []
class AsyncMiddlewareOne(AgentMiddleware):
async def abefore_model(self, state: AgentState[Any], runtime: Runtime) -> None:
calls.append("AsyncMiddlewareOne.abefore_model")
class AsyncMiddlewareTwo(AgentMiddleware):
@hook_config(can_jump_to=["end"])
async def abefore_model(self, state: AgentState[Any], runtime: Runtime) -> dict[str, Any]:
calls.append("AsyncMiddlewareTwo.abefore_model")
return {"jump_to": "end"}
@tool
def my_tool_jump(value: str) -> str:
"""A great tool."""
calls.append("my_tool_jump")
return value.upper()
agent = create_agent(
model=FakeToolCallingModel(
tool_calls=[[ToolCall(id="1", name="my_tool_jump", args={"value": "yo"})]],
),
tools=[my_tool_jump],
system_prompt="You are a helpful assistant.",
middleware=[AsyncMiddlewareOne(), AsyncMiddlewareTwo()],
)
result = await agent.ainvoke({"messages": []})
assert result == {"messages": []}
assert calls == ["AsyncMiddlewareOne.abefore_model", "AsyncMiddlewareTwo.abefore_model"]
Domain
Subdomains
Calls
Source
Frequently Asked Questions
What does test_create_agent_async_jump() do?
test_create_agent_async_jump() is a function in the langchain codebase, defined in libs/langchain_v1/tests/unit_tests/agents/middleware/core/test_framework.py.
Where is test_create_agent_async_jump() defined?
test_create_agent_async_jump() is defined in libs/langchain_v1/tests/unit_tests/agents/middleware/core/test_framework.py at line 665.
What does test_create_agent_async_jump() call?
test_create_agent_async_jump() calls 1 function(s): abefore_model.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free