#[non_exhaustive]pub struct SubagentConfig {
pub queue: String,
pub default_target: Option<String>,
pub targets: Vec<SubagentTarget>,
pub default_budget: RunBudget,
pub max_budget: RunBudget,
pub max_depth: u32,
pub max_active: usize,
pub notice_chars: usize,
pub max_attempts: u32,
pub reconcile_window: Duration,
}Expand description
How a DurableSubagents host runs sub-agents.
§Example
use std::time::Duration;
use adk_core::RunBudget;
use adk_core::subagent::SubagentTarget;
use adk_server::background::SubagentConfig;
let config = SubagentConfig::default()
.with_queue("background")
.with_target(SubagentTarget::new("researcher", "Reads sources and cites them"))
.with_max_depth(1)
.with_default_budget(RunBudget::new().max_model_calls(10).max_wall_time(Duration::from_secs(600)));
assert_eq!(config.max_active, 4);Fields (Non-exhaustive)§
This struct is marked as non-exhaustive
Struct { .. } syntax; cannot be matched against without a wildcard ..; and struct update syntax will not work.queue: StringThe queue sub-agent runs and parent notices go to; a worker must claim it.
Defaults to default.
default_target: Option<String>The target a start that names none runs; the parent’s own target when None.
targets: Vec<SubagentTarget>The targets a parent may name. Empty allows only the default target, or the parent’s own.
default_budget: RunBudgetThe budget a start that asks for none gets, before it is carved from the parent’s. Defaults to 50 model calls, 200 tool calls and 30 minutes per attempt.
max_budget: RunBudgetThe largest budget a start may ask for: every ask is narrowed by it.
max_depth: u32How deep a chain of sub-agents may go: 1 lets only top-level agents start them. Defaults to 2.
max_active: usizeHow many unfinished sub-agents one parent session may have. Defaults to 4.
notice_chars: usizeThe most characters of a sub-agent’s answer a notice carries. Defaults to 4,000.
max_attempts: u32The attempts each run may take, counting recoveries. Defaults to 3.
reconcile_window: DurationHow far back DurableSubagents::reconcile looks for finished runs whose parent
may not have been told. Defaults to 7 days.
Implementations§
Source§impl SubagentConfig
impl SubagentConfig
Sourcepub fn with_queue(self, queue: impl Into<String>) -> Self
pub fn with_queue(self, queue: impl Into<String>) -> Self
Sets the queue.
Sourcepub fn with_default_target(self, target: impl Into<String>) -> Self
pub fn with_default_target(self, target: impl Into<String>) -> Self
Sets the target a start that names none runs.
Sourcepub fn with_target(self, target: SubagentTarget) -> Self
pub fn with_target(self, target: SubagentTarget) -> Self
Adds a target a parent may name.
Sourcepub fn with_default_budget(self, budget: RunBudget) -> Self
pub fn with_default_budget(self, budget: RunBudget) -> Self
Sets the budget a start that asks for none gets.
Sourcepub fn with_max_budget(self, budget: RunBudget) -> Self
pub fn with_max_budget(self, budget: RunBudget) -> Self
Sets the largest budget a start may ask for.
Sourcepub fn with_max_depth(self, depth: u32) -> Self
pub fn with_max_depth(self, depth: u32) -> Self
Sets how deep a chain of sub-agents may go.
Sourcepub fn with_max_active(self, max: usize) -> Self
pub fn with_max_active(self, max: usize) -> Self
Sets how many unfinished sub-agents one parent session may have.
Sourcepub fn with_notice_chars(self, chars: usize) -> Self
pub fn with_notice_chars(self, chars: usize) -> Self
Sets the most characters of an answer a notice carries.
Trait Implementations§
Source§impl Clone for SubagentConfig
impl Clone for SubagentConfig
Source§impl Debug for SubagentConfig
impl Debug for SubagentConfig
Auto Trait Implementations§
impl Forget for SubagentConfig
impl Freeze for SubagentConfigwhere
*const u8 is !null: Freeze,
PhantomData<u8>: Freeze,
PhantomData<SubagentTarget>: Freeze,
*const LeafNode<UsageUnit, u64> is !null: Freeze,
PhantomData<(Owned, LeafOrInternal)>: Freeze,
PhantomData<Box<(UsageUnit, u64)>>: Freeze,
impl Move for SubagentConfig
impl RefUnwindSafe for SubagentConfig
impl Send for SubagentConfig
impl Sync for SubagentConfig
impl Unpin for SubagentConfig
impl UnsafeUnpin for SubagentConfigwhere
*const u8 is !null: UnsafeUnpin,
PhantomData<u8>: UnsafeUnpin,
PhantomData<SubagentTarget>: UnsafeUnpin,
*const LeafNode<UsageUnit, u64> is !null: UnsafeUnpin,
PhantomData<(Owned, LeafOrInternal)>: UnsafeUnpin,
PhantomData<Box<(UsageUnit, u64)>>: UnsafeUnpin,
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<A, B, T> HttpServerConnExec<A, B> for Twhere
B: Body,
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> ⓘ
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> ⓘ
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