Home / Function/ _get_can_jump_to() — langchain Function Reference

_get_can_jump_to() — langchain Function Reference

Architecture documentation for the _get_can_jump_to() function in factory.py from the langchain codebase.

Entity Profile

Dependency Diagram

graph TD
  13fe0c9b_88b5_8ef8_4de2_a1086d366c27["_get_can_jump_to()"]
  fd7a28b1_3772_169b_6524_1342f35143b1["factory.py"]
  13fe0c9b_88b5_8ef8_4de2_a1086d366c27 -->|defined in| fd7a28b1_3772_169b_6524_1342f35143b1
  f4b66c38_651c_807a_caca_41f73fbbe516["create_agent()"]
  f4b66c38_651c_807a_caca_41f73fbbe516 -->|calls| 13fe0c9b_88b5_8ef8_4de2_a1086d366c27
  style 13fe0c9b_88b5_8ef8_4de2_a1086d366c27 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

libs/langchain_v1/langchain/agents/factory.py lines 436–468

def _get_can_jump_to(middleware: AgentMiddleware[Any, Any], hook_name: str) -> list[JumpTo]:
    """Get the `can_jump_to` list from either sync or async hook methods.

    Args:
        middleware: The middleware instance to inspect.
        hook_name: The name of the hook (`'before_model'` or `'after_model'`).

    Returns:
        List of jump destinations, or empty list if not configured.
    """
    # Get the base class method for comparison
    base_sync_method = getattr(AgentMiddleware, hook_name, None)
    base_async_method = getattr(AgentMiddleware, f"a{hook_name}", None)

    # Try sync method first - only if it's overridden from base class
    sync_method = getattr(middleware.__class__, hook_name, None)
    if (
        sync_method
        and sync_method is not base_sync_method
        and hasattr(sync_method, "__can_jump_to__")
    ):
        return sync_method.__can_jump_to__

    # Try async method - only if it's overridden from base class
    async_method = getattr(middleware.__class__, f"a{hook_name}", None)
    if (
        async_method
        and async_method is not base_async_method
        and hasattr(async_method, "__can_jump_to__")
    ):
        return async_method.__can_jump_to__

    return []

Domain

Subdomains

Called By

Frequently Asked Questions

What does _get_can_jump_to() do?
_get_can_jump_to() is a function in the langchain codebase, defined in libs/langchain_v1/langchain/agents/factory.py.
Where is _get_can_jump_to() defined?
_get_can_jump_to() is defined in libs/langchain_v1/langchain/agents/factory.py at line 436.
What calls _get_can_jump_to()?
_get_can_jump_to() is called by 1 function(s): create_agent.

Analyze Your Own Codebase

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

Try Supermodel Free