pub struct Agent { /* private fields */ }Expand description
Configuration for a custom subagent.
Agents allow you to define specialised assistants with custom prompts,
models, and tool access. They are passed to the Claude CLI via the
--agents flag.
§Example
use clauders::{Agent, Model};
let agent = Agent::new("Reviews code for issues", "You are a code reviewer")
.with_model(Model::Sonnet)
.with_tools(["Read", "Grep"]);Implementations§
Source§impl Agent
impl Agent
Sourcepub fn new(description: impl Into<String>, prompt: impl Into<String>) -> Self
pub fn new(description: impl Into<String>, prompt: impl Into<String>) -> Self
Creates a new agent with the given description and system prompt.
Sourcepub fn description(&self) -> &str
pub fn description(&self) -> &str
The description of this agent.
Sourcepub fn with_model(self, model: impl Into<Model>) -> Self
pub fn with_model(self, model: impl Into<Model>) -> Self
Sets the model for this agent.
Sourcepub fn set_tools(&mut self, tools: impl IntoIterator<Item = impl Into<String>>)
pub fn set_tools(&mut self, tools: impl IntoIterator<Item = impl Into<String>>)
Sets the tools this agent can use.
Sourcepub fn with_tools(
self,
tools: impl IntoIterator<Item = impl Into<String>>,
) -> Self
pub fn with_tools( self, tools: impl IntoIterator<Item = impl Into<String>>, ) -> Self
Sets the tools this agent can use.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Agent
impl RefUnwindSafe for Agent
impl Send for Agent
impl Sync for Agent
impl Unpin for Agent
impl UnsafeUnpin for Agent
impl UnwindSafe for Agent
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