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
impl AgentWorldBuilder
Sourcepub fn provider(self, creds: ProviderCreds) -> Self
pub fn provider(self, creds: ProviderCreds) -> Self
Add a provider from credentials (repeatable). See ProviderCreds
for the supported providers.
Sourcepub fn register_provider(
self,
name: impl Into<String>,
provider: Arc<dyn Provider>,
) -> Self
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.
Sourcepub fn default_model(
self,
provider: impl Into<String>,
model: impl Into<String>,
) -> Self
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.
Sourcepub fn fallback_model(
self,
provider: impl Into<String>,
model: impl Into<String>,
) -> Self
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).
Sourcepub fn tool_service(self, service: Arc<dyn ToolService>) -> Self
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.
Sourcepub fn state_dir(self, dir: impl Into<PathBuf>) -> Self
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.
Sourcepub fn inference_pool(self, config: InferencePoolConfig) -> Self
pub fn inference_pool(self, config: InferencePoolConfig) -> Self
Per-model inference concurrency limits.
Sourcepub fn tool_concurrency(self, n: usize) -> Self
pub fn tool_concurrency(self, n: usize) -> Self
How many tool batches may execute concurrently (default 4).
Sourcepub fn prompt_hints(self, hints: PromptHints) -> Self
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.
Sourcepub fn runtime(self, handle: Handle) -> Self
pub fn runtime(self, handle: Handle) -> Self
Run the world on handle instead of the ambient Tokio runtime.
Sourcepub fn build(self) -> Result<AgentWorld, EmbedError>
pub fn build(self) -> Result<AgentWorld, EmbedError>
Assemble the world and start its serve loop on the Tokio runtime.
Auto Trait Implementations§
impl !RefUnwindSafe for AgentWorldBuilder
impl !UnwindSafe for AgentWorldBuilder
impl Freeze for AgentWorldBuilder
impl Send for AgentWorldBuilder
impl Sync for AgentWorldBuilder
impl Unpin for AgentWorldBuilder
impl UnsafeUnpin for AgentWorldBuilder
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
impl<T> ConditionalSend for Twhere
T: Send,
Source§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
Source§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
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>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
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)
fn as_any(&self) -> &(dyn Any + 'static)
&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)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.