Skip to main content

Test framework for AI agents

Project description

attest-ai

Test framework for AI agents. Deterministic assertions (schema validation, cost constraints, trace ordering, content matching) over agent execution traces.

Install

pip install attest-ai

With LLM provider support:

pip install attest-ai[openai]      # OpenAI
pip install attest-ai[anthropic]   # Anthropic
pip install attest-ai[gemini]      # Google Gemini
pip install attest-ai[ollama]      # Ollama (local)
pip install attest-ai[all]         # All providers

Quick start

import attest
from attest import expect

result = attest.AgentResult(
    trace=trace,  # captured from your agent
    assertion_results=[],
)

# Layer 1: Schema validation
expect(result).output_matches_schema({"type": "object", "required": ["refund_id"]})

# Layer 2: Cost & performance constraints
expect(result).cost_under(0.05)
expect(result).latency_under(5000)

# Layer 3: Trace structure
expect(result).tools_called_in_order(["lookup_order", "process_refund"])
expect(result).no_tool_loops(max_iterations=3)

# Layer 4: Content assertions
expect(result).output_contains("refund")
expect(result).output_not_contains("sorry")

Pytest integration

Attest registers as a pytest plugin automatically:

pytest tests/ --attest-engine=/path/to/attest-engine

Links

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

attest_ai-0.6.0.tar.gz (410.2 kB view details)

Uploaded Source

Built Distribution

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

attest_ai-0.6.0-py3-none-any.whl (58.4 kB view details)

Uploaded Python 3

File details

Details for the file attest_ai-0.6.0.tar.gz.

File metadata

  • Download URL: attest_ai-0.6.0.tar.gz
  • Upload date:
  • Size: 410.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.6.14

File hashes

Hashes for attest_ai-0.6.0.tar.gz
Algorithm Hash digest
SHA256 4cefc7957468b615f1d4e5f2eb3805a078e87c0be3f79cd7f07c6515a85b08c9
MD5 51cd9a13cae1e82074b6b54a9a2eda4d
BLAKE2b-256 687185031ea3f9d2a9c6ea36e044e850c01204ec0cfa3e5158e26b556688d321

See more details on using hashes here.

File details

Details for the file attest_ai-0.6.0-py3-none-any.whl.

File metadata

  • Download URL: attest_ai-0.6.0-py3-none-any.whl
  • Upload date:
  • Size: 58.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.6.14

File hashes

Hashes for attest_ai-0.6.0-py3-none-any.whl
Algorithm Hash digest
SHA256 22c6e2d8e879b33dac14e3e73ce1e2190ef97e84d1afcbb5b2c802a3f6f7f43f
MD5 0af38a6e937a50922414838a4b8e4a1e
BLAKE2b-256 a8a531d34b7851f458e13e6e7a4b749c903f074adf2eb045e207745675fa0665

See more details on using hashes here.

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