Metadata-Version: 2.5
Name: calibrated-agent-evaluation
Version: 0.1.0
Summary: Error analysis and judge calibration for AI agents: certify an LLM judge against human labels, then gate CI on failure rates corrected for its error.
Project-URL: Homepage, https://github.com/awslabs/calibrated-agent-evaluation
Project-URL: Documentation, https://awslabs.github.io/calibrated-agent-evaluation/
Project-URL: Repository, https://github.com/awslabs/calibrated-agent-evaluation
Project-URL: Issues, https://github.com/awslabs/calibrated-agent-evaluation/issues
Project-URL: Changelog, https://github.com/awslabs/calibrated-agent-evaluation/blob/main/CHANGELOG.md
Author: Amazon Web Services
License-Expression: Apache-2.0
License-File: LICENSE
License-File: NOTICE
License-File: THIRD-PARTY-LICENSES
Keywords: agents,ai,error-analysis,evals,evaluation,inspect-ai,langfuse,llm
Classifier: Development Status :: 3 - Alpha
Classifier: Environment :: Console
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: Apache Software License
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Classifier: Programming Language :: Python :: 3.14
Classifier: Topic :: Software Development :: Testing
Classifier: Typing :: Typed
Requires-Python: >=3.11.5
Requires-Dist: pydantic<3,>=2.8
Provides-Extra: agentcore
Requires-Dist: bedrock-agentcore<2,>=1.24.2; extra == 'agentcore'
Requires-Dist: boto3<2,>=1.43.103; extra == 'agentcore'
Requires-Dist: botocore<2,>=1.43.103; extra == 'agentcore'
Requires-Dist: jinja2<4,>=3.1.6; extra == 'agentcore'
Requires-Dist: strands-agents-evals<1.7,>=1.6.0; extra == 'agentcore'
Requires-Dist: strands-agents<2,>=1.48; extra == 'agentcore'
Requires-Dist: urllib3!=2.2.0,<3,>=1.26.5; extra == 'agentcore'
Provides-Extra: bedrock
Requires-Dist: boto3<2,>=1.40; extra == 'bedrock'
Requires-Dist: inspect-ai<0.4,>=0.3.242; extra == 'bedrock'
Provides-Extra: datasets
Requires-Dist: pyarrow<25,>=17; extra == 'datasets'
Provides-Extra: hf
Requires-Dist: huggingface-hub<3,>=0.24; extra == 'hf'
Provides-Extra: inspect
Requires-Dist: inspect-ai<0.4,>=0.3.242; extra == 'inspect'
Provides-Extra: langfuse
Requires-Dist: langfuse<4,>=3.15; extra == 'langfuse'
Provides-Extra: otel
Requires-Dist: opentelemetry-proto<2,>=1.43; extra == 'otel'
Provides-Extra: probe
Requires-Dist: inspect-ai<0.3.288,>=0.3.242; extra == 'probe'
Requires-Dist: inspect-evals<0.15,>=0.14.3; extra == 'probe'
Provides-Extra: probe-ws
Requires-Dist: websockets<17,>=16; extra == 'probe-ws'
Provides-Extra: sampling
Requires-Dist: allpairspy<3,>=2.5; extra == 'sampling'
Provides-Extra: scorers
Requires-Dist: autoevals<1,>=0.3.0; extra == 'scorers'
Provides-Extra: stats
Requires-Dist: numpy<3,>=2.4; extra == 'stats'
Requires-Dist: scipy<2,>=1.15; extra == 'stats'
Requires-Dist: statsmodels<1,>=0.14; extra == 'stats'
Provides-Extra: strands
Requires-Dist: opentelemetry-exporter-otlp-proto-common<2,>=1.43; extra == 'strands'
Requires-Dist: opentelemetry-sdk<2,>=1.43; extra == 'strands'
Requires-Dist: strands-agents<2,>=1.48; extra == 'strands'
Provides-Extra: synth
Requires-Dist: strands-agents-evals<1.7,>=1.6.0; extra == 'synth'
Provides-Extra: ui
Requires-Dist: python-fasthtml<0.15,>=0.14; extra == 'ui'
Requires-Dist: starlette<2,>=1.3; extra == 'ui'
Requires-Dist: uvicorn<1,>=0.49; extra == 'ui'
Description-Content-Type: text/markdown

<p align="center">
  <picture>
    <source media="(prefers-color-scheme: dark)" srcset="https://raw.githubusercontent.com/awslabs/calibrated-agent-evaluation/v0.1.0/docs/site/content/assets/readme/banner-dark.svg">
    <img alt="Calibrated Agent Evaluation" src="https://raw.githubusercontent.com/awslabs/calibrated-agent-evaluation/v0.1.0/docs/site/content/assets/readme/banner-light.svg" width="100%">
  </picture>
