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
impl AgentRuntimeBuilder
pub fn new() -> Self
Sourcepub fn with_agent_spec(self, spec: AgentSpec) -> Self
pub fn with_agent_spec(self, spec: AgentSpec) -> Self
Register an agent spec.
Sourcepub fn with_agent_specs(
self,
specs: impl IntoIterator<Item = AgentSpec>,
) -> Self
pub fn with_agent_specs( self, specs: impl IntoIterator<Item = AgentSpec>, ) -> Self
Register multiple agent specs.
Sourcepub fn with_tool(self, id: impl Into<String>, tool: Arc<dyn Tool>) -> Self
pub fn with_tool(self, id: impl Into<String>, tool: Arc<dyn Tool>) -> Self
Register a tool by ID.
Sourcepub fn with_plugin(self, id: impl Into<String>, plugin: Arc<dyn Plugin>) -> Self
pub fn with_plugin(self, id: impl Into<String>, plugin: Arc<dyn Plugin>) -> Self
Register a plugin by ID.
Sourcepub fn with_model_binding(
self,
id: impl Into<String>,
binding: ModelBinding,
) -> Self
pub fn with_model_binding( self, id: impl Into<String>, binding: ModelBinding, ) -> Self
Register a model binding by ID.
Sourcepub fn with_provider(
self,
id: impl Into<String>,
executor: Arc<dyn LlmExecutor>,
) -> Self
pub fn with_provider( self, id: impl Into<String>, executor: Arc<dyn LlmExecutor>, ) -> Self
Register a provider (LLM executor) by ID.
Sourcepub fn with_thread_run_store(self, store: Arc<dyn ThreadRunStore>) -> Self
pub fn with_thread_run_store(self, store: Arc<dyn ThreadRunStore>) -> Self
Set the thread run store for persistence.
Sourcepub fn with_profile_store(self, store: Arc<dyn ProfileStore>) -> Self
pub fn with_profile_store(self, store: Arc<dyn ProfileStore>) -> Self
Set the profile store for cross-run key-value persistence.
Sourcepub fn with_remote_agents(
self,
name: impl Into<String>,
base_url: impl Into<String>,
bearer_token: Option<String>,
) -> Self
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").
Sourcepub fn with_agent_backend_factory(
self,
factory: Arc<dyn ExecutionBackendFactory>,
) -> Self
pub fn with_agent_backend_factory( self, factory: Arc<dyn ExecutionBackendFactory>, ) -> Self
Register a remote delegate backend factory by its backend kind.
Sourcepub fn build(self) -> Result<AgentRuntime, BuildError>
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.
Sourcepub fn build_unchecked(self) -> Result<AgentRuntime, BuildError>
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.
Sourcepub async fn build_and_discover(self) -> Result<AgentRuntime, BuildError>
pub async fn build_and_discover(self) -> Result<AgentRuntime, BuildError>
Build and initialize (async). Discovers remote agents after build.