pub enum AgentRole {
Exploration,
Planning,
Verification,
Execution,
}Expand description
Role assigned to a TaskAgent that restricts its available tools.
When no role is set an agent receives all tools in its context — equivalent to
Execution. Roles are opt-in so existing callers are unaffected.
Variants§
Exploration
Read-only exploration: file reads, directory listing, search, web fetch.
Safe to run against untrusted or sensitive repositories. Cannot write, execute commands, or spawn additional agents.
Planning
Planning only: task management + read access.
May create and query tasks but cannot modify files or run code. Intended for the planning phase before execution begins.
Verification
Verification: read access and build/test execution.
May read files and run validation tools (build, test, lint). Cannot write
files or modify the repository. Used after Execution to confirm results.
Execution
Full execution: all tools available. Requires explicit grant.
Identical to having no role set. Named explicitly so callers are clear that they are granting unrestricted tool access.
Implementations§
Source§impl AgentRole
impl AgentRole
Sourcepub fn allowed_tools(self) -> Option<&'static [&'static str]>
pub fn allowed_tools(self) -> Option<&'static [&'static str]>
Tool names allowed for this role. None means all tools are permitted.
Sourcepub fn filter_tools(self, tools: &[Tool]) -> Vec<Tool>
pub fn filter_tools(self, tools: &[Tool]) -> Vec<Tool>
Filter a tool slice to only those permitted by this role.
Returns a Vec<Tool> that can be passed directly to the provider. When
the role is Execution the original slice is cloned in full.
Sourcepub fn system_prompt_suffix(self) -> &'static str
pub fn system_prompt_suffix(self) -> &'static str
Short system-prompt suffix that reminds the model of its constraints.
Trait Implementations§
Source§impl<'de> Deserialize<'de> for AgentRole
impl<'de> Deserialize<'de> for AgentRole
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
impl Copy for AgentRole
impl Eq for AgentRole
impl StructuralPartialEq for AgentRole
Auto Trait Implementations§
impl Freeze for AgentRole
impl RefUnwindSafe for AgentRole
impl Send for AgentRole
impl Sync for AgentRole
impl Unpin for AgentRole
impl UnsafeUnpin for AgentRole
impl UnwindSafe for AgentRole
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.