</p>

<h3 align="center">Find out how often your AI agent fails, with a number you can defend.</h3>

<p align="center">
  <a href="https://pypi.org/project/calibrated-agent-evaluation/"><img alt="PyPI" src="https://img.shields.io/pypi/v/calibrated-agent-evaluation"></a>
  <a href="https://pypi.org/project/calibrated-agent-evaluation/"><img alt="Python versions" src="https://img.shields.io/pypi/pyversions/calibrated-agent-evaluation"></a>
  <a href="https://github.com/awslabs/calibrated-agent-evaluation/actions/workflows/ci.yml"><img alt="CI" src="https://img.shields.io/github/actions/workflow/status/awslabs/calibrated-agent-evaluation/ci.yml?branch=main&label=CI"></a>
  <a href="https://github.com/awslabs/calibrated-agent-evaluation/blob/v0.1.0/LICENSE"><img alt="License: Apache-2.0" src="https://img.shields.io/github/license/awslabs/calibrated-agent-evaluation"></a>
</p>

<p align="center">
  <a href="https://awslabs.github.io/calibrated-agent-evaluation/">Documentation</a> ·
  <a href="https://awslabs.github.io/calibrated-agent-evaluation/getting-started/quickstart/">Quickstart</a> ·
  <a href="https://awslabs.github.io/calibrated-agent-evaluation/guides/lifecycle/">Lifecycle guide</a> ·
  <a href="https://awslabs.github.io/calibrated-agent-evaluation/cli/">CLI reference</a> ·
  <a href="https://github.com/awslabs/calibrated-agent-evaluation/blob/v0.1.0/CONTRIBUTING.md">Contributing</a>
</p>

---

An LLM judge reports that 12% of your agent's runs fail. How wrong is the judge, and how wide is
that 12% once you count its mistakes? Calibrated Agent Evaluation answers both questions. It takes
your agent's traces through error analysis, certifies a judge against human labels, corrects the
measured failure rate for the judge's own error, and gates CI on the interval's lower bound.

It grades what the agent did (a normalized trace), so a custom loop, an LLM with MCP tools, a
Strands agent and a multi-agent crew all go through the same pipeline. It is a library and CLI you
run yourself, offline on a laptop or inside a corporate network. There is no hosted service.

## What it checks that a raw judge score skips

- **Judge certification.** A judge is certified only when the 95% lower bounds on both its
  true-positive and true-negative rates reach 0.80, measured on gold labels that are used once.
- **Corrected failure rates.** The judge's measured rate is corrected for its error
  (Rogan–Gladen), with an interval that carries the uncertainty of the human gold and the judge.
  The correction is refused when the judge is too close to chance.
- **Enough labels.** Good–Turing coverage tells you when labeling has stopped finding new failure
  modes, and a planner sizes the gold set and the CI sample before you start.
- **Fixes that held.** A fix is accepted against a target registered before the change, with
  McNemar tests and a Holm-corrected panel of guard metrics.
- **Crews.** In a multi-agent run, the span that caused a failure is kept apart from the span
  where it showed.

It does not label traces for you (a human writes the gold) and it never gates on subjective
qualities such as tone. `calibrated-agent-evaluation prefer` ranks those instead.

## Install

```bash
pip install calibrated-agent-evaluation
```

Or `uv add calibrated-agent-evaluation`, or `uv tool install calibrated-agent-evaluation` for the
CLI alone. Python 3.11.5 or later. The base install depends only on pydantic. Everything that needs
a third-party package is an opt-in extra:

```bash
pip install "calibrated-agent-evaluation[ui,stats,langfuse]"
```

| Extra       | Adds                                                                  |
| ----------- | --------------------------------------------------------------------- |
| `ui`        | the trace-review web app for human labeling                           |
| `stats`     | judge calibration, corrected rates and failure-mode clustering        |
| `langfuse`  | Langfuse as the trace store                                           |
| `inspect`   | Inspect AI logs, agents and judge models                              |
| `strands`   | running and capturing Strands agents                                  |
| `bedrock`   | Amazon Bedrock input generation and embeddings                        |
| `agentcore` | the Amazon Bedrock AgentCore plug-in                                  |

