Skip to main content

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.

PyPI version License: MIT Python 3.9+ CI


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 4 for 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


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

agenttest_py-0.1.0.tar.gz (16.4 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

agenttest_py-0.1.0-py3-none-any.whl (18.7 kB view details)

Uploaded Python 3

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

Hashes for agenttest_py-0.1.0.tar.gz
Algorithm Hash digest
SHA256 c0402b7f5409830d1e193d4825d882fad1803777c3995b1a2338ea69f8aad8ee
MD5 416ca921a90d16ffda7262d0ee926a85
BLAKE2b-256 dffa4b8b5c99964e42cf8c75ef29fb5b0904823f21565f2b0f47d28a5223aaf2

See more details on using hashes here.

Provenance

The following attestation bundles were made for agenttest_py-0.1.0.tar.gz:

Publisher: publish.yml on ShashStudios/agenttest

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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

Hashes for agenttest_py-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 fb90997009a6e1c0544642120ac44ca8559af4e28a65e38005dace888de56908
MD5 710eb6405790538ec71a067c5857ec35
BLAKE2b-256 4c028fe97d93ad020059dd3deda3c67e73dc10baa264f6c2bc5c77c829625e7e

See more details on using hashes here.

Provenance

The following attestation bundles were made for agenttest_py-0.1.0-py3-none-any.whl:

Publisher: publish.yml on ShashStudios/agenttest

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page