Class PlanAndExecuteHandler
Planning handler that implements the Plan-and-Execute strategy.
First generates a complete plan for the task, then executes each step sequentially. Useful for complex multi-step tasks where having an upfront plan improves coherence.
public sealed class PlanAndExecuteHandler : PlanningHandlerBase, IPlanningHandler
- Inheritance
-
PlanAndExecuteHandler
- Implements
- Inherited Members
Remarks
Plan-and-Execute Flow
- Plan: Generate a numbered list of steps to accomplish the task.
- Execute: Work through each step, possibly using tools.
- Synthesize: Combine results into a final answer.
Constructors
- PlanAndExecuteHandler()
Initializes a new instance of the PlanAndExecuteHandler class.
Properties
- ExecutionPrompt
Gets or sets the step execution prompt.
Use {step} for the current step and {context} for previous results.
- Instance
Gets the singleton instance with default settings.
- PlanningPrompt
Gets or sets the planning prompt.
Use {task} as a placeholder for the user's task.
- Strategy
Gets the planning strategy.
- SynthesisPrompt
Gets or sets the synthesis prompt.
Use {task} for the original task and {results} for step results.
Methods
- Initialize(PlanningContext)
Initializes the context for plan-and-execute.
- PrepareInput(PlanningContext, string)
Prepares the input based on the current phase.
- ProcessOutput(PlanningContext, string)
Processes the model output based on the current phase.