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
  6f6336fa_b69b_7bc5_3826_a2de86c2f1b9["plan()"]
  37fcc3f3_2798_3648_915c_2bffdd19bff7["Agent"]
  6f6336fa_b69b_7bc5_3826_a2de86c2f1b9 -->|defined in| 37fcc3f3_2798_3648_915c_2bffdd19bff7
  398e54db_7082_c561_dd79_f8ba427c6a37["get_full_inputs()"]
  6f6336fa_b69b_7bc5_3826_a2de86c2f1b9 -->|calls| 398e54db_7082_c561_dd79_f8ba427c6a37
  fee0e58f_9dfb_24a8_7d9e_adaef341cc83["parse()"]
  6f6336fa_b69b_7bc5_3826_a2de86c2f1b9 -->|calls| fee0e58f_9dfb_24a8_7d9e_adaef341cc83
  ff3ae374_f735_73ee_26e0_538ba433911c["plan()"]
  6f6336fa_b69b_7bc5_3826_a2de86c2f1b9 -->|calls| ff3ae374_f735_73ee_26e0_538ba433911c
  style 6f6336fa_b69b_7bc5_3826_a2de86c2f1b9 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

libs/langchain/langchain_classic/agents/agent.py lines 753–772

    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 observations.
            callbacks: Callbacks to run.
            **kwargs: User inputs.

        Returns:
            Action specifying what tool to use.
        """
        full_inputs = self.get_full_inputs(intermediate_steps, **kwargs)
        full_output = self.llm_chain.predict(callbacks=callbacks, **full_inputs)
        return self.output_parser.parse(full_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 753.
What does plan() call?
plan() calls 3 function(s): get_full_inputs, parse, plan.

Analyze Your Own Codebase

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

Try Supermodel Free