Skip to main content

Runtime

Struct Runtime 

Source
pub struct Runtime<H: Hook> { /* private fields */ }
Expand description

The walrus runtime — agent registry and hook orchestration.

Generic over H: Hook for the runtime backend. Stores agents (each holding its own model clone, config, and history). Callers take agents out for execution and put them back when done.

Implementations§

Source§

impl<H: Hook + 'static> Runtime<H>

Source

pub fn new(hook: Arc<H>) -> Self

Create a new runtime with the given hook backend.

Source

pub fn hook(&self) -> &H

Access the hook backend.

Source

pub async fn add_agent(&self, config: AgentConfig)

Register an agent from its configuration.

Clones the Hook’s model into the agent so it can drive LLM calls.

Source

pub async fn agent(&self, name: &str) -> Option<AgentConfig>

Get a registered agent’s config by name (cloned).

Source

pub async fn agents(&self) -> Vec<AgentConfig>

Get all registered agent configs (cloned, alphabetical order).

Source

pub async fn take_agent(&self, name: &str) -> Option<Agent<H::Model>>

Take an agent out of the registry for execution.

The agent is removed from the map. Caller must call [put_agent] to re-insert it after execution completes.

Source

pub async fn put_agent(&self, agent: Agent<H::Model>)

Put an agent back into the registry after execution.

Source

pub async fn clear_session(&self, agent: &str)

Clear the conversation history for a named agent.

Auto Trait Implementations§

§

impl<H> !Freeze for Runtime<H>

§

impl<H> !RefUnwindSafe for Runtime<H>

§

impl<H> Send for Runtime<H>

§

impl<H> Sync for Runtime<H>

§

impl<H> Unpin for Runtime<H>

§

impl<H> UnsafeUnpin for Runtime<H>

§

impl<H> UnwindSafe for Runtime<H>

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, 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.