The pytest of AI agents. Eval-driven testing for LLM applications.
Project description
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
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file agenttest_py-0.1.0.tar.gz.
File metadata
- Download URL: agenttest_py-0.1.0.tar.gz
- Upload date:
- Size: 16.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
c0402b7f5409830d1e193d4825d882fad1803777c3995b1a2338ea69f8aad8ee
|
|
| MD5 |
416ca921a90d16ffda7262d0ee926a85
|
|
| BLAKE2b-256 |
dffa4b8b5c99964e42cf8c75ef29fb5b0904823f21565f2b0f47d28a5223aaf2
|
Provenance
The following attestation bundles were made for agenttest_py-0.1.0.tar.gz:
Publisher:
publish.yml on ShashStudios/agenttest
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
agenttest_py-0.1.0.tar.gz -
Subject digest:
c0402b7f5409830d1e193d4825d882fad1803777c3995b1a2338ea69f8aad8ee - Sigstore transparency entry: 1008365777
- Sigstore integration time:
-
Permalink:
ShashStudios/agenttest@bf3e5a335a4a8d06342cb7a021059b303b5caebd -
Branch / Tag:
refs/tags/v0.1.0 - Owner: https://github.com/ShashStudios
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@bf3e5a335a4a8d06342cb7a021059b303b5caebd -
Trigger Event:
push
-
Statement type:
File details
Details for the file agenttest_py-0.1.0-py3-none-any.whl.
File metadata
- Download URL: agenttest_py-0.1.0-py3-none-any.whl
- Upload date:
- Size: 18.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
fb90997009a6e1c0544642120ac44ca8559af4e28a65e38005dace888de56908
|
|
| MD5 |
710eb6405790538ec71a067c5857ec35
|
|
| BLAKE2b-256 |
4c028fe97d93ad020059dd3deda3c67e73dc10baa264f6c2bc5c77c829625e7e
|
Provenance
The following attestation bundles were made for agenttest_py-0.1.0-py3-none-any.whl:
Publisher:
publish.yml on ShashStudios/agenttest
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
agenttest_py-0.1.0-py3-none-any.whl -
Subject digest:
fb90997009a6e1c0544642120ac44ca8559af4e28a65e38005dace888de56908 - Sigstore transparency entry: 1008365779
- Sigstore integration time:
-
Permalink:
ShashStudios/agenttest@bf3e5a335a4a8d06342cb7a021059b303b5caebd -
Branch / Tag:
refs/tags/v0.1.0 - Owner: https://github.com/ShashStudios
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@bf3e5a335a4a8d06342cb7a021059b303b5caebd -
Trigger Event:
push
-
Statement type: