Skip to main content

AgentRuntimeBuilder

Struct AgentRuntimeBuilder 

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

Fluent API for constructing an AgentRuntime.

Collects agent specs, tools, plugins, models, providers, and optionally a store, then builds the fully resolved runtime.

Implementations§

Source§

impl AgentRuntimeBuilder

Source

pub fn new() -> Self

Source

pub fn with_agent_spec(self, spec: AgentSpec) -> Self

Register an agent spec.

Source

pub fn with_agent_specs( self, specs: impl IntoIterator<Item = AgentSpec>, ) -> Self

Register multiple agent specs.

Source

pub fn with_tool(self, id: impl Into<String>, tool: Arc<dyn Tool>) -> Self

Register a tool by ID.

Source

pub fn with_plugin(self, id: impl Into<String>, plugin: Arc<dyn Plugin>) -> Self

Register a plugin by ID.

Source

pub fn with_model_binding( self, id: impl Into<String>, binding: ModelBinding, ) -> Self

Register a model binding by ID.

Source

pub fn with_provider( self, id: impl Into<String>, executor: Arc<dyn LlmExecutor>, ) -> Self

Register a provider (LLM executor) by ID.

Source

pub fn with_thread_run_store(self, store: Arc<dyn ThreadRunStore>) -> Self

Set the thread run store for persistence.

Source

pub fn with_profile_store(self, store: Arc<dyn ProfileStore>) -> Self

Set the profile store for cross-run key-value persistence.

Source

pub fn with_remote_agents( self, name: impl Into<String>, base_url: impl Into<String>, bearer_token: Option<String>, ) -> Self

Add a named remote A2A agent source for discovery.

When remote sources are configured, the builder creates a CompositeAgentSpecRegistry that combines local agents with agents discovered from remote A2A endpoints. The name is used for namespaced agent lookup (e.g., "cloud/translator").

Source

pub fn with_agent_backend_factory( self, factory: Arc<dyn ExecutionBackendFactory>, ) -> Self

Register a remote delegate backend factory by its backend kind.

Source

pub fn build(self) -> Result<AgentRuntime, BuildError>

Build the AgentRuntime and validate all registered agents can resolve successfully.

Performs a dry-run resolve for every registered agent, catching configuration errors (missing models, providers, plugins) at build time. Use build_unchecked() to skip validation.

Source

pub fn build_unchecked(self) -> Result<AgentRuntime, BuildError>

Build the AgentRuntime from the accumulated configuration, skipping agent validation.

Prefer build() which validates all registered agents can resolve successfully at build time.

Source

pub async fn build_and_discover(self) -> Result<AgentRuntime, BuildError>

Build and initialize (async). Discovers remote agents after build.

Trait Implementations§

Source§

impl Default for AgentRuntimeBuilder

Source§

fn default() -> Self

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

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<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> PolicyExt for T
where T: ?Sized,

Source§

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