Home / Function/ test_can_jump_to_integration() — langchain Function Reference

test_can_jump_to_integration() — langchain Function Reference

Architecture documentation for the test_can_jump_to_integration() function in test_decorators.py from the langchain codebase.

Entity Profile

Dependency Diagram

graph TD
  c8afcff3_b937_b007_b93a_eeb95331b549["test_can_jump_to_integration()"]
  85a104a3_11cf_6539_d0c0_ba69a17a41d4["test_decorators.py"]
  c8afcff3_b937_b007_b93a_eeb95331b549 -->|defined in| 85a104a3_11cf_6539_d0c0_ba69a17a41d4
  68028dcd_ea5b_7d3a_0d75_c9ebd1cef92b["before_model()"]
  c8afcff3_b937_b007_b93a_eeb95331b549 -->|calls| 68028dcd_ea5b_7d3a_0d75_c9ebd1cef92b
  style c8afcff3_b937_b007_b93a_eeb95331b549 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

libs/langchain_v1/tests/unit_tests/agents/middleware/core/test_decorators.py lines 247–270

def test_can_jump_to_integration() -> None:
    """Test can_jump_to parameter in a full agent."""
    calls = []

    @before_model(can_jump_to=["end"])
    def early_exit(state: AgentState[Any], *_args: Any, **_kwargs: Any) -> dict[str, Any] | None:
        calls.append("early_exit")
        if state["messages"][0].content == "exit":
            return {"jump_to": "end"}
        return None

    agent = create_agent(model=FakeToolCallingModel(), middleware=[early_exit])
    # Agent is already compiled

    # Test with early exit
    result = agent.invoke({"messages": [HumanMessage("exit")]})
    assert calls == ["early_exit"]
    assert len(result["messages"]) == 1

    # Test without early exit
    calls.clear()
    result = agent.invoke({"messages": [HumanMessage("hello")]})
    assert calls == ["early_exit"]
    assert len(result["messages"]) > 1

Domain

Subdomains

Frequently Asked Questions

What does test_can_jump_to_integration() do?
test_can_jump_to_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_can_jump_to_integration() defined?
test_can_jump_to_integration() is defined in libs/langchain_v1/tests/unit_tests/agents/middleware/core/test_decorators.py at line 247.
What does test_can_jump_to_integration() call?
test_can_jump_to_integration() calls 1 function(s): before_model.

Analyze Your Own Codebase

Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.

Try Supermodel Free