Metadata-Version: 2.4
Name: google-evalbench
Version: 1.21.0
Summary: Evalbench - evaluation benchmarking framework
License: 
                                         Apache License
                                   Version 2.0, January 2004
                                http://www.apache.org/licenses/
        
           TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
        
           1. Definitions.
        
              "License" shall mean the terms and conditions for use, reproduction,
              and distribution as defined by Sections 1 through 9 of this document.
        
              "Licensor" shall mean the copyright owner or entity authorized by
              the copyright owner that is granting the License.
        
              "Legal Entity" shall mean the union of the acting entity and all
              other entities that control, are controlled by, or are under common
              control with that entity. For the purposes of this definition,
              "control" means (i) the power, direct or indirect, to cause the
              direction or management of such entity, whether by contract or
              otherwise, or (ii) ownership of fifty percent (50%) or more of the
              outstanding shares, or (iii) beneficial ownership of such entity.
        
              "You" (or "Your") shall mean an individual or Legal Entity
              exercising permissions granted by this License.
        
              "Source" form shall mean the preferred form for making modifications,
              including but not limited to software source code, documentation
              source, and configuration files.
        
              "Object" form shall mean any form resulting from mechanical
              transformation or translation of a Source form, including but
              not limited to compiled object code, generated documentation,
              and conversions to other media types.
        
              "Work" shall mean the work of authorship, whether in Source or
              Object form, made available under the License, as indicated by a
              copyright notice that is included in or attached to the work
              (an example is provided in the Appendix below).
        
              "Derivative Works" shall mean any work, whether in Source or Object
              form, that is based on (or derived from) the Work and for which the
              editorial revisions, annotations, elaborations, or other modifications
              represent, as a whole, an original work of authorship. For the purposes
              of this License, Derivative Works shall not include works that remain
              separable from, or merely link (or bind by name) to the interfaces of,
              the Work and Derivative Works thereof.
        
              "Contribution" shall mean any work of authorship, including
              the original version of the Work and any modifications or additions
              to that Work or Derivative Works thereof, that is intentionally
              submitted to Licensor for inclusion in the Work by the copyright owner
              or by an individual or Legal Entity authorized to submit on behalf of
              the copyright owner. For the purposes of this definition, "submitted"
              means any form of electronic, verbal, or written communication sent
              to the Licensor or its representatives, including but not limited to
              communication on electronic mailing lists, source code control systems,
              and issue tracking systems that are managed by, or on behalf of, the
              Licensor for the purpose of discussing and improving the Work, but
              excluding communication that is conspicuously marked or otherwise
              designated in writing by the copyright owner as "Not a Contribution."
        
              "Contributor" shall mean Licensor and any individual or Legal Entity
              on behalf of whom a Contribution has been received by Licensor and
              subsequently incorporated within the Work.
        
           2. Grant of Copyright License. Subject to the terms and conditions of
              this License, each Contributor hereby grants to You a perpetual,
              worldwide, non-exclusive, no-charge, royalty-free, irrevocable
              copyright license to reproduce, prepare Derivative Works of,
              publicly display, publicly perform, sublicense, and distribute the
              Work and such Derivative Works in Source or Object form.
        
           3. Grant of Patent License. Subject to the terms and conditions of
              this License, each Contributor hereby grants to You a perpetual,
              worldwide, non-exclusive, no-charge, royalty-free, irrevocable
              (except as stated in this section) patent license to make, have made,
              use, offer to sell, sell, import, and otherwise transfer the Work,
              where such license applies only to those patent claims licensable
              by such Contributor that are necessarily infringed by their
              Contribution(s) alone or by combination of their Contribution(s)
              with the Work to which such Contribution(s) was submitted. If You
              institute patent litigation against any entity (including a
              cross-claim or counterclaim in a lawsuit) alleging that the Work
              or a Contribution incorporated within the Work constitutes direct
              or contributory patent infringement, then any patent licenses
              granted to You under this License for that Work shall terminate
              as of the date such litigation is filed.
        
           4. Redistribution. You may reproduce and distribute copies of the
              Work or Derivative Works thereof in any medium, with or without
              modifications, and in Source or Object form, provided that You
              meet the following conditions:
        
              (a) You must give any other recipients of the Work or
                  Derivative Works a copy of this License; and
        
              (b) You must cause any modified files to carry prominent notices
                  stating that You changed the files; and
        
              (c) You must retain, in the Source form of any Derivative Works
                  that You distribute, all copyright, patent, trademark, and
                  attribution notices from the Source form of the Work,
                  excluding those notices that do not pertain to any part of
                  the Derivative Works; and
        
              (d) If the Work includes a "NOTICE" text file as part of its
                  distribution, then any Derivative Works that You distribute must
                  include a readable copy of the attribution notices contained
                  within such NOTICE file, excluding those notices that do not
                  pertain to any part of the Derivative Works, in at least one
                  of the following places: within a NOTICE text file distributed
                  as part of the Derivative Works; within the Source form or
                  documentation, if provided along with the Derivative Works; or,
                  within a display generated by the Derivative Works, if and
                  wherever such third-party notices normally appear. The contents
                  of the NOTICE file are for informational purposes only and
                  do not modify the License. You may add Your own attribution
                  notices within Derivative Works that You distribute, alongside
                  or as an addendum to the NOTICE text from the Work, provided
                  that such additional attribution notices cannot be construed
                  as modifying the License.
        
              You may add Your own copyright statement to Your modifications and
              may provide additional or different license terms and conditions
              for use, reproduction, or distribution of Your modifications, or
              for any such Derivative Works as a whole, provided Your use,
              reproduction, and distribution of the Work otherwise complies with
              the conditions stated in this License.
        
           5. Submission of Contributions. Unless You explicitly state otherwise,
              any Contribution intentionally submitted for inclusion in the Work
              by You to the Licensor shall be under the terms and conditions of
              this License, without any additional terms or conditions.
              Notwithstanding the above, nothing herein shall supersede or modify
              the terms of any separate license agreement you may have executed
              with Licensor regarding such Contributions.
        
           6. Trademarks. This License does not grant permission to use the trade
              names, trademarks, service marks, or product names of the Licensor,
              except as required for reasonable and customary use in describing the
              origin of the Work and reproducing the content of the NOTICE file.
        
           7. Disclaimer of Warranty. Unless required by applicable law or
              agreed to in writing, Licensor provides the Work (and each
              Contributor provides its Contributions) on an "AS IS" BASIS,
              WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
              implied, including, without limitation, any warranties or conditions
              of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
              PARTICULAR PURPOSE. You are solely responsible for determining the
              appropriateness of using or redistributing the Work and assume any
              risks associated with Your exercise of permissions under this License.
        
           8. Limitation of Liability. In no event and under no legal theory,
              whether in tort (including negligence), contract, or otherwise,
              unless required by applicable law (such as deliberate and grossly
              negligent acts) or agreed to in writing, shall any Contributor be
              liable to You for damages, including any direct, indirect, special,
              incidental, or consequential damages of any character arising as a
              result of this License or out of the use or inability to use the
              Work (including but not limited to damages for loss of goodwill,
              work stoppage, computer failure or malfunction, or any and all
              other commercial damages or losses), even if such Contributor
              has been advised of the possibility of such damages.
        
           9. Accepting Warranty or Additional Liability. While redistributing
              the Work or Derivative Works thereof, You may choose to offer,
              and charge a fee for, acceptance of support, warranty, indemnity,
              or other liability obligations and/or rights consistent with this
              License. However, in accepting such obligations, You may act only
              on Your own behalf and on Your sole responsibility, not on behalf
              of any other Contributor, and only if You agree to indemnify,
              defend, and hold each Contributor harmless for any liability
              incurred by, or claims asserted against, such Contributor by reason
              of your accepting any such warranty or additional liability.
        
           END OF TERMS AND CONDITIONS
        
           APPENDIX: How to apply the Apache License to your work.
        
              To apply the Apache License to your work, attach the following
              boilerplate notice, with the fields enclosed by brackets "[]"
              replaced with your own identifying information. (Don't include
              the brackets!)  The text should be enclosed in the appropriate
              comment syntax for the file format. We also recommend that a
              file or class name and description of purpose be included on the
              same "printed page" as the copyright notice for easier
              identification within third-party archives.
        
           Copyright [yyyy] [name of copyright owner]
        
           Licensed under the Apache License, Version 2.0 (the "License");
           you may not use this file except in compliance with the License.
           You may obtain a copy of the License at
        
               http://www.apache.org/licenses/LICENSE-2.0
        
           Unless required by applicable law or agreed to in writing, software
           distributed under the License is distributed on an "AS IS" BASIS,
           WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
           See the License for the specific language governing permissions and
           limitations under the License.
        
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Requires-Python: >=3.10
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: cloud-sql-python-connector[pg8000]
Requires-Dist: google-cloud-alloydb-connector[pg8000]
Requires-Dist: cloud-sql-python-connector[pytds]
Requires-Dist: sqlalchemy-pytds
Requires-Dist: google-genai
Requires-Dist: google-cloud-aiplatform
Requires-Dist: google-cloud-secret-manager
Requires-Dist: google-cloud-bigtable
Requires-Dist: google-cloud-spanner
Requires-Dist: google-cloud-dataform
Requires-Dist: sqlalchemy-spanner
Requires-Dist: pandas
Requires-Dist: pandas-gbq
Requires-Dist: pymysql
Requires-Dist: sqlalchemy
Requires-Dist: pyaml_env
Requires-Dist: pyarrow
Requires-Dist: protobuf
Requires-Dist: absl-py
Requires-Dist: tabulate
Requires-Dist: grpcio>=1.80.0
Requires-Dist: grpcio-tools>=1.80.0
Requires-Dist: aiologger
Requires-Dist: jsonschema
Requires-Dist: ratelimit
Requires-Dist: backoff
Requires-Dist: GitPython
Requires-Dist: sqlparse
Requires-Dist: redis
Requires-Dist: anthropic[vertex]
Requires-Dist: sqlglot
Requires-Dist: pymongo
Requires-Dist: mongomock
Requires-Dist: rich
Requires-Dist: google-adk
Requires-Dist: google-cloud-geminidataanalytics>=0.11.0
Requires-Dist: google-cloud-firestore
Requires-Dist: google-cloud-iam
Requires-Dist: google-cloud-storage
Requires-Dist: google-cloud-bigquery
Requires-Dist: jupyter-server
Requires-Dist: jupyter-client
Requires-Dist: nbformat
Requires-Dist: ipykernel
Requires-Dist: tornado
Requires-Dist: dbt-core
Requires-Dist: dbt-bigquery
Requires-Dist: dbt-postgres
Requires-Dist: a2a-sdk>=1.0.3
Requires-Dist: mcp<2,>=1.8
Requires-Dist: pyOpenSSL<26.2
Dynamic: license-file

