pub struct SubAgentConfig {
pub name: String,
pub description: String,
pub instructions: String,
pub model: Option<Arc<dyn LanguageModel>>,
pub tools: Option<Vec<Arc<dyn Tool>>>,
pub builtin_tools: Option<HashSet<String>>,
pub enable_prompt_caching: bool,
}
Expand description
Configuration for creating and registering a subagent using a simple, Python-like shape.
Configuration for a sub-agent - a full AI agent with its own LLM, tools, and memory.
A sub-agent is just like the main agent: it has its own system instructions,
tools, LLM, and can maintain its own conversation history. The main agent
delegates tasks to sub-agents via the task
tool.
§Required Fields:
name
: Unique identifier for this sub-agentdescription
: What this sub-agent specializes in (shown to main agent)instructions
: System prompt for this sub-agent
§Optional Fields:
model
: LLM to use (defaults to parent agent’s model if not specified)tools
: Tools available to this sub-agent (defaults to empty)builtin_tools
: Built-in tools to enable (filesystem, todos, etc.)enable_prompt_caching
: Whether to cache prompts for efficiency
Fields§
§name: String
§description: String
§instructions: String
§model: Option<Arc<dyn LanguageModel>>
§tools: Option<Vec<Arc<dyn Tool>>>
§builtin_tools: Option<HashSet<String>>
§enable_prompt_caching: bool
Implementations§
Source§impl SubAgentConfig
impl SubAgentConfig
Sourcepub fn new(
name: impl Into<String>,
description: impl Into<String>,
instructions: impl Into<String>,
) -> SubAgentConfig
pub fn new( name: impl Into<String>, description: impl Into<String>, instructions: impl Into<String>, ) -> SubAgentConfig
Create a new sub-agent configuration with required fields only
Sourcepub fn with_model(self, model: Arc<dyn LanguageModel>) -> SubAgentConfig
pub fn with_model(self, model: Arc<dyn LanguageModel>) -> SubAgentConfig
Set the LLM model for this sub-agent
Sourcepub fn with_tools(self, tools: Vec<Arc<dyn Tool>>) -> SubAgentConfig
pub fn with_tools(self, tools: Vec<Arc<dyn Tool>>) -> SubAgentConfig
Set the tools for this sub-agent
Sourcepub fn with_builtin_tools(self, tools: HashSet<String>) -> SubAgentConfig
pub fn with_builtin_tools(self, tools: HashSet<String>) -> SubAgentConfig
Enable specific built-in tools (filesystem, todos, etc.)
Sourcepub fn with_prompt_caching(self, enabled: bool) -> SubAgentConfig
pub fn with_prompt_caching(self, enabled: bool) -> SubAgentConfig
Enable prompt caching for this sub-agent
Trait Implementations§
Source§impl IntoIterator for SubAgentConfig
impl IntoIterator for SubAgentConfig
Source§type Item = SubAgentConfig
type Item = SubAgentConfig
The type of the elements being iterated over.
Source§type IntoIter = Once<SubAgentConfig>
type IntoIter = Once<SubAgentConfig>
Which kind of iterator are we turning this into?
Source§fn into_iter(self) -> <SubAgentConfig as IntoIterator>::IntoIter
fn into_iter(self) -> <SubAgentConfig as IntoIterator>::IntoIter
Creates an iterator from a value. Read more
Auto Trait Implementations§
impl Freeze for SubAgentConfig
impl !RefUnwindSafe for SubAgentConfig
impl Send for SubAgentConfig
impl Sync for SubAgentConfig
impl Unpin for SubAgentConfig
impl !UnwindSafe for SubAgentConfig
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
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moreCreates a shared type from an unshared type.