Home / Function/ aplan() — langchain Function Reference

aplan() — langchain Function Reference

Architecture documentation for the aplan() function in base.py from the langchain codebase.

Entity Profile

Dependency Diagram

graph TD
  6394cebd_874c_adb3_3ef7_6782c24bfdc3["aplan()"]
  282deafd_7db7_2eb5_f124_f5c450b624d7["XMLAgent"]
  6394cebd_874c_adb3_3ef7_6782c24bfdc3 -->|defined in| 282deafd_7db7_2eb5_f124_f5c450b624d7
  style 6394cebd_874c_adb3_3ef7_6782c24bfdc3 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

libs/langchain/langchain_classic/agents/xml/base.py lines 90–112

    async def aplan(
        self,
        intermediate_steps: list[tuple[AgentAction, str]],
        callbacks: Callbacks = None,
        **kwargs: Any,
    ) -> AgentAction | AgentFinish:
        log = ""
        for action, observation in intermediate_steps:
            log += (
                f"<tool>{action.tool}</tool><tool_input>{action.tool_input}"
                f"</tool_input><observation>{observation}</observation>"
            )
        tools = ""
        for tool in self.tools:
            tools += f"{tool.name}: {tool.description}\n"
        inputs = {
            "intermediate_steps": log,
            "tools": tools,
            "question": kwargs["input"],
            "stop": ["</tool_input>", "</final_answer>"],
        }
        response = await self.llm_chain.acall(inputs, callbacks=callbacks)
        return response[self.llm_chain.output_key]

Subdomains

Frequently Asked Questions

What does aplan() do?
aplan() is a function in the langchain codebase, defined in libs/langchain/langchain_classic/agents/xml/base.py.
Where is aplan() defined?
aplan() is defined in libs/langchain/langchain_classic/agents/xml/base.py at line 90.

Analyze Your Own Codebase

Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.

Try Supermodel Free