Skip to main content

SubagentConfig

Struct SubagentConfig 

Source
#[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
Non-exhaustive structs could have additional fields added in future. Therefore, non-exhaustive structs cannot be constructed in external crates using the traditional Struct { .. } syntax; cannot be matched against without a wildcard ..; and struct update syntax will not work.
§queue: String

The 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: RunBudget

The 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: RunBudget

The largest budget a start may ask for: every ask is narrowed by it.

§max_depth: u32

How deep a chain of sub-agents may go: 1 lets only top-level agents start them. Defaults to 2.

§max_active: usize

How many unfinished sub-agents one parent session may have. Defaults to 4.

§notice_chars: usize

The most characters of a sub-agent’s answer a notice carries. Defaults to 4,000.

§max_attempts: u32

The attempts each run may take, counting recoveries. Defaults to 3.

§reconcile_window: Duration

How far back DurableSubagents::reconcile looks for finished runs whose parent may not have been told. Defaults to 7 days.

Implementations§

Source§

impl SubagentConfig

Source

pub fn with_queue(self, queue: impl Into<String>) -> Self

Sets the queue.

Source

pub fn with_default_target(self, target: impl Into<String>) -> Self

Sets the target a start that names none runs.

Source

pub fn with_target(self, target: SubagentTarget) -> Self

Adds a target a parent may name.

Source

pub fn with_default_budget(self, budget: RunBudget) -> Self

Sets the budget a start that asks for none gets.

Source

pub fn with_max_budget(self, budget: RunBudget) -> Self

Sets the largest budget a start may ask for.

Source

pub fn with_max_depth(self, depth: u32) -> Self

Sets how deep a chain of sub-agents may go.

Source

pub fn with_max_active(self, max: usize) -> Self

Sets how many unfinished sub-agents one parent session may have.

Source

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

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for SubagentConfig

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for SubagentConfig

Source§

fn default() -> Self

Returns the “default value” for a type. Read more

Auto Trait Implementations§

§

impl Forget for SubagentConfig

§

impl Freeze for SubagentConfig
where *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
where RawVecInner: Send, NodeRef<Owned, UsageUnit, u64, LeafOrInternal>: Send, BoxRaw<(UsageUnit, u64)>: Send,

§

impl Sync for SubagentConfig
where RawVecInner: Sync, NodeRef<Owned, UsageUnit, u64, LeafOrInternal>: Sync, BoxRaw<(UsageUnit, u64)>: Sync,

§

impl Unpin for SubagentConfig
where *const u8 is !null: Unpin, *const LeafNode<UsageUnit, u64> is !null: Unpin, Box<(UsageUnit, u64)>: Unpin,

§

impl UnsafeUnpin for SubagentConfig

§

impl UnwindSafe for SubagentConfig
where RawVecInner: UnwindSafe, BTreeMap<UsageUnit, u64>: UnwindSafe,

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<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> DynClone for T
where T: Clone,

Source§

fn __clone_box(&self, _: Private) -> *mut ()

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> FromRef<T> for T
where T: Clone,

Source§

fn from_ref(input: &T) -> T

Converts to this type from a reference to the input type.
Source§

impl<A, B, T> HttpServerConnExec<A, B> for T
where B: Body,

Source§

impl<T> Instrument for T

Source§

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

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

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

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

Source§

fn and<P, B, E>(self, other: P) -> And<T, P>
where T: Sized + 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
Source§

fn or<P, B, E>(self, other: P) -> Or<T, P>
where T: Sized + 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> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

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

Source§

type Error = !

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

fn try_from(value: U) -> Result<T, !>

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

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

Source§

fn vzip(self) -> V

Source§

impl<T> WithSubscriber for T

Source§

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

fn with_current_subscriber(self) -> WithDispatch<Self> ⓘ

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