# EvalBench

EvalBench is a framework for evaluating **AI agents**. It runs real agents — coding CLIs such as Gemini CLI, Claude Code, Codex CLI, and Antigravity CLI, as well as conversational data agents — through realistic multi-turn scenarios, captures every turn and tool call, and scores the resulting trajectory for correctness, goal completion, behavior, latency, and cost.

The same pipeline also evaluates **single-turn generation tasks**, most notably **NL2SQL**: generating and executing DQL, DML, and DDL against AlloyDB, BigQuery, Spanner, PostgreSQL, MySQL, SQLite, and more. Agentic and NL2SQL evaluations share one run config format, one scorer framework, and one reporting stack, so you can measure an agent and the model behind it side by side.

Its modular, plug-and-play architecture lets you bring your own agents, tools, datasets, and scorers while reusing a robust evaluation pipeline, result storage, and dashboards.

---

## How it works

Every evaluation — agentic or NL2SQL — follows the same flow:

```mermaid
flowchart LR
    RC["Run config"] --> O["Orchestrator"]
    DS["Dataset<br/>scenarios or eval items"] --> O
    O --> SUT["System under test<br/>agent CLI, data agent, or model"]
    ENV["Environment<br/>MCP servers, skills, plugins, databases"] <--> SUT
    SUT --> T["Captured trajectory<br/>turns, tool calls, SQL, results"]
    T --> S["Scorers"]
    S --> R["Reporting<br/>CSV, BigQuery, dashboards"]
```

