agentest

Evals for agentic AI: questions developers ask

Source code, tutorials and issues: github.com/srpadmanabhuni/agentest · PyPI: agentest-ai

Evals for agentic AI are repeatable tests of what an AI agent did: the tools it called, the arguments it passed, the order it acted in, and the state it left behind, not only the text it replied with. This page gives short answers to the questions developers ask when they start building them, using AiEnsured agentest, an Agentic AI Testing platform.

agentest is open source (Apache-2.0), offline and deterministic. It runs 165 tests over OpenTelemetry GenAI traces, A2A AgentCards and MCP tool lists, with no LLM judge in the pass/fail path. Built by Dr Srinivas Padmanabhuni, CTO and co-founder of testAIng.com / AiEnsured.

pip install agentest-ai

The package name is agentest-ai; the import and the command stay agentest. Python 3.11 or newer.

What are evals for agentic AI?

Evals for agentic AI are repeatable tests that grade an agent's behaviour across a whole run: the tools it called, the arguments it passed, the order it acted in, and the state it left behind, not only the text it replied with. An agentic eval records the run as a trace and grades two things: the transcript (tool calls, arguments, results) and the outcome (the environment state at the end).

How do I test an AI agent in Python?

Record the run, then assert on the record. With agentest the record is an OpenTelemetry GenAI trace file, or a trace you build inside the test with agentest.record(). assert_passes raises when a check fails and names the check and the evidence. A check with no evidence in the trace is reported as n/a, never as a silent pass.

import agentest

with agentest.record("shop", input_text="Add the mug") as rec:
    rec.tool("add_to_cart", {"sku": "mug"}, {"ok": True}, reason="the user asked for the mug")
    rec.answer("Added the mug.")

result = rec.check()
agentest.assert_passes(result)

How do I evaluate a tool-calling agent?

Judge the tool calls in the trace, not the reply. T5-001 checks that only allowlisted tools were invoked. T1-018 checks that the API success flag matches the terminal outcome, so an answer cannot claim success the trace did not earn. T1-005 checks that a run with a failed or denied tool step is not reported as a success. T6-003 checks that an entity id stays bound to the same entity across turns. T4-001, T4-003 and T4-007 check that instructions planted in documents, email or ticket bodies, or mismatched markdown links are not followed.

agentest std run --otlp my_traces.otlp.jsonl --ids T1-018,T5-001 --format md

How do I use pytest to test an AI agent?

The agentest-ai package ships a pytest plugin. Mark a test with the trace and the checks that must pass. A failure prints the check, what it asserts and the evidence.

import pytest

@pytest.mark.agentest(trace="traces/refund.otlp.jsonl", checks=["T1-005", "T1-018"])
def test_refund_run():
    pass

How do I evaluate an agent from OpenTelemetry traces?

Export the run as OpenTelemetry GenAI spans (invoke_agent, execute_tool and model calls), then point agentest at the file. The same traces always give the same verdicts, because nothing is sampled and no model is called.

agentest std run --otlp my_traces.otlp.jsonl

Do I need an LLM judge to evaluate an agent?

Not for behaviour that can be written as a rule: which tools ran, in what order, with which arguments, with what approvals, and what the final state was. Those checks are cheaper, faster and repeatable. Tone, helpfulness and other subjective quality still need a rubric, a model judge or a human reviewer, and agentest does not grade them. Use rule checks as the release gate and add judged quality checks next to them.

How do I run agent evals in CI?

Run agentest with --strict, which exits with status 1 when any check fails. JUnit and SARIF reports are supported. In GitHub Actions, use srpadmanabhuni/agentest-action@v1 with otlp: traces/*.otlp.jsonl.

agentest std run --otlp traces/*.otlp.jsonl --format junit --out agentest.xml --strict

How do I evaluate LangGraph, CrewAI, OpenAI Agents SDK, Pydantic AI or Google ADK agents?

agentest reads the trace, so it does not depend on the framework that produced it. Each of LangGraph, CrewAI, OpenAI Agents SDK, Pydantic AI, Google ADK, MCP and A2A has a recorded-run page in the docs that works offline.

What does agentest not do?

It does not call or score a model, it does not rank models, and a passing run is not a certification or a compliance determination. It needs a recorded trace, so an agent you cannot instrument cannot be judged.

Try it on your own agent

pip install agentest-ai
agentest demo

Run it on a trace from your own agent and tell us what it caught or missed in GitHub Discussions. Related: What are agentic evals? · this page in the repository.