pub struct Runtime<M: Model, H: Hook> {
pub model: M,
pub hook: H,
/* private fields */
}Expand description
The walrus runtime — agent registry, schema store, and hook orchestration.
Tool schemas are registered once at construction via hook.on_register_tools().
Each agent is built with a filtered schema snapshot and a ToolSender so it
can dispatch tool calls back to the runtime without going through the runtime.
Runtime::new() is async — it calls hook.on_register_tools() during
construction to populate the schema registry.
Fields§
§model: M§hook: HImplementations§
Source§impl<M: Model + Send + Sync + Clone + 'static, H: Hook + 'static> Runtime<M, H>
impl<M: Model + Send + Sync + Clone + 'static, H: Hook + 'static> Runtime<M, H>
Sourcepub async fn new(model: M, hook: H, tool_tx: Option<ToolSender>) -> Self
pub async fn new(model: M, hook: H, tool_tx: Option<ToolSender>) -> Self
Create a new runtime with the given model and hook backend.
Calls hook.on_register_tools() to populate the schema registry.
Pass tool_tx to enable tool dispatch from agents; None means agents
have no tool dispatch (e.g. CLI without a daemon).
Sourcepub fn register_tool(&mut self, tool: Tool)
pub fn register_tool(&mut self, tool: Tool)
Register a tool schema.
Sourcepub fn unregister_tool(&mut self, name: &str) -> bool
pub fn unregister_tool(&mut self, name: &str) -> bool
Remove a tool schema by name. Returns true if it existed.
Sourcepub fn add_agent(&mut self, config: AgentConfig)
pub fn add_agent(&mut self, config: AgentConfig)
Register an agent from its configuration.
Calls hook.on_build_agent(config) to enrich the config, then builds
the agent with a filtered schema snapshot and the runtime’s tool_tx.
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 fn agent_mutex(&self, name: &str) -> Option<Arc<Mutex<Agent<M>>>>
pub fn agent_mutex(&self, name: &str) -> Option<Arc<Mutex<Agent<M>>>>
Get the per-agent mutex by name.