| Concept | Agentic evaluation | NL2SQL evaluation |
|---|---|---|
| **Dataset** | Scenarios with a `starting_prompt`, `conversation_plan`, and `expected_trajectory` ([format](/docs/configs/agentic-dataset-config.md)) | Eval items with a prompt, golden SQL, and eval queries ([format](/docs/configs/dataset-config.md)) |
| **System under test** | An agent CLI or data agent, selected by `generator` in the [model config](/docs/configs/model-config.md) | A model plus a prompt generator |
| **Environment** | MCP servers, plugins, extensions, skills, or a fake MCP stub — inside a per-run sandbox | One or more [databases](/docs/configs/db-config.md), with optional setup/teardown for DML and DDL |
| **Interaction** | Multi-turn, driven by an LLM-based **simulated user** until the goal is met, a terminal state is reached, or `max_turns` is hit | Single-turn generation and execution; multi-turn interactive variants are available for data agents |
| **Scoring** | Trajectory matching, goal completion, hallucination and clarification behavior, latency, tokens, and cost | Exact/set match, executability, LLM rater, and multi-trial consistency |

Because both share a pipeline, features such as multi-trial runs, LLM judges, BigQuery reporting, and A/B experiment comparison work the same way for either.

---

## What you can evaluate

### Agents

