agenttest
The pytest of AI agents. Catch regressions before they reach prod.
You ship an agent. You change a prompt. Did it get better or worse?
You have no idea. No test suite. No CI. No diff. Just deploy and hope.
Every team shipping AI agents hits the same wall: your "eval" is manually pasting examples into a playground. One prompt tweak could break everything—or fix everything—and you won't know until a user complains.
30-Second Quickstart
pip install agenttest-py
export ANTHROPIC_API_KEY=your_key
agenttest init
agenttest run
Or from scratch:
# agent_test_example.py
from agenttest import eval, judge
def my_agent(query: str) -> str:
return "Your agent's response" # Replace with real agent
@eval
def test_customer_support():
response = my_agent("I want a refund")
assert judge.tone(response) == "empathetic"
assert judge.no_hallucination(response)
agenttest run
Features
- Code-first — Tests are just Python. No YAML. No config hell.
- LLM-as-judge — 9 built-in scorers: tone, hallucination, relevance, toxicity, faithfulness, conciseness, custom criteria, A/B compare.
- Local & CI — Runs anywhere. Add 4 lines to GitHub Actions. No account. No dashboard.
agenttest diff— Side-by-side view of how your agent's responses changed between two runs. The git diff for agent behavior.- Caching — Judge results cached in
.agenttest_cache/to avoid redundant API calls. - Parallel —
--workers 4for faster runs.
agenttest diff — The Git Diff for Agent Behavior
See exactly how your agent's responses changed between two runs:
agenttest run --tag v1 # Before your prompt change
agenttest run --tag v2 # After your prompt change
agenttest diff v1 v2
test_customer_support_refund:
BEFORE: "I cannot help with refunds" pass
AFTER: "I'd be happy to process that for you" pass
DELTA: ✓ improved
test_helpful_tone:
BEFORE: "Our policy states no returns" fail
AFTER: "I'm sorry to hear that. Let me help" pass
DELTA: +1 ↑
Judge Functions
| Function | Returns | Description |
|---|---|---|
judge.tone(response) |
str |
empathetic, professional, aggressive, neutral |
judge.no_hallucination(response, context?) |
bool |
True if no hallucination |
judge.contains_action(response, action) |
bool |
Response mentions/implies the action |
judge.relevance(response, query) |
float |
0.0–1.0 relevance |
judge.toxicity(response) |
bool |
True if toxic |
judge.faithfulness(response, source) |
float |
0.0–1.0 faithfulness |
judge.conciseness(response) |
str |
too_short, good, too_long |
judge.score(response, criteria) |
float |
Custom 0.0–1.0 score |
judge.compare(a, b, criteria) |
str |
"a", "b", or "tie" |
CI in 4 Lines
# .github/workflows/agenttest.yml
- run: pip install agenttest-py-py
- run: agenttest run
env:
ANTHROPIC_API_KEY: ${{ secrets.ANTHROPIC_API_KEY }}
Every PR shows whether your agent got better or worse.
agenttest vs Braintrust / DeepEval / Promptfoo
| agenttest | Braintrust | DeepEval | Promptfoo | |
|---|---|---|---|---|
| No account required | ✅ | ❌ | ❌ | ❌ |
| No vendor lock-in | ✅ | ❌ | ❌ | ❌ |
| Lives in your codebase | ✅ | ❌ | ❌ | ❌ |
| Behavior diff (before/after) | ✅ | ❌ | ❌ | ❌ |
| Runs locally | ✅ | ✅ | ✅ | ✅ |
| MIT License | ✅ | ❌ | ❌ | ✅ |
| Code-first API | ✅ | ⚠️ | ⚠️ | ⚠️ |
agenttest = pytest for agents. No dashboards. No SaaS. Your tests, your repo, your CI.
Config
# agenttest.toml
[agenttest]
model = "claude-3-5-haiku-latest"
timeout_seconds = 30
workers = 4
fail_threshold = 0.8
cache = true
[agenttest.env]
ANTHROPIC_API_KEY = "$ANTHROPIC_API_KEY"
Contributing
See CONTRIBUTING.md.
License
MIT
Release files for agenttest-py 0.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| agenttest_py-0.1.0.tar.gz | 16.4 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| agenttest_py-0.1.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 35.1 kB
Release files / agenttest_py-0.1.0.tar.gz
| Download URL | agenttest_py-0.1.0.tar.gz |
|---|---|
| Size | 16.4 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
c0402b7f5409830d1e193d4825d882fad1803777c3995b1a2338ea69f8aad8ee
|
|
BLAKE2b-256 checksum How to use checksums |
dffa4b8b5c99964e42cf8c75ef29fb5b0904823f21565f2b0f47d28a5223aaf2
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.7
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Mar 2, 2026.
Transparency logRelease files / agenttest_py-0.1.0-py3-none-any.whl
| Download URL | agenttest_py-0.1.0-py3-none-any.whl |
|---|---|
| Size | 18.7 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
fb90997009a6e1c0544642120ac44ca8559af4e28a65e38005dace888de56908
|
|
BLAKE2b-256 checksum How to use checksums |
4c028fe97d93ad020059dd3deda3c67e73dc10baa264f6c2bc5c77c829625e7e
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.7
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Mar 2, 2026.
Transparency log