Skip to main content

AgentWorldBuilder

Struct AgentWorldBuilder 

Source
pub struct AgentWorldBuilder { /* private fields */ }
Expand description

Builds an AgentWorld from plain values - no config file, no daemon.

let world = AgentWorld::builder()
    .provider(ProviderCreds::anthropic(api_key))
    .build()?;

Implementations§

Source§

impl AgentWorldBuilder

Source

pub fn provider(self, creds: ProviderCreds) -> Self

Add a provider from credentials (repeatable). See ProviderCreds for the supported providers.

Source

pub fn register_provider( self, name: impl Into<String>, provider: Arc<dyn Provider>, ) -> Self

Register a custom Provider implementation under name (repeatable). Wins over a credentials entry with the same name.

Source

pub fn default_model( self, provider: impl Into<String>, model: impl Into<String>, ) -> Self

The user-default provider/model, the fallback when none of a stage’s listed models has a registered provider.

Source

pub fn fallback_model( self, provider: impl Into<String>, model: impl Into<String>, ) -> Self

Append a host-wide failover target, tried after a stage’s own entries and the default model when the provider in use stops answering.

Call it once per target, best first. This is what keeps a blueprint that names exactly one model running when that provider runs out of credits (issue #201).

Source

pub fn tool_service(self, service: Arc<dyn ToolService>) -> Self

Replace the default BasicToolService with a custom tool service. The embed spawner then skips per-agent tool registration; the custom service sees agents through its own exec_for.

Source

pub fn state_dir(self, dir: impl Into<PathBuf>) -> Self

Persist run state on disk under dir, in the daemon’s layout (<dir>/runs/<run_id>/, machine id at <dir>/machine-id). Without this the world runs entirely in memory and never touches disk.

Source

pub fn inference_pool(self, config: InferencePoolConfig) -> Self

Per-model inference concurrency limits.

Source

pub fn tool_concurrency(self, n: usize) -> Self

How many tool batches may execute concurrently (default 4).

Source

pub fn prompt_hints(self, hints: PromptHints) -> Self

Opt in to the framework-authored system-prompt hints, off by default on this path. shell is worth turning on for a blueprint that grants the shell tool and may run on Windows: it tells the model that commands go through cmd.exe rather than a POSIX shell. A blueprint’s [agent] or [stages.<name>] batch_tool_hint / shell_hint still overrides this.

Source

pub fn runtime(self, handle: Handle) -> Self

Run the world on handle instead of the ambient Tokio runtime.

Source

pub fn build(self) -> Result<AgentWorld, EmbedError>

Assemble the world and start its serve loop on the Tokio runtime.

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<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> ConditionalSend for T
where T: Send,

Source§

impl<T> Downcast for T
where T: Any,

Source§

fn into_any(self: Box<T>) -> Box<dyn Any>

Converts Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>, which can then be downcast into Box<dyn ConcreteType> where ConcreteType implements Trait.
Source§

fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>

Converts Rc<Trait> (where Trait: Downcast) to Rc<Any>, which can then be further downcast into Rc<ConcreteType> where ConcreteType implements Trait.
Source§

fn as_any(&self) -> &(dyn Any + 'static)

Converts &Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot generate &Any’s vtable from &Trait’s.
Source§

fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)

Converts &mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot generate &mut Any’s vtable from &mut Trait’s.
Source§

impl<T> DowncastSend for T
where T: Any + Send,

Source§

fn into_any_send(self: Box<T>) -> Box<dyn Any + Send>

Converts Box<Trait> (where Trait: DowncastSend) to Box<dyn Any + Send>, which can then be downcast into Box<ConcreteType> where ConcreteType implements Trait.
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

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> IntoResult<T> for T

Source§

fn into_result(self) -> Result<T, RunSystemError>

Converts this type into the system output type.
Source§

impl<A> Is for A
where A: Any,

Source§

fn is<T>() -> bool
where T: Any,

Checks if the current type “is” another type, using a TypeId equality comparison. This is most useful in the context of generic logic. 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, 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.
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