Metadata-Version: 2.5
Name: agent-benchmark-suite
Version: 0.1.0
Summary: Unified, reproducible benchmark harness for agentic AI: token compression, provenance verification, Pareto routing, and zero-trust policy enforcement leaderboards
Project-URL: Homepage, https://github.com/Sandeep-Hipparagi/agent-benchmark-suite
Project-URL: Repository, https://github.com/Sandeep-Hipparagi/agent-benchmark-suite
Author: Sandeep Hipparagi
License: MIT
License-File: LICENSE
Keywords: agentic-ai,benchmark,context-compression,leaderboard,llm-evaluation,llmops,model-routing,policy-enforcement,provenance,reproducibility
Classifier: Development Status :: 4 - Beta
Classifier: Intended Audience :: Developers
Classifier: Intended Audience :: Science/Research
Classifier: License :: OSI Approved :: MIT License
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Topic :: Scientific/Engineering :: Information Analysis
Classifier: Topic :: Software Development :: Testing
Requires-Python: >=3.11
Requires-Dist: rich>=13.7
Requires-Dist: typer>=0.12
Provides-Extra: dev
Requires-Dist: mypy>=1.10; extra == 'dev'
Requires-Dist: pytest>=8.0; extra == 'dev'
Requires-Dist: ruff>=0.6; extra == 'dev'
Provides-Extra: native
Requires-Dist: agent-snr>=0.1.1; extra == 'native'
Requires-Dist: context-guards>=0.1.0; extra == 'native'
Requires-Dist: pareto-router>=0.1.2; extra == 'native'
Requires-Dist: provenance-guard>=0.2.1; extra == 'native'
Description-Content-Type: text/markdown

﻿# agent-benchmark-suite

**One command. Five flagship agent libraries. Reproducible leaderboards.**

A unified benchmark harness that measures what agentic-AI libraries actually
claim — token compression, provenance catch-rate, routing Pareto coordinates,
and zero-trust policy enforcement — against **seeded, SHA-256-digested
workloads**, with **CI-enforced drift checks (≤ 3%)** so committed numbers can
never silently rot.

```mermaid
flowchart LR
    W[Seeded workloads\n120 traces · 150 claims · 120 probes] -->|SHA-256 digest| R[Runner\nwarmups · N-run median + IQR]
    R --> A1[Compression\nagent-snr · context-guard · reference]
    R --> A2[Provenance\nprovenance-guard · reference]
    R --> A3[Routing\npareto-router · reference]
    R --> A4[Policy\naegis-core · reference]
    A1 --> L[Leaderboards\nJSON + Markdown]
    A2 --> L
    A3 --> L
    A4 --> L
    L --> V{verify-leaderboard\ndrift ≤ 3% or digest bump}
    V -->|pass| CI[Green CI]
    V -->|fail| X[Red CI]
```

## Benchmarked flagships

