pub struct Subagent {
pub name: String,
pub description: String,
pub instructions: String,
pub allowed_tools: Vec<String>,
pub max_turns: Option<u32>,
pub model: Option<String>,
}Expand description
A subagent - a specialized Claude instance with specific capabilities
§Example
use claude_agent_sdk::subagents::Subagent;
let subagent = Subagent {
name: "code-reviewer".to_string(),
description: "Expert code reviewer".to_string(),
instructions: "Review code for bugs and best practices".to_string(),
allowed_tools: vec!["Read".to_string(), "Grep".to_string()],
max_turns: Some(5),
model: Some("claude-sonnet-4".to_string()),
};Fields§
§name: StringUnique name for this subagent
description: StringDescription of the subagent’s purpose
instructions: StringSpecific instructions for the subagent
allowed_tools: Vec<String>Tools that this subagent is allowed to use
max_turns: Option<u32>Maximum number of turns (None = no limit)
model: Option<String>Model to use (None = use default)
Trait Implementations§
Source§impl<'de> Deserialize<'de> for Subagent
impl<'de> Deserialize<'de> for Subagent
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>,
Deserialize this value from the given Serde deserializer. Read more
Auto Trait Implementations§
impl Freeze for Subagent
impl RefUnwindSafe for Subagent
impl Send for Subagent
impl Sync for Subagent
impl Unpin for Subagent
impl UnwindSafe for Subagent
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