_action_agent() — langchain Function Reference
Architecture documentation for the _action_agent() function in agent.py from the langchain codebase.
Entity Profile
Dependency Diagram
graph TD 2798974b_a7a6_b802_2c65_32b1f9fbd14f["_action_agent()"] 493d4ce4_2303_08e0_2337_2bee34fe2662["AgentExecutor"] 2798974b_a7a6_b802_2c65_32b1f9fbd14f -->|defined in| 493d4ce4_2303_08e0_2337_2bee34fe2662 style 2798974b_a7a6_b802_2c65_32b1f9fbd14f fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
libs/langchain/langchain_classic/agents/agent.py lines 1147–1158
def _action_agent(self) -> BaseSingleActionAgent | BaseMultiActionAgent:
"""Type cast self.agent.
If the `agent` attribute is a Runnable, it will be converted one of
RunnableAgentType in the validate_runnable_agent root_validator.
To support instantiating with a Runnable, here we explicitly cast the type
to reflect the changes made in the root_validator.
"""
if isinstance(self.agent, Runnable):
return cast("RunnableAgentType", self.agent)
return self.agent
Domain
Subdomains
Source
Frequently Asked Questions
What does _action_agent() do?
_action_agent() is a function in the langchain codebase, defined in libs/langchain/langchain_classic/agents/agent.py.
Where is _action_agent() defined?
_action_agent() is defined in libs/langchain/langchain_classic/agents/agent.py at line 1147.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free