_create_function_message() — langchain Function Reference
Architecture documentation for the _create_function_message() function in agents.py from the langchain codebase.
Entity Profile
Dependency Diagram
graph TD 593439c1_f9b5_edba_6209_abdef7d391c0["_create_function_message()"] 81828515_0fcd_6cb4_96b8_62d4fca3e4ff["agents.py"] 593439c1_f9b5_edba_6209_abdef7d391c0 -->|defined in| 81828515_0fcd_6cb4_96b8_62d4fca3e4ff 0d0b2a68_5fb9_b032_2c8a_7cfb43c20f43["_convert_agent_observation_to_messages()"] 0d0b2a68_5fb9_b032_2c8a_7cfb43c20f43 -->|calls| 593439c1_f9b5_edba_6209_abdef7d391c0 style 593439c1_f9b5_edba_6209_abdef7d391c0 fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
libs/core/langchain_core/agents.py lines 234–256
def _create_function_message(
agent_action: AgentAction, observation: Any
) -> FunctionMessage:
"""Convert agent action and observation into a function message.
Args:
agent_action: the tool invocation request from the agent.
observation: the result of the tool invocation.
Returns:
`FunctionMessage` that corresponds to the original tool invocation.
"""
if not isinstance(observation, str):
try:
content = json.dumps(observation, ensure_ascii=False)
except Exception:
content = str(observation)
else:
content = observation
return FunctionMessage(
name=agent_action.tool,
content=content,
)
Domain
Subdomains
Defined In
Called By
Source
Frequently Asked Questions
What does _create_function_message() do?
_create_function_message() is a function in the langchain codebase, defined in libs/core/langchain_core/agents.py.
Where is _create_function_message() defined?
_create_function_message() is defined in libs/core/langchain_core/agents.py at line 234.
What calls _create_function_message()?
_create_function_message() is called by 1 function(s): _convert_agent_observation_to_messages.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free