pub struct PlanningAgent { /* private fields */ }Expand description
Wraps any Agent to enforce read-only tool access for planning.
Filters tools via prepare_tools to only allow read-only operations.
Sets plan_mode: true in context so tools can check and adapt behavior.
Implementations§
Source§impl PlanningAgent
impl PlanningAgent
pub fn new(inner: Box<dyn Agent>) -> Self
Sourcepub fn with_allowed_tools(self, tools: Vec<String>) -> Self
pub fn with_allowed_tools(self, tools: Vec<String>) -> Self
Override the set of allowed tools (replaces default READ_ONLY_TOOLS).
Sourcepub fn allow_tool(self, name: impl Into<String>) -> Self
pub fn allow_tool(self, name: impl Into<String>) -> Self
Add extra tools to the allowed set (e.g. custom read-only tools).
Trait Implementations§
Source§impl Agent for PlanningAgent
impl Agent for PlanningAgent
Source§fn decide<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
messages: &'life1 [Message],
tools: &'life2 ToolRegistry,
) -> Pin<Box<dyn Future<Output = Result<Decision, AgentError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
fn decide<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
messages: &'life1 [Message],
tools: &'life2 ToolRegistry,
) -> Pin<Box<dyn Future<Output = Result<Decision, AgentError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Given messages and available tools, decide what to do next.
Source§fn prepare_tools(
&self,
_ctx: &AgentContext,
tools: &ToolRegistry,
) -> Vec<String>
fn prepare_tools( &self, _ctx: &AgentContext, tools: &ToolRegistry, ) -> Vec<String>
Hook: filter or reorder tools before each step.
Returns tool names to include. Default: all tools.
Source§fn prepare_context(&self, ctx: &mut AgentContext, messages: &[Message])
fn prepare_context(&self, ctx: &mut AgentContext, messages: &[Message])
Hook: modify context before each step. Default: no-op.
Source§fn after_action(&self, ctx: &mut AgentContext, tool_name: &str, output: &str)
fn after_action(&self, ctx: &mut AgentContext, tool_name: &str, output: &str)
Hook: called after tool execution with the tool name and output.
Can modify context or messages. Default: no-op.
Source§fn decide_stateful<'life0, 'life1, 'life2, 'life3, 'async_trait>(
&'life0 self,
messages: &'life1 [Message],
tools: &'life2 ToolRegistry,
_previous_response_id: Option<&'life3 str>,
) -> Pin<Box<dyn Future<Output = Result<(Decision, Option<String>), AgentError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait,
fn decide_stateful<'life0, 'life1, 'life2, 'life3, 'async_trait>(
&'life0 self,
messages: &'life1 [Message],
tools: &'life2 ToolRegistry,
_previous_response_id: Option<&'life3 str>,
) -> Pin<Box<dyn Future<Output = Result<(Decision, Option<String>), AgentError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait,
Stateful decide — returns response_id for multi-turn chaining. Read more
Auto Trait Implementations§
impl Freeze for PlanningAgent
impl !RefUnwindSafe for PlanningAgent
impl Send for PlanningAgent
impl Sync for PlanningAgent
impl Unpin for PlanningAgent
impl UnsafeUnpin for PlanningAgent
impl !UnwindSafe for PlanningAgent
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more