Skip to main content

Agent

Trait Agent 

Source
pub trait Agent {
    // Required method
    fn run(&self, instruction: &str) -> Result<RunArtifacts, EvalError>;
}
Expand description

The easy path: implement this single method for your harness — run ONE prompt, return what the agent did — and the framework does the rest.

Pair an Agent with the built-in Expectation assertions and call run_suite: no World, no Setup, no Scorer impl. Internally an adapter (AgentHarness) wraps the agent as a Harness<World = (), Setup = ()>, and BuiltinScorer scores the returned RunArtifacts.

This is “pytest for agents”: a test case is a prompt + Expectations, scored over the universal RunArtifacts with no user-implemented scorer.

Required Methods§

Source

fn run(&self, instruction: &str) -> Result<RunArtifacts, EvalError>

Run instruction once and return what the agent did (RunArtifacts: tool calls, final text, tokens, transcript). Return EvalError::agent for a run-level failure; the runner marks the case failed and records the error, but still scores every expectation over the artifacts.

Dyn Compatibility§

This trait is dyn compatible.

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

Implementors§