Home / Function/ _make_model_to_model_edge() — langchain Function Reference

_make_model_to_model_edge() — langchain Function Reference

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

Entity Profile

Dependency Diagram

graph TD
  2725013f_5b47_34dc_d7d6_245ddd8cc6ca["_make_model_to_model_edge()"]
  fd7a28b1_3772_169b_6524_1342f35143b1["factory.py"]
  2725013f_5b47_34dc_d7d6_245ddd8cc6ca -->|defined in| fd7a28b1_3772_169b_6524_1342f35143b1
  f4b66c38_651c_807a_caca_41f73fbbe516["create_agent()"]
  f4b66c38_651c_807a_caca_41f73fbbe516 -->|calls| 2725013f_5b47_34dc_d7d6_245ddd8cc6ca
  63280d36_c373_21de_7184_3a4b4f8606bb["_resolve_jump()"]
  2725013f_5b47_34dc_d7d6_245ddd8cc6ca -->|calls| 63280d36_c373_21de_7184_3a4b4f8606bb
  style 2725013f_5b47_34dc_d7d6_245ddd8cc6ca fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

libs/langchain_v1/langchain/agents/factory.py lines 1704–1728

def _make_model_to_model_edge(
    *,
    model_destination: str,
    end_destination: str,
) -> Callable[[dict[str, Any]], str | list[Send] | None]:
    def model_to_model(
        state: dict[str, Any],
    ) -> str | list[Send] | None:
        # 1. Priority: Check for explicit jump_to directive from middleware
        if jump_to := state.get("jump_to"):
            return _resolve_jump(
                jump_to,
                model_destination=model_destination,
                end_destination=end_destination,
            )

        # 2. Exit condition: A structured response was generated
        if "structured_response" in state:
            return end_destination

        # 3. Default: Continue the loop, there may have been an issue with structured
        # output generation, so we need to retry
        return model_destination

    return model_to_model

Domain

Subdomains

Called By

Frequently Asked Questions

What does _make_model_to_model_edge() do?
_make_model_to_model_edge() is a function in the langchain codebase, defined in libs/langchain_v1/langchain/agents/factory.py.
Where is _make_model_to_model_edge() defined?
_make_model_to_model_edge() is defined in libs/langchain_v1/langchain/agents/factory.py at line 1704.
What does _make_model_to_model_edge() call?
_make_model_to_model_edge() calls 1 function(s): _resolve_jump.
What calls _make_model_to_model_edge()?
_make_model_to_model_edge() 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