Skip to content

API Reference parrot.eval.rollout

github-actions[bot] edited this page Dec 2, 2026 · 4 revisions

parrot.eval.rollout

View source

Rollout strategies and user simulators for the Generic Agent Evaluation Harness.

FEAT-217 — Module 5.

Rollout strategies drive an agent against a task inside a sandbox and return a Trajectory. User simulators generate user-side turns for conversational (τ-bench style) evaluations.

Provided implementations:

  • SingleTurnRollout — one bot.ask() call; suitable for single-shot toolkit agents.
  • ConversationalRollout — iterative bot.conversation() loop driven by a UserSimulator; suitable for multi-turn agents.
  • LLMUserSimulator — calls client.ask() to generate synthetic user turns (τ-bench style, temperature = 0 for reproducibility).

Alias AbstractBot

Re-exported from parrot.bots.abstract.AbstractBot.

Alias AbstractClient

Re-exported from parrot.clients.base.AbstractClient.

Class ConversationalRollout

Multi-turn rollout that loops bot.conversation() against a simulator.

The conversation continues until the simulator returns None or max_turns is reached.

Parameter Type Default Description
user_sim UserSimulator UserSimulator that generates user-side turns.
max_turns int 30 Maximum number of agent turns before giving up.

Method ConversationalRollout.run

Drive a multi-turn conversation until completion or max_turns.

run(bot: 'AbstractBot', task: EvalTask, sandbox: Sandbox) -> Trajectory

Parameter Type Default Description
bot 'AbstractBot' The conversational agent.
task EvalTask Eval task with a user_scenario for the simulator.
sandbox Sandbox Active sandbox.

Returns: Trajectory — Trajectory with all turns, final_output (last agent response), and latency_ms.

Alias EvalTask

Re-exported from parrot.eval.models.EvalTask.

Class LLMUserSimulator

User simulator backed by an LLM (AbstractClient.ask()).

Sends the scenario + conversation history to the model and asks it to generate the next user turn. Uses temperature=0 for reproducibility (spec D6).

A None return from the model (or any response that looks like an end-of-task signal) stops the conversational rollout.

Parameter Type Default Description
client 'AbstractClient' AbstractClient instance to use for turn generation. Must NOT be the same model-under-test.
system_prompt str | None None Optional system prompt. Defaults to a sensible user-simulation instruction.

Method LLMUserSimulator.respond

Generate the next user utterance via the client.

respond(conversation: list[TurnRecord], scenario: str) -> str | None

Parameter Type Default Description
conversation list[TurnRecord] Conversation history so far.
scenario str The user's goal description.

Returns: str | None — Next user message, or None when the task is complete.

Class RolloutStrategy

Abstract strategy for driving an agent through a task.

A rollout strategy calls bot.ask() or bot.conversation() and records the resulting Trajectory.

Method RolloutStrategy.run

Drive bot through task in sandbox and return the trajectory.

run(bot: 'AbstractBot', task: EvalTask, sandbox: Sandbox) -> Trajectory

Parameter Type Default Description
bot 'AbstractBot' The agent to drive.
task EvalTask The evaluation task.
sandbox Sandbox The sandbox the agent is executing in (used to capture final_state after the rollout, if not handled by the runner).

Returns: Trajectory — Completed Trajectory with turns, latency, tokens, etc.

Alias Sandbox

Re-exported from parrot.eval.sandbox.base.Sandbox.

Class SingleTurnRollout

One-shot rollout: a single bot.ask() call.

Suitable for single-shot toolkit agents (e.g. "Do CRUD task X"). Records one TurnRecord (role="agent") with the bot's response.

Method SingleTurnRollout.run

Execute a single bot.ask() call and return the trajectory.

run(bot: 'AbstractBot', task: EvalTask, sandbox: Sandbox) -> Trajectory

Parameter Type Default Description
bot 'AbstractBot' Agent to query.
task EvalTask Eval task; task.inputs must contain a "query" key (or another string-valued key used as the question).
sandbox Sandbox Active sandbox (final_state captured by the runner).

Returns: Trajectory — Trajectory with one turn, final_output, and latency_ms.

Alias TokenUsage

Re-exported from parrot.eval.models.TokenUsage.

Alias ToolCallRecord

Re-exported from parrot.eval.models.ToolCallRecord.

Alias Trajectory

Re-exported from parrot.eval.models.Trajectory.

Alias TurnRecord

Re-exported from parrot.eval.models.TurnRecord.

Class UserSimulator

Abstract user-side simulator for conversational rollouts.

Generates the next user message given the current conversation history. Returns None to signal that the task is complete or that the simulator gives up.

Method UserSimulator.respond

Generate the next user utterance.

respond(conversation: list[TurnRecord], scenario: str) -> str | None

Parameter Type Default Description
conversation list[TurnRecord] Current conversation history (turns so far).
scenario str Natural language description of the user's goal (from EvalTask.user_scenario).

Returns: str | None — The next user message, or None to end the conversation.

Attribute logger

Architecture

Clients

Bots & Agents

Memory

Knowledge

Tools & Toolkits

Flows

Experts

Skills

Stores & Loaders

MCP & A2A

Server & APIs

Integrations

Outputs & A2UI

Prompts

Security

Operations

Migration

SDD Tooling

LLM Wiki

Deployment

Decisions

API Reference

Clone this wiki locally