pub trait AgentRunner: Send + Sync {
// Required method
fn run<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
agent_name: &'life1 str,
task: &'life2 str,
) -> Pin<Box<dyn Future<Output = Result<AgentOutput>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait;
// Provided methods
fn run_with_context<'life0, 'life1, 'life2, 'life3, 'async_trait>(
&'life0 self,
agent_name: &'life1 str,
task: &'life2 str,
_ctx: &'life3 RunContext,
) -> Pin<Box<dyn Future<Output = Result<AgentOutput>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait { ... }
fn run_with_history<'life0, 'life1, 'life2, 'life3, 'life4, 'async_trait>(
&'life0 self,
agent_name: &'life1 str,
task: &'life2 str,
_history: &'life3 [HistoryMessage],
ctx: &'life4 RunContext,
) -> Pin<Box<dyn Future<Output = Result<AgentOutput>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait,
'life4: 'async_trait { ... }
}Expand description
Runs a task against a named agent.
Why: Abstracts over how an agent is executed — subprocess, in-process, or
mock. Lets tests avoid spawning real processes.
What: run(agent_name, task) returns the agent’s AgentOutput.
run_with_context extends this to pass per-invocation overrides; the
default forwards to run() so existing mock runners keep working.
Test: MockAgentRunner in tests implements this; test_run_with_history_forwards_ctx
verifies the default delegation chain.
Required Methods§
Sourcefn run<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
agent_name: &'life1 str,
task: &'life2 str,
) -> Pin<Box<dyn Future<Output = Result<AgentOutput>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
fn run<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
agent_name: &'life1 str,
task: &'life2 str,
) -> Pin<Box<dyn Future<Output = Result<AgentOutput>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Run a task against the named agent.
Provided Methods§
Sourcefn run_with_context<'life0, 'life1, 'life2, 'life3, 'async_trait>(
&'life0 self,
agent_name: &'life1 str,
task: &'life2 str,
_ctx: &'life3 RunContext,
) -> Pin<Box<dyn Future<Output = Result<AgentOutput>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait,
fn run_with_context<'life0, 'life1, 'life2, 'life3, 'async_trait>(
&'life0 self,
agent_name: &'life1 str,
task: &'life2 str,
_ctx: &'life3 RunContext,
) -> Pin<Box<dyn Future<Output = Result<AgentOutput>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait,
Run with per-invocation overrides in ctx.
Why: Replaces std::env::set_var threading of per-call state. Default
impl ignores ctx and falls back to run() so legacy mock runners
keep working unchanged.
What: Concrete runners override this to scope env vars to the child.
Test: Wave-loop and runner tests prove context fields reach the child.
Sourcefn run_with_history<'life0, 'life1, 'life2, 'life3, 'life4, 'async_trait>(
&'life0 self,
agent_name: &'life1 str,
task: &'life2 str,
_history: &'life3 [HistoryMessage],
ctx: &'life4 RunContext,
) -> Pin<Box<dyn Future<Output = Result<AgentOutput>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait,
'life4: 'async_trait,
fn run_with_history<'life0, 'life1, 'life2, 'life3, 'life4, 'async_trait>(
&'life0 self,
agent_name: &'life1 str,
task: &'life2 str,
_history: &'life3 [HistoryMessage],
ctx: &'life4 RunContext,
) -> Pin<Box<dyn Future<Output = Result<AgentOutput>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait,
'life4: 'async_trait,
Run a task while forwarding prior session history.
Why: Persistent-session agents need prior turns so the sub-agent can
rebuild context in a fresh subprocess.
What: Default delegates to run_with_context(ctx) so working_dir
and model are honoured even when the runner does not override this.
Test: test_run_with_history_forwards_ctx.
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".