Sitelet https://github.com/GoogleCloudPlatform/evalbench/pull/700
Skip to content

feat(agent): run num_trials trials of each scenario - #700

Open
omkargaikwad23 wants to merge 5 commits into
mainfrom
feat/agent-num-trials
Open

omkargaikwad23 wants to merge 5 commits into
mainfrom
feat/agent-num-trials

Conversation

@omkargaikwad23

@omkargaikwad23 omkargaikwad23 commented Nov 4, 2026 •

Copy link
Copy Markdown
Collaborator

What this does

Agent evals can now run each scenario more than once. Set num_trials: N in the run config, and the whole suite runs N times in one job, one trial after another. A trial finishes before the next one starts.

With N > 1, each eval row and score row says which scenario and which trial it belongs to:

  • id: capitals_trial_1
  • prompt_id: capitals
  • trial_index: 1

This is the same format that NL2SQL already uses.

A scenario can set its own num_trials to run fewer times, for example 1 to run once. It cannot run more times than the run config. A higher value is capped at the run config value, with a warning. num_trials must be a whole number of 1 or more.

With the default of 1, the output does not change.

Why

One run cannot tell a stable pass from a lucky one. This is the first step of multi-run stats. Later PRs use these rows to compute pass rate and flakiness for each scenario.

Testing

  • 16 new unit tests in evalbench/test/agent_num_trials_test.py. The full test suite passes.
  • A local run with num_trials: 2 and two scenarios, one set to run once. It produced capitals_trial_0, capitals_trial_1, and sum_once_trial_0, and the score rows had the same labels. Logs: https://paste.googleplex.com/6755399436651482 (Google-internal)

Not covered

With N > 1, two things are not right yet. Later PRs fix them.

  • Summary totals. summary.csv is not correct for N > 1. Numeric metrics such as token_consumption and turn_count show a count instead of an average, and the executable total is too high.
  • Reset between trials. All trials share the sandbox home directory and work_dir, so files that one trial writes stay for the next trial. Until a reset is added, set num_trials: 1 on scenarios that write files or create named cloud resources. The dataset config doc has a note about this.

The agent evaluator now reads num_trials and runs the full suite once per trial, one trial after another. With more than one trial, each row gets id <scenario>_trial_<k>, prompt_id, and trial_index, the same as NL2SQL. A scenario can set a lower num_trials. With one trial, the output does not change.
@omkargaikwad23

Copy link
Copy Markdown
Collaborator Author

/gcbrun

omkargaikwad23 and others added 3 commits November 4, 2026 14:21
The old sequencing test passed without a barrier between trials. The new
test holds one trial 0 scenario and checks that no trial 1 scenario starts
before trial 0 ends.

Document the scenario-level num_trials key, and that trials share the
sandbox home and work_dir. Say why trials run one after another.
@prernakakkar-google

Copy link
Copy Markdown
Collaborator

LEts close doc design first

| `query_types` | Optional | Specifies the query_types (`dql`, `dml`, `dd`). This filters the dataset to the list of evals that are of the query_types provided. If not provided, all eval types (dql, dml and ddl) found in the dataset_config json file will be tried. |
| `dataset_format` | Conditional (if needed) | Defines the dataset format, with `evalbench-standard-format` as the default. For BIRD datasets, it must be set to `bird-standard-format`. For scenario-based agent runs use `agent-format` (orchestrator `agent`) or `gemini-cli-format` (orchestrator `geminicli`); other supported values are `bird-interact-format`, `cortado-format`, and `dea-format`.|
| `num_trials` | Optional | Number of trials to run for each prompt. |
| `num_trials` | Optional | Number of trials to run for each prompt (NL2SQL) or scenario (agent runs). |

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Lets add examples to be more clear for both.

@prernakakkar-google

Copy link
Copy Markdown
Collaborator

Currently this PR is not resetting before any trial.

| `databases` | Optional | Specifies the databases (e.g., `db_blog`, `california_schools`, etc.). This filters the dataset to the provided list of databases and ignores all other evals. If not provided, all databases found in the dataset_config json file will be tried. |
| `query_types` | Optional | Specifies the query_types (`dql`, `dml`, `dd`). This filters the dataset to the list of evals that are of the query_types provided. If not provided, all eval types (dql, dml and ddl) found in the dataset_config json file will be tried. |
| `dataset_format` | Conditional (if needed) | Defines the dataset format, with `evalbench-standard-format` as the default. For BIRD datasets, it must be set to `bird-standard-format`. For scenario-based agent runs use `agent-format` (orchestrator `agent`) or `gemini-cli-format` (orchestrator `geminicli`); other supported values are `bird-interact-format`, `cortado-format`, and `dea-format`.|
| `num_trials` | Optional | Number of trials to run for each prompt. |

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Update existing run config as well

@omkargaikwad23

Copy link
Copy Markdown
Collaborator Author

Currently this PR is not resetting before any trial.

I have created separate PR #709 on top of this as this PR was getting larger.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants