Home / Function/ _load_agent_from_tools() — langchain Function Reference

_load_agent_from_tools() — langchain Function Reference

Architecture documentation for the _load_agent_from_tools() function in loading.py from the langchain codebase.

Entity Profile

Dependency Diagram

graph TD
  a7f404c6_2d6b_85c1_339c_5a71c7f94df7["_load_agent_from_tools()"]
  7f3891e0_2de6_b9ba_e16e_a9b4c825778b["loading.py"]
  a7f404c6_2d6b_85c1_339c_5a71c7f94df7 -->|defined in| 7f3891e0_2de6_b9ba_e16e_a9b4c825778b
  d135c558_d211_f5bf_c272_7dfd2fe8cc5b["load_agent_from_config()"]
  d135c558_d211_f5bf_c272_7dfd2fe8cc5b -->|calls| a7f404c6_2d6b_85c1_339c_5a71c7f94df7
  style a7f404c6_2d6b_85c1_339c_5a71c7f94df7 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

libs/langchain/langchain_classic/agents/loading.py lines 22–35

def _load_agent_from_tools(
    config: dict,
    llm: BaseLanguageModel,
    tools: list[Tool],
    **kwargs: Any,
) -> BaseSingleActionAgent | BaseMultiActionAgent:
    config_type = config.pop("_type")
    if config_type not in AGENT_TO_CLASS:
        msg = f"Loading {config_type} agent not supported"
        raise ValueError(msg)

    agent_cls = AGENT_TO_CLASS[config_type]
    combined_config = {**config, **kwargs}
    return agent_cls.from_llm_and_tools(llm, tools, **combined_config)

Subdomains

Frequently Asked Questions

What does _load_agent_from_tools() do?
_load_agent_from_tools() is a function in the langchain codebase, defined in libs/langchain/langchain_classic/agents/loading.py.
Where is _load_agent_from_tools() defined?
_load_agent_from_tools() is defined in libs/langchain/langchain_classic/agents/loading.py at line 22.
What calls _load_agent_from_tools()?
_load_agent_from_tools() is called by 1 function(s): load_agent_from_config.

Analyze Your Own Codebase

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

Try Supermodel Free