pub struct SubagentBuilder { /* private fields */ }Available on crate feature
subagent only.Expand description
Builder for creating SubagentDefinition instances with a fluent API.
§Example
use echo_agent::agent::subagent::SubagentBuilder;
let def = SubagentBuilder::new("researcher")
.description("Researches topics thoroughly")
.fork_mode()
.model("qwen3")
.system_prompt("You are a research specialist...")
.tools(vec!["search", "read_file"])
.inherit_history(10)
.timeout(120)
.tag("research")
.can_delegate()
.build();
assert_eq!(def.name, "researcher");Implementations§
Source§impl SubagentBuilder
impl SubagentBuilder
Sourcepub fn description(self, desc: impl Into<String>) -> Self
pub fn description(self, desc: impl Into<String>) -> Self
Set a human-readable description (shown to the LLM in tool descriptions).
Sourcepub fn kind(self, kind: SubagentKind) -> Self
pub fn kind(self, kind: SubagentKind) -> Self
Set the agent source kind.
Sourcepub fn fork_mode(self) -> Self
pub fn fork_mode(self) -> Self
Set execution mode to Fork (inherits context, runs independently).
Sourcepub fn teammate_mode(self) -> Self
pub fn teammate_mode(self) -> Self
Set execution mode to Teammate (parallel, mailbox-based).
Sourcepub fn system_prompt(self, prompt: impl Into<String>) -> Self
pub fn system_prompt(self, prompt: impl Into<String>) -> Self
Override the system prompt.
Sourcepub fn max_iterations(self, max: usize) -> Self
pub fn max_iterations(self, max: usize) -> Self
Set max iterations.
Sourcepub fn token_limit(self, limit: usize) -> Self
pub fn token_limit(self, limit: usize) -> Self
Set token limit.
Sourcepub fn inherit_history(self, count: usize) -> Self
pub fn inherit_history(self, count: usize) -> Self
Set number of recent messages to inherit from parent (Fork mode).
Sourcepub fn inherit_memory(self) -> Self
pub fn inherit_memory(self) -> Self
Enable memory inheritance.
Sourcepub fn can_delegate(self) -> Self
pub fn can_delegate(self) -> Self
Allow this subagent to delegate to further subagents.
Add multiple tags.
Sourcepub fn build(self) -> SubagentDefinition
pub fn build(self) -> SubagentDefinition
Build the definition.
Auto Trait Implementations§
impl Freeze for SubagentBuilder
impl RefUnwindSafe for SubagentBuilder
impl Send for SubagentBuilder
impl Sync for SubagentBuilder
impl Unpin for SubagentBuilder
impl UnsafeUnpin for SubagentBuilder
impl UnwindSafe for SubagentBuilder
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
Source§impl<T> FutureExt for T
impl<T> FutureExt for T
Source§fn with_context(self, otel_cx: Context) -> WithContext<Self>
fn with_context(self, otel_cx: Context) -> WithContext<Self>
Source§fn with_current_context(self) -> WithContext<Self>
fn with_current_context(self) -> WithContext<Self>
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§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 moreSource§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
Source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
Wrap the input message
T in a tonic::Request