pub trait Hook: Send + Sync {
type Model: Model + Send + Sync;
// Required methods
fn model(&self) -> &Self::Model;
fn tools(&self, agent: &str) -> Vec<Tool>;
fn dispatch(
&self,
agent: &str,
calls: &[(&str, &str)],
) -> impl Future<Output = Vec<Result<String>>> + Send;
// Provided methods
fn enrich_prompt(&self, config: &AgentConfig) -> String { ... }
fn on_event(&self, _event: &AgentEvent) { ... }
}Expand description
Stateful runtime backend.
Owns the model provider, tool registry, skill registry, MCP bridge, and
any other backend state. Runtime holds Arc<H> and delegates through
these methods.
Required Associated Types§
Required Methods§
Provided Methods§
Sourcefn enrich_prompt(&self, config: &AgentConfig) -> String
fn enrich_prompt(&self, config: &AgentConfig) -> String
Build an enriched system prompt for the given agent config.
Default implementation returns the config’s system prompt unchanged. Override to inject skills, MCP context, or other prompt augmentation.
Sourcefn on_event(&self, _event: &AgentEvent)
fn on_event(&self, _event: &AgentEvent)
Called when an agent emits an event during execution.
Default is a no-op.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.