Struct SubAgentConfig

Source
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-agent
  • description: 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

Source

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

Source

pub fn with_model(self, model: Arc<dyn LanguageModel>) -> SubAgentConfig

Set the LLM model for this sub-agent

Source

pub fn with_tools(self, tools: Vec<Arc<dyn Tool>>) -> SubAgentConfig

Set the tools for this sub-agent

Source

pub fn with_builtin_tools(self, tools: HashSet<String>) -> SubAgentConfig

Enable specific built-in tools (filesystem, todos, etc.)

Source

pub fn with_prompt_caching(self, enabled: bool) -> SubAgentConfig

Enable prompt caching for this sub-agent

Trait Implementations§

Source§

impl IntoIterator for SubAgentConfig

Source§

type Item = SubAgentConfig

The type of the elements being iterated over.
Source§

type IntoIter = Once<SubAgentConfig>

Which kind of iterator are we turning this into?
Source§

fn into_iter(self) -> <SubAgentConfig as IntoIterator>::IntoIter

Creates an iterator from a value. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

§

impl<T> Instrument for T

§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided [Span], returning an Instrumented wrapper. Read more
§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

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 more
§

impl<Unshared, Shared> IntoShared<Shared> for Unshared
where Shared: FromUnshared<Unshared>,

§

fn into_shared(self) -> Shared

Creates a shared type from an unshared type.
§

impl<T> PolicyExt for T
where T: ?Sized,

§

fn and<P, B, E>(self, other: P) -> And<T, P>
where T: Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns [Action::Follow] only if self and other return Action::Follow. Read more
§

fn or<P, B, E>(self, other: P) -> Or<T, P>
where T: Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns [Action::Follow] if either self or other returns Action::Follow. Read more
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

§

fn vzip(self) -> V

§

impl<T> WithSubscriber for T

§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a [WithDispatch] wrapper. Read more
§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a [WithDispatch] wrapper. Read more
§

impl<T> ErasedDestructor for T
where T: 'static,