pub struct AgentRuntimeBuilder<S = NeedsConfig> { /* private fields */ }Expand description
Builder for AgentRuntime.
Uses a typestate parameter S to enforce that with_agent_config is called
before build(). Calling build() on a AgentRuntimeBuilder<NeedsConfig>
is a compile-time error.
Typical usage:
ⓘ
let runtime = AgentRuntime::builder() // AgentRuntimeBuilder<NeedsConfig>
.with_memory(store)
.with_agent_config(cfg) // → AgentRuntimeBuilder<HasConfig>
.build(); // → AgentRuntime (infallible)Implementations§
Source§impl<S> AgentRuntimeBuilder<S>
impl<S> AgentRuntimeBuilder<S>
Sourcepub fn with_memory(self, store: EpisodicStore) -> Self
pub fn with_memory(self, store: EpisodicStore) -> Self
Attach an episodic memory store.
Sourcepub fn with_working_memory(self, wm: WorkingMemory) -> Self
pub fn with_working_memory(self, wm: WorkingMemory) -> Self
Attach a working memory store.
Sourcepub fn with_graph(self, graph: GraphStore) -> Self
pub fn with_graph(self, graph: GraphStore) -> Self
Attach a graph store.
Sourcepub fn with_backpressure(self, guard: BackpressureGuard) -> Self
pub fn with_backpressure(self, guard: BackpressureGuard) -> Self
Attach a backpressure guard.
Sourcepub fn register_tool(self, spec: ToolSpec) -> Self
pub fn register_tool(self, spec: ToolSpec) -> Self
Register a tool available to the agent loop.
Sourcepub fn with_metrics(self, metrics: Arc<RuntimeMetrics>) -> Self
pub fn with_metrics(self, metrics: Arc<RuntimeMetrics>) -> Self
Attach a shared RuntimeMetrics instance.
Source§impl AgentRuntimeBuilder<NeedsConfig>
impl AgentRuntimeBuilder<NeedsConfig>
Sourcepub fn with_agent_config(
self,
config: AgentConfig,
) -> AgentRuntimeBuilder<HasConfig>
pub fn with_agent_config( self, config: AgentConfig, ) -> AgentRuntimeBuilder<HasConfig>
Set the agent loop configuration.
After this call the builder transitions to AgentRuntimeBuilder<HasConfig>,
making build() available.
Source§impl AgentRuntimeBuilder<HasConfig>
impl AgentRuntimeBuilder<HasConfig>
Sourcepub fn build(self) -> AgentRuntime
pub fn build(self) -> AgentRuntime
Build the AgentRuntime.
This is infallible: the typestate guarantees agent_config is present.
Trait Implementations§
Source§impl Debug for AgentRuntimeBuilder<NeedsConfig>
impl Debug for AgentRuntimeBuilder<NeedsConfig>
Source§impl Debug for AgentRuntimeBuilder<HasConfig>
impl Debug for AgentRuntimeBuilder<HasConfig>
Source§impl Default for AgentRuntimeBuilder<NeedsConfig>
impl Default for AgentRuntimeBuilder<NeedsConfig>
Auto Trait Implementations§
impl<S> Freeze for AgentRuntimeBuilder<S>
impl<S = NeedsConfig> !RefUnwindSafe for AgentRuntimeBuilder<S>
impl<S> Send for AgentRuntimeBuilder<S>where
S: Send,
impl<S> Sync for AgentRuntimeBuilder<S>where
S: Sync,
impl<S> Unpin for AgentRuntimeBuilder<S>where
S: Unpin,
impl<S> UnsafeUnpin for AgentRuntimeBuilder<S>
impl<S = NeedsConfig> !UnwindSafe for AgentRuntimeBuilder<S>
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
Mutably borrows from an owned value. Read more