Skip to main content

AgentResolver

Trait AgentResolver 

Source
pub trait AgentResolver:
    Send
    + Sync
    + 'static {
    // Required method
    fn resolve(&self, agent_hint: &str, ctx: &Ctx) -> String;
}
Expand description

Routing resolver trait. Takes the Ctx.agent hint and returns a real agent name the inner spawner can resolve. Sync is enough — this is meant for light lookups. Push heavy resolvers into a separate spawner layer or a Lua plugin.

The directive argument was removed in the current design: prompts now travel through engine state and no longer appear in spawner arguments. If you need prompt-content-driven routing, either have the resolver call engine.fetch_prompt(token, task_id) from a separate layer, or implement a dedicated prompt-based routing layer (carry).

Required Methods§

Source

fn resolve(&self, agent_hint: &str, ctx: &Ctx) -> String

agent_hint is the raw Ctx.agent value. The returned string is installed as the new Ctx.agent before the inner spawner is called.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§

Source§

impl<F> AgentResolver for FnResolver<F>
where F: Fn(&str, &Ctx) -> String + Send + Sync + 'static,