`calibrated-agent-evaluation doctor` lists what is installed. The full set is in the
[installation guide](https://awslabs.github.io/calibrated-agent-evaluation/getting-started/installation/).

## Quickstart

The bundled sample corpus runs end to end in a temporary directory, with no keys or network:

```console
$ calibrated-agent-evaluation quickstart
Seeded 6 agent traces + 9 gold labels into an offline local store

First-pass result: 5 of 6 traces have a labeled failure.
Failure modes found:
    - trusted_broken_policy_tool: 2
    - dropped_material_fact: 1
    - misread_amount: 1
    - vacancy_threshold_margin_mishandled: 1
```

`calibrated-agent-evaluation quickstart --certify` goes further. It seeds 848 traces and writes a
judge kit with recorded model replies, then prints the commands that certify the judge, run its
bias battery and gate CI, all offline. Then bring your own traces from
OpenTelemetry (OpenInference or OpenLLMetry), Inspect AI, Strands, Langfuse, JSONL or Parquet:
[choose your integration path](https://awslabs.github.io/calibrated-agent-evaluation/integrate/).

## How it works

<p align="center">
  <picture>
    <source media="(prefers-color-scheme: dark)" srcset="https://raw.githubusercontent.com/awslabs/calibrated-agent-evaluation/v0.1.0/docs/site/content/assets/readme/pipeline-dark.svg">
    <img alt="The pipeline in order: probe, define, generate, label and cluster for error analysis; calibrate and bias as the two trust gates; judge and run for scoring; improve to test a fix" src="https://raw.githubusercontent.com/awslabs/calibrated-agent-evaluation/v0.1.0/docs/site/content/assets/readme/pipeline-light.svg" width="100%">
  </picture>
</p>

Each stage is one subcommand, run in this order. Error analysis comes first: you look at real
traces, label them, and name the failure modes before anything is scored. A judge then has to pass
both trust gates before `judge` will run it, and `run` fails the build when a failure mode's
pass-rate 95% lower bound falls below the threshold. The
[stage map](https://awslabs.github.io/calibrated-agent-evaluation/concepts/stage-map/) covers each
stage, and
[how the numbers work](https://awslabs.github.io/calibrated-agent-evaluation/concepts/how-the-numbers-work/)
explains the statistics, with every method cited.

## Skills plugin

`skills/` is a Claude Code and Kiro plugin that helps a coding agent drive the pipeline: it drafts
the taxonomy, the judge prompt or the review session, then hands off to the CLI command that
enforces the gate. Load it for one session with `claude --plugin-dir <path-to-checkout>`, or
install it from inside Claude Code:

```text
/plugin marketplace add <path-to-checkout>
/plugin install calibrated-agent-evaluation@calibrated-agent-evaluation
```

For Kiro, see [`skills/README.md`](https://github.com/awslabs/calibrated-agent-evaluation/blob/v0.1.0/skills/README.md).

## Documentation

- [Why calibrate](https://awslabs.github.io/calibrated-agent-evaluation/why/) and
  [how it compares with alternatives](https://awslabs.github.io/calibrated-agent-evaluation/why/alternatives/)
- [The lifecycle guide](https://awslabs.github.io/calibrated-agent-evaluation/guides/lifecycle/),
  from defining behavior to gating in production
- [Calibrate a judge](https://awslabs.github.io/calibrated-agent-evaluation/guides/calibrate-a-judge/)
  and [gate a pull request in CI](https://awslabs.github.io/calibrated-agent-evaluation/guides/gate-in-ci/)
- [Methods and citations](https://awslabs.github.io/calibrated-agent-evaluation/concepts/methodology/)
- [Python API](https://awslabs.github.io/calibrated-agent-evaluation/reference/) and
  [CLI](https://awslabs.github.io/calibrated-agent-evaluation/cli/) reference

The project is at 0.1.0. Before 1.0, a minor release may change the API
([versioning policy](https://awslabs.github.io/calibrated-agent-evaluation/versioning/)).

## Contributing

[CONTRIBUTING.md](https://github.com/awslabs/calibrated-agent-evaluation/blob/v0.1.0/CONTRIBUTING.md) covers the development setup, the code layout and the checks a
change must pass (`just check`). Coding agents should read [AGENTS.md](https://github.com/awslabs/calibrated-agent-evaluation/blob/v0.1.0/AGENTS.md).

## Security

See [CONTRIBUTING](https://github.com/awslabs/calibrated-agent-evaluation/blob/v0.1.0/CONTRIBUTING.md#security-issue-notifications) for how to report a security
issue, and [SECURITY.md](https://github.com/awslabs/calibrated-agent-evaluation/blob/v0.1.0/SECURITY.md) for the security policy and the security model.

## License

This project is licensed under the Apache-2.0 License. See [LICENSE](https://github.com/awslabs/calibrated-agent-evaluation/blob/v0.1.0/LICENSE) and
[NOTICE](https://github.com/awslabs/calibrated-agent-evaluation/blob/v0.1.0/NOTICE). Vendored code and third-party fixture data are listed with their copyright
notices and full license texts in [THIRD-PARTY-LICENSES](https://github.com/awslabs/calibrated-agent-evaluation/blob/v0.1.0/THIRD-PARTY-LICENSES).
