Skip to content

AgentTest Documentation

A pytest-like testing framework for AI agents and prompts

AgentTest is a comprehensive testing framework designed specifically for AI agents, providing evaluation, logging, and regression tracking capabilities similar to pytest but tailored for AI/ML applications.

๐Ÿ“š Documentation Index

Getting Started

Core Concepts

  • Writing Tests - How to structure and write agent tests
  • Evaluators - Understanding evaluation metrics and criteria

Advanced Features

Evaluator Reference

Examples & Tutorials

API Reference

๐Ÿš€ Key Features

  • ๐Ÿค– Intelligent Auto Test Generation: Automatically analyze your code and generate comprehensive test cases with proper imports and function calls
  • ๐Ÿงช Pytest-like Interface: Familiar CLI and decorator-based testing
  • ๐Ÿง  Smart Code Analysis: Understands project structure, classes, functions, and generates realistic test data
  • Multiple Evaluators: String similarity, LLM judges, NLP metrics, pattern matching
  • Git Integration: Track performance across commits with detailed comparisons
  • Rich CLI: Comprehensive command-line interface with filtering and export options
  • Enhanced Logging: Detailed debugging and structured logging
  • Flexible Configuration: YAML-based configuration with environment variable support
  • Multiple LLM Providers: OpenAI, Anthropic, Google Gemini support

๐Ÿƒโ€โ™‚๏ธ Quick Example

from agent_test import agent_test

@agent_test(criteria=['similarity', 'llm_judge'])
def test_summarization_quality():
    """Test if the agent can summarize text effectively."""
    return {
        "input": "Write a summary of the latest AI developments...",
        "actual": agent_response,
        "expected": "A concise summary highlighting key points...",
        "evaluation_criteria": ["accuracy", "conciseness", "relevance"]
    }
# Run tests with enhanced output
agenttest run --verbose --detailed

# Compare performance across git commits
agenttest compare abc123 HEAD --metric similarity --detailed

# Generate test reports
agenttest run --export results.json --log-output debug.log

๐Ÿ› ๏ธ Installation

# Basic installation
pip install agenttest

# With optional dependencies
pip install agenttest[langchain,llamaindex]

# Development installation
pip install agenttest[dev,all]

_Need help? Check out our Quick Start Guide or browse the Examples!