Skip to content

Latest commit

 

History

History
64 lines (47 loc) · 1.32 KB

File metadata and controls

64 lines (47 loc) · 1.32 KB

Quick Start Guide

Installation

pip install agenttest

Your First Test

from agenttest import AgentTest
from my_agent import build_agent  # Your agent factory

def test_agent_basic():
    agent = build_agent()
    with AgentTest(agent) as test:
        response = test.run("Hello!")
        assert response is not None

Mocking Tools

def test_with_mocked_tools():
    agent = build_agent()
    with AgentTest(agent) as test:
        # Replace real tool with mock
        test.mock_tool("search_api", return_value={"results": []})
        
        response = test.run("Search for something")
        
        # Verify tool was called
        test.assert_tool_called("search_api", times=1)

Checking Memory

def test_memory():
    agent = build_agent()
    with AgentTest(agent) as test:
        test.run("My name is Alice")
        
        # Check agent remembers
        test.assert_memory_contains("user_name", "Alice")

Running Tests

# Using pytest
pytest tests/

# Using AgentTest CLI
agenttest run tests/

Next Steps