aplan() — langchain Function Reference
Architecture documentation for the aplan() function in base.py from the langchain codebase.
Entity Profile
Dependency Diagram
graph TD 37bbde8a_7a2d_f623_0793_d10a9ca94fd6["aplan()"] 4079b11a_3240_0a70_5830_e3af3b13b06e["OpenAIMultiFunctionsAgent"] 37bbde8a_7a2d_f623_0793_d10a9ca94fd6 -->|defined in| 4079b11a_3240_0a70_5830_e3af3b13b06e 77654667_c7de_ebc2_15c2_9c00aae7bd56["_parse_ai_message()"] 37bbde8a_7a2d_f623_0793_d10a9ca94fd6 -->|calls| 77654667_c7de_ebc2_15c2_9c00aae7bd56 style 37bbde8a_7a2d_f623_0793_d10a9ca94fd6 fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
libs/langchain/langchain_classic/agents/openai_functions_multi_agent/base.py lines 235–264
async def aplan(
self,
intermediate_steps: list[tuple[AgentAction, str]],
callbacks: Callbacks = None,
**kwargs: Any,
) -> list[AgentAction] | AgentFinish:
"""Async given input, decided what to do.
Args:
intermediate_steps: Steps the LLM has taken to date,
along with observations.
callbacks: Callbacks to use.
**kwargs: User inputs.
Returns:
Action specifying what tool to use.
"""
agent_scratchpad = format_to_openai_function_messages(intermediate_steps)
selected_inputs = {
k: kwargs[k] for k in self.prompt.input_variables if k != "agent_scratchpad"
}
full_inputs = dict(**selected_inputs, agent_scratchpad=agent_scratchpad)
prompt = self.prompt.format_prompt(**full_inputs)
messages = prompt.to_messages()
predicted_message = await self.llm.ainvoke(
messages,
functions=self.functions,
callbacks=callbacks,
)
return _parse_ai_message(predicted_message)
Domain
Subdomains
Calls
Source
Frequently Asked Questions
What does aplan() do?
aplan() is a function in the langchain codebase, defined in libs/langchain/langchain_classic/agents/openai_functions_multi_agent/base.py.
Where is aplan() defined?
aplan() is defined in libs/langchain/langchain_classic/agents/openai_functions_multi_agent/base.py at line 235.
What does aplan() call?
aplan() calls 1 function(s): _parse_ai_message.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free