Skip to main content

AgentRuntime

Struct AgentRuntime 

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

Unified runtime that coordinates memory, graph, orchestration, and agent loop.

Implementations§

Source§

impl AgentRuntime

Source

pub fn builder() -> AgentRuntimeBuilder<NeedsConfig>

Return a new builder in the NeedsConfig state.

Source

pub fn quick(max_iterations: usize, model: impl Into<String>) -> Self

Construct a minimal AgentRuntime in one call with sensible defaults.

Source

pub fn metrics(&self) -> Arc<RuntimeMetrics>

Return a shared reference to the runtime metrics.

Source

pub async fn run_agent<F, Fut>( &self, agent_id: AgentId, prompt: &str, infer: F, ) -> Result<AgentSession, AgentRuntimeError>
where F: FnMut(String) -> Fut, Fut: Future<Output = String>,

Run the agent loop for the given prompt.

Optionally recalls episodic memories and injects them into the context. Optionally enforces backpressure before starting.

§Arguments
  • agent_id — identifies the agent for memory retrieval
  • prompt — the user’s input prompt
  • infer — async inference function: (context: String) -> impl Future<Output = String>
§Returns

An AgentSession with step count, hits, duration, and a stable session ID.

Source

pub fn memory(&self) -> Option<&EpisodicStore>

Return a reference to the episodic memory store, if configured.

Source

pub fn graph(&self) -> Option<&GraphStore>

Return a reference to the graph store, if configured.

Source

pub fn working_memory(&self) -> Option<&WorkingMemory>

Return a reference to the working memory, if configured.

Source

pub fn has_memory(&self) -> bool

Return true if episodic memory was configured for this runtime.

Source

pub fn has_graph(&self) -> bool

Return true if a graph store was configured for this runtime.

Source

pub fn has_working_memory(&self) -> bool

Return true if working memory was configured for this runtime.

Source

pub async fn shutdown(&self)

Gracefully shut down the runtime.

Logs a structured shutdown event with the final metrics snapshot. If the persistence feature is enabled and a checkpoint backend is configured, writes a sentinel key so operators can confirm clean shutdown.

After calling shutdown, the runtime should not be used again.

Trait Implementations§

Source§

impl Debug for AgentRuntime

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. 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, 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