| Agent | Generator | Orchestrator | Guide |
|---|---|---|---|
| Gemini CLI | `gemini_cli` | `agent` / `geminicli` | [Gemini CLI guide](/docs/gemini_cli_agent_testing.md) |
| Claude Code | `claude_code` | `agent` | [Claude Code guide](/docs/claude_code_agent_testing.md) |
| Codex CLI | `codex_cli` | `agent` | [Codex CLI guide](/docs/codex_cli_agent_testing.md) |
| Antigravity (agy) CLI | `agy_cli` | `agent` | [Antigravity CLI guide](/docs/agy_cli_agent_testing.md) |
| Conversational data agents | `dataagent` | `dataagent` / `interact` | [Data agent spec](/docs/dataagent_spec.md) |
| Custom agents over gRPC | `agent_grpc_proxy` | `agent` | [Agentic evaluations](/docs/agentic-evals.md#supported-agents) |

Agents are evaluated against the tools you give them, however those tools are delivered:

- **MCP servers** — remote HTTP/SSE or local stdio Model Context Protocol servers.
- **Plugins** — bundles installed from a git repo or local directory through each CLI's marketplace; may carry skills, MCP servers, or both.
- **Extensions** and **skills** — installed through each CLI's native mechanism.
- **Fake MCP** — a deterministic local stub for fast, offline testing of your harness and datasets without a real tool backend.

Every run is **sandboxed**: agents execute against an isolated home directory, so they never touch your local CLI settings and scenarios can run concurrently. See [Agentic evaluations](/docs/agentic-evals.md) for the execution model, sandboxing, and tool paradigms.

### NL2SQL and other generation tasks

- **NL2SQL** across DQL, DML, and DDL on multiple databases and dialects — see the [database config](/docs/configs/db-config.md) for the supported list.
- **Transform tooling** — compiling and running generated Dataform and dbt projects.
- **Custom tasks** — plug in your own Python scorer for anything else.

---

## Getting started

> *Note*: EvalBench requires Python 3.10 or higher and [**uv**](https://docs.astral.sh/uv/getting-started/installation/). Agent evaluations also need each CLI's runtime (for example, **Node.js and npm** for Gemini CLI) — see each agent's guide.

### 1. Install

**Option A — run with `uvx`, no clone needed.** EvalBench is published on PyPI as [`google-evalbench`](https://pypi.org/project/google-evalbench/). `uvx` downloads it into an isolated, cached environment and runs it in one step:

```bash
uvx google-evalbench --help
uvx google-evalbench --experiment_config=path/to/run_config.yaml
```

Paths inside the run config (model config, evalset, and so on) are resolved relative to the current directory, so run the command from the folder that holds your config files. To pin a release, use `uvx google-evalbench@<version>`. To keep the command installed, run `uv tool install google-evalbench` and then call `google-evalbench --experiment_config=...` directly.

**Option B — clone the repo.** Clone if you want to run the bundled examples under [datasets/](/datasets/) as-is (they reference other files in the repo), use the [viewer](#viewer), or contribute:

```bash
git clone git@github.com:GoogleCloudPlatform/evalbench.git
cd evalbench
uv sync
```

The examples below use the clone and `./evalbench/run.sh`, which wraps `uv run evalbench/evalbench.py --experiment_config="$EVAL_CONFIG"`.

### 2. Configure GCP authentication

The bundled examples use Gemini on Vertex AI — for the simulated user, LLM-based scorers, and NL2SQL generation. If gcloud is not installed already, follow the [gcloud installation guide](https://cloud.google.com/sdk/docs/install#installation_instructions), then:

```bash
gcloud auth application-default login

export EVAL_GCP_PROJECT_ID=your_project_id_here
export EVAL_GCP_PROJECT_REGION=your_region_here
```

### 3. Run your first agent evaluation

Start with Gemini CLI against a **fake MCP server**. It exercises the full agentic pipeline — simulated user, tool calls, trajectory capture, and scoring — without a real tool backend:

```bash
export EVAL_CONFIG=datasets/gemini-cli-tools/example_run_fake_config.yaml
./evalbench/run.sh
```

Read through [example_run_fake_config.yaml](/datasets/gemini-cli-tools/example_run_fake_config.yaml) and its [evalset](/datasets/gemini-cli-tools/gemini-cli-fake.evalset.json) to see how scenarios, the model config, and scorers fit together. Results are written to `results/`.

To evaluate a real agent against a real MCP server, switch to one of the ready-to-run configs under [datasets/gemini-cli-tools/](/datasets/gemini-cli-tools/), [datasets/claude-code-tools/](/datasets/claude-code-tools/), [datasets/codex-cli-tools/](/datasets/codex-cli-tools/), or [datasets/agy-cli-tools/](/datasets/agy-cli-tools/). For example:

```bash
export EVAL_CONFIG=datasets/claude-code-tools/example_run_config.yaml
./evalbench/run.sh
```

### 4. Run an NL2SQL evaluation &nbsp;&nbsp;[![Open In Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/github/GoogleCloudPlatform/evalbench/blob/main/docs/examples/sqlite_example.ipynb)

The same entry point runs NL2SQL — only the run config changes. This example generates and scores DQL queries against the `db_blog` dataset on a local SQLite database:

```bash
export EVAL_CONFIG=datasets/bat/example_run_config.yaml
./evalbench/run.sh
```

See [example_run_config.yaml](/datasets/bat/example_run_config.yaml) for the dataset, database, generation, and scorer settings used, and the [NL2SQL guide](/docs/nl2sql-evals.md) for query types, database setup, and reporting.

---

## Scoring

Scorers are enabled from the `scorers:` block of the run config, and agentic and NL2SQL scorers live in the same catalog. A typical agentic starting set:

```yaml
scorers:
  trajectory_matcher: {}
  turn_count: {}
  end_to_end_latency: {}
  token_consumption: {}
  goal_completion:
    model_config: datasets/model_configs/gemini_2.5_pro_model.yaml
  behavioral_metrics:
    model_config: datasets/model_configs/gemini_2.5_pro_model.yaml
```

| Family | Examples |
|---|---|
| [Agentic](/docs/scorers.md#agentic-scorers) | `trajectory_matcher`, `goal_completion`, `behavioral_metrics`, `parameter_analysis`, `binary_rubric_scorer`, `turn_count`, `agent_steps`, latency and token scorers |
| [Skills](/docs/scorers.md#skills-scorers) | `skills_trajectory`, `skills_best_practices` |
| [SQL](/docs/scorers.md#sql-scorers) | `exact_match`, `set_match`, `executable_sql`, `llmrater` |
| [Multi-trial consistency](/docs/scorers.md#multi-trial-consistency-scorers) | `exact_match_consistency`, `llm_consistency` |
| [Custom](/docs/scorers.md#custom-scorers) | `python_scorer` for your own judges |

LLM-judged scorers can optionally be given [tool access](/docs/judge_tools.md) instead of single-shot prompting.

---

## Reporting and dashboards

Every run — agentic or NL2SQL — writes to the reporters enabled in the `reporting:` block of the run config:

```yaml
reporting:
  csv:
    output_directory: 'results'
  bigquery:
    gcp_project_id: your_project_id_here
  gcs_artifacts:
    bucket: 'your-artifacts-bucket'
```

| Reporter | What you get |
|---|---|
| `csv` | A `results/<job_id>/` folder per run containing `configs.csv`, `evals.csv` (every scenario or eval item, including the full conversation and tool calls), `scores.csv` (one row per scorer per item, with the judge's explanation), and `summary.csv` (aggregate metrics). |
| `bigquery` | The same tables in BigQuery for long-term storage, cross-run analysis, and A/B experiment comparison. |
| `gcs_artifacts` | Each scenario's agent sandbox, zipped and uploaded to a GCS bucket so you can inspect exactly what the agent wrote and configured. |

### Viewer

The [viewer](/viewer/) is a local dashboard over your results directory, built for agent runs:

- **Status** — an overview of the latest runs, per agent.
- **List** — every run, with trajectory match, turn count, token usage, latency, goal completion, and an AI score. You can filter by product, dataset, or requester.
- **Conversations** — step through each scenario turn by turn (simulated user and agent), with each scorer's result and explanation next to it.
- **Charts** — metric trends across runs over time.
- **Compare** — pick two runs and get a Gemini-generated comparison of metrics, errors, and tool-call trajectories.

To run it from a cloned repo:

```bash
cd viewer
RESULTS_DIR=../results uv run mesop main.py
```

For BigQuery experiment reports on NL2SQL runs, such as A/B comparisons and breakdowns by database and dialect, see the [NL2SQL guide](/docs/nl2sql-evals.md#bigquery-experiment-reports).

---

## Documentation

Full reference documentation lives in [docs/](/docs/README.md).

| Doc | Contents |
|---|---|
| [Agentic evaluations](/docs/agentic-evals.md) | Execution model, sandboxing, and tool paradigms — start here |
| [Agentic dataset format](/docs/configs/agentic-dataset-config.md) | Scenarios, conversation plans, and expected trajectories |
| [Run config](/docs/configs/run-config.md) | The top-level YAML that drives every evaluation run |
| [Model config](/docs/configs/model-config.md) | Generator and model selection, and generation settings |
| [Scorers](/docs/scorers.md) | Every available scorer and its configuration options |
| [NL2SQL evaluations](/docs/nl2sql-evals.md) | How NL2SQL runs work, query types, database setup, and BigQuery experiment reports |
| [NL2SQL dataset format](/docs/configs/dataset-config.md) | Prompts, golden SQL, and eval queries |
| [Database config](/docs/configs/db-config.md) | Connection details and supported dialects |
| [Examples](/docs/examples/) | Runnable notebooks for SQLite, Cloud SQL, BigQuery, and Agent Runtime |

Contributions are welcome — see [contributing](/docs/contributing.md).
