load_agent() — langchain Function Reference
Architecture documentation for the load_agent() function in loading.py from the langchain codebase.
Entity Profile
Dependency Diagram
graph TD fbe78043_6ca9_accc_3a94_ee89e75c77c5["load_agent()"] 7f3891e0_2de6_b9ba_e16e_a9b4c825778b["loading.py"] fbe78043_6ca9_accc_3a94_ee89e75c77c5 -->|defined in| 7f3891e0_2de6_b9ba_e16e_a9b4c825778b 36f609ad_1082_989b_c5d3_f0de4c508863["_load_agent_from_file()"] fbe78043_6ca9_accc_3a94_ee89e75c77c5 -->|calls| 36f609ad_1082_989b_c5d3_f0de4c508863 style fbe78043_6ca9_accc_3a94_ee89e75c77c5 fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
libs/langchain/langchain_classic/agents/loading.py lines 102–126
def load_agent(
path: str | Path,
**kwargs: Any,
) -> BaseSingleActionAgent | BaseMultiActionAgent:
"""Unified method for loading an agent from LangChainHub or local fs.
Args:
path: Path to the agent file.
kwargs: Additional keyword arguments passed to the agent executor.
Returns:
An agent executor.
Raises:
RuntimeError: If loading from the deprecated github-based
Hub is attempted.
"""
if isinstance(path, str) and path.startswith("lc://"):
msg = (
"Loading from the deprecated github-based Hub is no longer supported. "
"Please use the new LangChain Hub at https://smith.langchain.com/hub "
"instead."
)
raise RuntimeError(msg)
return _load_agent_from_file(path, **kwargs)
Domain
Subdomains
Calls
Source
Frequently Asked Questions
What does load_agent() do?
load_agent() is a function in the langchain codebase, defined in libs/langchain/langchain_classic/agents/loading.py.
Where is load_agent() defined?
load_agent() is defined in libs/langchain/langchain_classic/agents/loading.py at line 102.
What does load_agent() call?
load_agent() calls 1 function(s): _load_agent_from_file.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free