ExAgent.Eval.Scenario (ExAgent v3.0.0)

View Source

A bounded conversation attempt in ExAgent.Eval.

Stability — Candidate.

Wrap a scenario in ExAgent.Eval.Case.new/3 and evaluate an agent target. Each turn is a text prompt or {prompt, actions}. The next turn gets the previous run's history and model. An unresolved pause can end the script. Use simulated/1 for a model-driven user instead of scripted prompts.

Actions are applied in order after the turn's run. {:approve, tool_name}, {:deny, tool_name} and {:edit, tool_name, replacement_args} decide a single pending approval of the root agent. A denial can also supply a message with {:deny, tool_name, message}. Use {tool_name, call_id} as selector when a tool appears twice. :resume consumes the ready reference from the last decision. Supply the host's reviewer: [actor: actor, authorize: fun] for decisions. In the case's or suite's :run_opts, pass a scoped :continuation config without an :id. Each turn gets a fresh record ID, including repeats and replays. The host owns that store and its retention policy.

Evaluators receive outcome.trajectory, a list of maps in turn order. Each map includes the prompt, performed actions, run ID, continuation ID, final status and output of that turn, new messages, qualified Eval accounting, tool call count and the runtime's effect attempt counters. An independent host-side observer can use the run ID to verify a real effect.

Summary

Functions

Build a finite script. The default limit is 16 user turns per attempt.

Build a scenario around an ExAgent.Eval.Simulator. Every user message comes from the simulator. A pause ends the attempt and leaves review to the host. Any continuation config follows the same rules as a script.

Types

action()

@type action() ::
  {:approve | :deny, selector()}
  | {:deny, selector(), String.t()}
  | {:edit, selector(), map()}
  | :resume

selector()

@type selector() :: String.t() | {String.t(), String.t()}

t()

@type t() :: %ExAgent.Eval.Scenario{
  max_turns: pos_integer(),
  reviewer: keyword(),
  simulator: ExAgent.Eval.Simulator.t() | nil,
  turns: [turn()]
}

turn()

@type turn() :: {String.t(), [action()]}

Functions

new(turns, opts \\ [])

@spec new([String.t() | turn()], keyword()) :: t()

Build a finite script. The default limit is 16 user turns per attempt.

simulated(simulator)

@spec simulated(ExAgent.Eval.Simulator.t()) :: t()

Build a scenario around an ExAgent.Eval.Simulator. Every user message comes from the simulator. A pause ends the attempt and leaves review to the host. Any continuation config follows the same rules as a script.