test_create_agent_jump() — langchain Function Reference
Architecture documentation for the test_create_agent_jump() function in test_framework.py from the langchain codebase.
Entity Profile
Dependency Diagram
graph TD 73aba8b6_4b1b_2ea7_6118_858c2b9c8d70["test_create_agent_jump()"] 8310d669_2524_e019_e333_8473b50a4990["test_framework.py"] 73aba8b6_4b1b_2ea7_6118_858c2b9c8d70 -->|defined in| 8310d669_2524_e019_e333_8473b50a4990 83f90d06_bd5d_f90c_8a51_2e1292bd1cfc["after_model()"] 73aba8b6_4b1b_2ea7_6118_858c2b9c8d70 -->|calls| 83f90d06_bd5d_f90c_8a51_2e1292bd1cfc style 73aba8b6_4b1b_2ea7_6118_858c2b9c8d70 fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
libs/langchain_v1/tests/unit_tests/agents/middleware/core/test_framework.py lines 140–199
def test_create_agent_jump(
snapshot: SnapshotAssertion,
sync_checkpointer: BaseCheckpointSaver[str],
) -> None:
calls = []
class NoopSeven(AgentMiddleware):
def before_model(self, state: AgentState[Any], runtime: Runtime) -> None:
calls.append("NoopSeven.before_model")
def wrap_model_call(
self,
request: ModelRequest,
handler: Callable[[ModelRequest], ModelResponse],
) -> ModelCallResult:
calls.append("NoopSeven.wrap_model_call")
return handler(request)
def after_model(self, state: AgentState[Any], runtime: Runtime) -> None:
calls.append("NoopSeven.after_model")
class NoopEight(AgentMiddleware):
@hook_config(can_jump_to=["end"])
def before_model(self, state: AgentState[Any], runtime: Runtime) -> dict[str, Any]:
calls.append("NoopEight.before_model")
return {"jump_to": "end"}
def wrap_model_call(
self,
request: ModelRequest,
handler: Callable[[ModelRequest], ModelResponse],
) -> ModelCallResult:
calls.append("NoopEight.wrap_model_call")
return handler(request)
def after_model(self, state: AgentState[Any], runtime: Runtime) -> None:
calls.append("NoopEight.after_model")
@tool
def my_tool(value: str) -> str:
"""A great tool."""
calls.append("my_tool")
return value.upper()
agent_one = create_agent(
model=FakeToolCallingModel(
tool_calls=[[ToolCall(id="1", name="my_tool", args={"value": "yo"})]],
),
tools=[my_tool],
system_prompt="You are a helpful assistant.",
middleware=[NoopSeven(), NoopEight()],
checkpointer=sync_checkpointer,
)
if isinstance(sync_checkpointer, InMemorySaver):
assert agent_one.get_graph().draw_mermaid() == snapshot
thread1 = {"configurable": {"thread_id": "1"}}
assert agent_one.invoke({"messages": []}, thread1) == {"messages": []}
assert calls == ["NoopSeven.before_model", "NoopEight.before_model"]
Domain
Subdomains
Calls
Source
Frequently Asked Questions
What does test_create_agent_jump() do?
test_create_agent_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_jump() defined?
test_create_agent_jump() is defined in libs/langchain_v1/tests/unit_tests/agents/middleware/core/test_framework.py at line 140.
What does test_create_agent_jump() call?
test_create_agent_jump() calls 1 function(s): after_model.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free