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>
impl<H: Hook + 'static> Runtime<H>
Sourcepub async fn add_agent(&self, config: AgentConfig)
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.
Sourcepub async fn agent(&self, name: &str) -> Option<AgentConfig>
pub async fn agent(&self, name: &str) -> Option<AgentConfig>
Get a registered agent’s config by name (cloned).
Sourcepub async fn agents(&self) -> Vec<AgentConfig>
pub async fn agents(&self) -> Vec<AgentConfig>
Get all registered agent configs (cloned, alphabetical order).
Sourcepub async fn take_agent(&self, name: &str) -> Option<Agent<H::Model>>
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.
Sourcepub async fn put_agent(&self, agent: Agent<H::Model>)
pub async fn put_agent(&self, agent: Agent<H::Model>)
Put an agent back into the registry after execution.
Sourcepub async fn clear_session(&self, agent: &str)
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> 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