_convert_agent_action_to_messages() — langchain Function Reference
Architecture documentation for the _convert_agent_action_to_messages() function in agents.py from the langchain codebase.
Entity Profile
Dependency Diagram
graph TD 19fc1ae4_712d_8715_7c11_2966dede9a0b["_convert_agent_action_to_messages()"] 81828515_0fcd_6cb4_96b8_62d4fca3e4ff["agents.py"] 19fc1ae4_712d_8715_7c11_2966dede9a0b -->|defined in| 81828515_0fcd_6cb4_96b8_62d4fca3e4ff 359cd72a_4765_207f_e3a1_6ec23bf7c8e4["messages()"] 359cd72a_4765_207f_e3a1_6ec23bf7c8e4 -->|calls| 19fc1ae4_712d_8715_7c11_2966dede9a0b style 19fc1ae4_712d_8715_7c11_2966dede9a0b fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
libs/core/langchain_core/agents.py lines 191–206
def _convert_agent_action_to_messages(
agent_action: AgentAction,
) -> Sequence[BaseMessage]:
"""Convert an agent action to a message.
This code is used to reconstruct the original AI message from the agent action.
Args:
agent_action: Agent action to convert.
Returns:
`AIMessage` that corresponds to the original tool invocation.
"""
if isinstance(agent_action, AgentActionMessageLog):
return agent_action.message_log
return [AIMessage(content=agent_action.log)]
Domain
Subdomains
Defined In
Called By
Source
Frequently Asked Questions
What does _convert_agent_action_to_messages() do?
_convert_agent_action_to_messages() is a function in the langchain codebase, defined in libs/core/langchain_core/agents.py.
Where is _convert_agent_action_to_messages() defined?
_convert_agent_action_to_messages() is defined in libs/core/langchain_core/agents.py at line 191.
What calls _convert_agent_action_to_messages()?
_convert_agent_action_to_messages() is called by 1 function(s): messages.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free