| Library | Capability | Adapter |
| :--- | :--- | :--- |
| [`agent-snr`](https://github.com/Sandeep-Hipparagi/agent-snr) | SNR-gated context firewall | `AgentSNRCompressionAdapter` (in-process) |
| [`context-guard`](https://github.com/Sandeep-Hipparagi/context-guard) | State-ledger context compression | `ContextGuardCompressionAdapter` (in-process) |
| [`epistemic-guard`](https://github.com/Sandeep-Hipparagi/epistemic-guard) (`provenance-guard` on PyPI) | Deterministic source tiering | `ProvenanceGuardAdapter` (in-process) |
| [`Inference-Pareto-Router`](https://github.com/Sandeep-Hipparagi/Inference-Pareto-Router) | 2D cost/quality Pareto routing | `ParetoRouterAdapter` (in-process) |
| [`aegis-core`](https://github.com/Sandeep-Hipparagi/aegis-core) | Zero-trust schema/policy gate | `AegisCoreAdapter` (Node subprocess on built dist) |

Every capability also ships a **reference adapter** — a real, deterministic
in-process engine that executes the same algorithmic contract (it computes
genuine ratios, precision/recall, and gate decisions per item; nothing is
hardcoded). Native adapters are wired via optional extras and report
themselves honestly unavailable when the flagship library is not installed —
they never fabricate results.

## Baseline leaderboards (generated, CI-verified)

Run with `--seed 42`, 120 traces / 150 claims / 120 probes, reference mode.
Full tables: [`benchmarks/leaderboards/LEADERBOARD.md`](benchmarks/leaderboards/LEADERBOARD.md).

### compress — 46.8% of corpus tokens eliminated

| Adapter | Implementation | Tokens before | Tokens after | Compression ratio | Keyword retention |
| :--- | :--- | ---: | ---: | ---: | ---: |
| `reference-compactor` | reference | 21428 | 11406 | 0.467706 | 0.658513 |

### provenance — 150 claims, tiers 1–5, 30% TLD-fallback URLs

| Adapter | Implementation | Precision (citable) | Recall (citable) | Exact-tier accuracy | Tier MAE |
| :--- | :--- | ---: | ---: | ---: | ---: |
| `reference-tierer` | reference | 1.0 | 1.0 | 1.0 | 0.0 |

### route — 120 Pareto decisions across 3 strategy presets

| Adapter | Implementation | Tier distribution | Mean effort score |
| :--- | :--- | :--- | ---: |
| `reference-pareto` | reference | FRONTIER 30 · MID 62 · COMPACT 28 | 0.406958 |

### policy — 120 probes (50% adversarial)

| Adapter | Implementation | Bypass resistance | Benign pass rate |
| :--- | :--- | ---: | ---: |
| `reference-policy-gate` | reference | 1.0 | 1.0 |

Latency medians are measured every run and reported in the JSON leaderboards,
but are intentionally **excluded from drift verification** — they are
environment-specific. Functional metrics are byte-deterministic per workload
digest.

## Native vs. reference results (real flagship libraries, locally executed)

Running `--mode native` with the actual libraries installed (agent-snr,
context-guard, provenance-guard, pareto-router, and aegis-core's compiled
`SchemaValidator` dist) produces [`benchmarks/leaderboards/NATIVE_LEADERBOARD.md`](benchmarks/leaderboards/native/NATIVE_LEADERBOARD.md)
and [`native_results.json`](benchmarks/leaderboards/native_results.json). Key findings
from the captured run — reported exactly as measured, including the unfavorable one:

### compress (21,428 tokens in)

| Adapter | Implementation | Tokens after | Ratio | Keyword retention |
| :--- | :--- | ---: | ---: | ---: |
| `context-guard/compressor` | native | 12,846 | **0.4005** | **0.7252** |
| `reference-compactor` | reference | 11,406 | 0.4677 | 0.6585 |
| `agent-snr/firewall` | native | 25,380 | **−0.1844** | 0.6147 |

Honest finding: `agent-snr` **expanded** this corpus (ratio < 0). Its SNR
firewall optimizes signal quality (loop detection, correction nudges, budget
packing), not raw token minimization — on a redundancy-heavy synthetic corpus
it adds content rather than dropping it. The harness reports this verbatim.

### provenance (150 claims) — native vs. ground truth

| Adapter | Precision | Recall | Exact-tier | MAE |
| :--- | ---: | ---: | ---: | ---: |
| `provenance-guard/auditor` (native) | 1.0 | 0.9552 | 0.8267 | 0.1733 |
| `reference-tierer` | 1.0 | 1.0 | 1.0 | 0.0 |

The native library agrees on every citable decision (precision 1.0) but
disagrees on some exact tier assignments for unlisted TLD-fallback domains —
exactly the kind of divergence the harness exists to surface.

### route — native and reference in exact agreement

`pareto-router` native decisions match the reference port byte-for-byte
(FRONTIER 30 · MID 62 · COMPACT 28, mean effort 0.406958, 120/120 decisions) —
strong evidence the reference port is faithful.

### policy — both fail-closed

`aegis-core`'s compiled `SchemaValidator` and the reference gate both achieve
bypass resistance 1.0 with benign pass rate 1.0 (120 probes, 50% adversarial).

Reproduce natively:

```bash
pip install -e ".[native]"                      # flagship libraries
agent-bench run --suite all --mode native --output-dir benchmarks/leaderboards/native
```

## Quickstart

```bash
pip install -e .[dev]

# 1. Run every suite and write JSON + Markdown leaderboards
agent-bench run --suite all

# 2. Verify a committed leaderboard against a fresh deterministic run
agent-bench verify-leaderboard benchmarks/leaderboards/compress.json

# 3. CI mode: run + self-verify drift in one step (fails the build on drift)
agent-bench run --suite all --check-drift
```

Run the *real flagship libraries* natively (in-process Python, Node subprocess
for aegis-core):

```bash
pip install -e .[native]
agent-bench run --suite all --mode native
```

The aegis-core native adapter additionally requires Node.js and a built
checkout: `AEGIS_CORE_PATH=/path/to/aegis-core` (with `dist/core/src/index.js`
present). Without it the adapter reports unavailable and is skipped — with an
honest implementation column in the leaderboard, never a fabricated row.

## How reproducibility is enforced

1. **Workload digests** — every suite hashes its full corpus (canonical JSON,
   SHA-256) into the leaderboard. Example:
   `compress@42390cd9…`, `provenance@d56bd825…`, `policy@28fce33e…`.
2. **Drift gate** — `verify-leaderboard` re-runs the suite and compares every
   functional metric; drift > 3% fails CI.
3. **Digest bumps are explicit** — changing a workload without bumping the
   digest fails; the committed JSON must acknowledge `digest_bumped: true`.
4. **Determinism** — generators are pure functions of their seed; no wall
   clock, no unseeded randomness, no network in scoring paths.

## Development

```bash
ruff check . && ruff format --check .   # lint + format
mypy --strict src tests                 # full strict typing
pytest                                  # 85 tests
agent-bench verify-leaderboard benchmarks/leaderboards/policy.json
```

See [CONTRIBUTING.md](.github/CONTRIBUTING.md) for adapter guidelines and
[SECURITY.md](.github/SECURITY.md) for reporting policy.

## License

MIT — see [LICENSE](LICENSE).
