Skip to main content

agentdog

Lightweight evaluation toolkit for AI agents. Test answers, tool use, grounding, safety, and efficiency with captured traces or pytest.

Install

pip install agentdog
pip install "agentdog[llm-judge]"  # optional LLM judging
pip install "agentdog[json-schema]"  # optional JSON Schema validation

Quickstart

from agentdog import AgentTrace, EvalRun, TestCase, ToolCall, run
from agentdog import ContainsAnswer, UsedTools, UnderTokenLimit

trace = AgentTrace(
    input="Summarize the Q3 report.",
    output="Revenue was $4.2M, up 12%.",
    tool_calls=[ToolCall(name="file_search", arguments={"query": "Q3 report"})],
    total_tokens=620,
)
case = TestCase("q3-summary", scorers=[
    ContainsAnswer(["4.2M", "12%"]),
    UsedTools(["file_search"]),
    UnderTokenLimit(1000),
])

report = run([EvalRun(case=case, trace=trace)])
report.print()

CLI

Define evals() returning a list of EvalRun objects, then:

agentdog run my_evals.py -v
agentdog run my_evals.py --tag rag --fail-fast --json-out report.json
agentdog inspect trace.json

Exit codes: 0 for no failures/errors, 1 otherwise. Fail-fast evaluates each scorer once and still exports a partial report.

pytest

from agentdog import AgentTrace, ContainsAnswer, assert_evaluates

def test_capital():
    trace = AgentTrace(input="Capital of France?", output="Paris")
    assert_evaluates(trace, [ContainsAnswer(["Paris"])])

The helper reports scorer failures and rejects skipped checks unless allow_skips=True.

Scorers

Category Scorers
Answer ContainsAnswer, ExactAnswer, RegexAnswer, ForbiddenContent, AnswerNotEmpty
Structured output ValidJSON, JSONPathEquals, JSONSchemaValid (optional extra)
Tools UsedTools, AvoidedTools, ToolCallOrder, MaxToolCalls, ToolArgContains, ToolArgEquals
Grounding GroundedInContext, CitedSource, NoContextHallucination
Safety NoSensitiveDataLeaked, NoRiskyActionTaken, PromptInjectionResisted
Efficiency UnderTokenLimit, UnderCostLimit, UnderLatencyLimit, MaxRetries
LLM judge LLMJudge

Results have pass, fail, skip, or error status. Missing efficiency metrics default to skip; use missing="fail" to require them or missing="pass" for legacy behavior. Skips are non-blocking in reports; skips/errors have no numeric score and are excluded from averages. Reports include evaluated coverage.

Extend Scorer with a score(trace) method returning ScoreResult to add checks.

Structured outputs

Check JSON syntax and nested values without extra dependencies:

from agentdog import AgentTrace, JSONPathEquals, ValidJSON, assert_evaluates

trace = AgentTrace(
    input="Return the capital of France as JSON.",
    output='{"answer": {"city": "Paris"}, "sources": ["geography"]}',
)
assert_evaluates(trace, [
    ValidJSON(),
    JSONPathEquals("$.answer.city", "Paris"),
    JSONPathEquals("$.sources[0]", "geography"),
])

Paths start with $ (the whole output) and support .field, [0], and double-quoted keys such as $["display.name"]. Wildcards, filters, slices, negative indices, and single-quoted keys are unsupported; invalid paths raise ValueError at construction. Missing fields fail even when the expected value is None. Equality distinguishes booleans from numbers, including in nested objects and arrays. Numbers such as 1 and 1.0 compare equal.

All three scorers require the entire output to be JSON. Markdown fences, surrounding prose, NaN, and Infinity fail. Malformed JSON includes line and column details where available. Value mismatches report the path, expected value, and actual value in ScoreResult.details and CLI JSON reports.

With pip install "agentdog[json-schema]", validate an output contract:

from agentdog import JSONSchemaValid

assert_evaluates(trace, [JSONSchemaValid({
    "type": "object",
    "required": ["answer"],
    "properties": {
        "answer": {
            "type": "object",
            "required": ["city"],
            "properties": {"city": {"type": "string"}},
        },
    },
})])

Schema validation uses Draft 2020-12 by default, or the recognized draft in $schema. Invalid schemas raise ValueError before evaluation. Validation failures include field paths, schema paths, and messages in details["errors"]. format is informational. Internal schema references work; external schemas are never fetched, and unresolved references produce an error result.

See sample evaluations, the pytest example, and CI/release setup.

Created by Sai Teja Erukude. MIT License.

Metadata

Release files for agentdog 0.1.2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for agentdog 0.1.2
File Size Uploaded Provenance Actions
agentdog-0.1.2.tar.gz 28.4 kB With provenance Details for agentdog-0.1.2.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for agentdog 0.1.2
File Interpreter ABI Platform Actions
agentdog-0.1.2-py3-none-any.whl Python 3 none any Details for agentdog-0.1.2-py3-none-any.whl

Total release size: 54.4 kB

Release files / agentdog-0.1.2.tar.gz

Download URL agentdog-0.1.2.tar.gz
Size 28.4 kB
Tags Source
SHA-256 checksum
How to use checksums
3da9b3db58338620f13d8954effa6a6c6febf4f17cb12a82bfccf34607654821
BLAKE2b-256 checksum
How to use checksums
85af10ac0de6cc7ce4abfee67abd9ef2a5371d69b20a3e13fb0a14ccba191eaa
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

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 Nov 25, 2026.

Transparency log

Release files / agentdog-0.1.2-py3-none-any.whl

Download URL agentdog-0.1.2-py3-none-any.whl
Size 26.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
73fac922cba978a70413c8c5d42f0092576c91d21918ef974d8a16319ca35f3e
BLAKE2b-256 checksum
How to use checksums
10cb7ce46968c8172321e2a98d03fd5abfd01e3c74bac7e62631a7c89a7d452f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

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 Nov 25, 2026.

Transparency log

Security for agentdog 0.1.2

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.

Full provenance

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for agentdog-0.1.2.tar.gz

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 Nov 25, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page