Home / Function/ plan() — langchain Function Reference

plan() — langchain Function Reference

Architecture documentation for the plan() function in agent.py from the langchain codebase.

Entity Profile

Dependency Diagram

graph TD
  da414754_46c8_b43f_35f5_b0bbed5b0c7e["plan()"]
  0d209def_9564_c52d_db1c_fc156804d62d["LLMSingleActionAgent"]
  da414754_46c8_b43f_35f5_b0bbed5b0c7e -->|defined in| 0d209def_9564_c52d_db1c_fc156804d62d
  fee0e58f_9dfb_24a8_7d9e_adaef341cc83["parse()"]
  da414754_46c8_b43f_35f5_b0bbed5b0c7e -->|calls| fee0e58f_9dfb_24a8_7d9e_adaef341cc83
  ff3ae374_f735_73ee_26e0_538ba433911c["plan()"]
  da414754_46c8_b43f_35f5_b0bbed5b0c7e -->|calls| ff3ae374_f735_73ee_26e0_538ba433911c
  style da414754_46c8_b43f_35f5_b0bbed5b0c7e fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

libs/langchain/langchain_classic/agents/agent.py lines 641–664

    def plan(
        self,
        intermediate_steps: list[tuple[AgentAction, str]],
        callbacks: Callbacks = None,
        **kwargs: Any,
    ) -> AgentAction | AgentFinish:
        """Given input, decided what to do.

        Args:
            intermediate_steps: Steps the LLM has taken to date,
                along with the observations.
            callbacks: Callbacks to run.
            **kwargs: User inputs.

        Returns:
            Action specifying what tool to use.
        """
        output = self.llm_chain.run(
            intermediate_steps=intermediate_steps,
            stop=self.stop,
            callbacks=callbacks,
            **kwargs,
        )
        return self.output_parser.parse(output)

Subdomains

Frequently Asked Questions

What does plan() do?
plan() is a function in the langchain codebase, defined in libs/langchain/langchain_classic/agents/agent.py.
Where is plan() defined?
plan() is defined in libs/langchain/langchain_classic/agents/agent.py at line 641.
What does plan() call?
plan() calls 2 function(s): parse, plan.

Analyze Your Own Codebase

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

Try Supermodel Free