pub trait Planner: Send + Sync {
// Required methods
fn build_planning_instruction(
&self,
request: &LlmRequest,
) -> Result<Option<String>, PlannerError>;
fn process_planning_response(
&self,
response_text: &str,
) -> Result<Option<String>, PlannerError>;
}Expand description
Trait for agent planners that guide reasoning and action.
A planner modifies the agent’s LLM request to inject planning instructions and post-processes the LLM response to extract/filter planning steps.
Required Methods§
Sourcefn build_planning_instruction(
&self,
request: &LlmRequest,
) -> Result<Option<String>, PlannerError>
fn build_planning_instruction( &self, request: &LlmRequest, ) -> Result<Option<String>, PlannerError>
Build planning instructions to inject into the LLM request.
Returns Some(instruction) to append to the system instruction,
or None to skip planning for this request.
Sourcefn process_planning_response(
&self,
response_text: &str,
) -> Result<Option<String>, PlannerError>
fn process_planning_response( &self, response_text: &str, ) -> Result<Option<String>, PlannerError>
Process the LLM response from a planning-augmented request.
Can filter, reorder, or annotate response parts.
Returns None to use the response as-is.