Skip to main content
Source Code: src/gaia/testing/
Component: Test Utilities (MockLLMProvider, MockVLMClient, fixtures) Module: gaia.testing Import: from gaia.testing import MockLLMProvider, MockVLMClient, create_test_agent, temp_database

Overview

Test Utilities provide fixtures, mocks, and helper functions for testing GAIA agents without requiring real LLMs, databases, or network resources. This enables fast, reliable unit testing for both GAIA framework and third-party agents. Key Features:
  • Mock LLM provider with configurable responses
  • Mock VLM client for image processing
  • Temporary database fixtures with auto-cleanup
  • Agent test factory with mocked dependencies
  • Assertion helpers for common test patterns

Requirements

Functional Requirements

  1. Mock LLM Provider
    • Simulate LLM responses without API calls
    • Configurable response sequences
    • Track call history for assertions
  2. Mock VLM Client
    • Simulate image text extraction
    • Configurable extracted text
    • Track calls for testing
  3. Temporary Database
    • In-memory SQLite for testing
    • Automatic cleanup
    • Isolation between tests
  4. Agent Test Factory
    • Create agents with mocked dependencies
    • Simplified agent instantiation
    • Pre-configured for testing
  5. Assertion Helpers
    • Verify tool calls
    • Check agent state
    • Validate responses

Non-Functional Requirements

  1. Performance
    • Fast test execution (no real API calls)
    • Minimal setup overhead
  2. Ease of Use
    • Simple, intuitive API
    • Good defaults
    • Clear error messages
  3. Isolation
    • Tests donโ€™t interfere with each other
    • Clean state between tests

API Specification

File Locations

Public Interface

fixtures.py

assertions.py


Testing Requirements

Unit Tests

File: tests/sdk/test_testing_utilities.py

Usage Examples

Example 1: Testing Agent with Mock LLM

Example 2: Testing Database Agent

Example 3: Testing VLM Integration

Example 4: Testing File Watching


pytest Fixtures

Fixture Exports

File: tests/conftest.py (for GAIA framework tests)
Third-party agents can create similar fixtures in their test suites.

Documentation Updates Required

docs/sdk/core/agent-system.mdx

Add new section:
[Full documentation with more examples]

Implementation Checklist

Step 1: Create Files

  • Create src/gaia/testing/ directory
  • Create src/gaia/testing/__init__.py
  • Create src/gaia/testing/fixtures.py
  • Create src/gaia/testing/assertions.py

Step 2: Implement Mocks

  • MockLLMProvider class
  • MockVLMClient class
  • Response cycling logic
  • Call history tracking

Step 3: Implement Fixtures

  • create_test_agent() function
  • temp_database() context manager
  • temp_directory() context manager
  • Schema loading for temp DB

Step 4: Implement Assertions

  • assert_tool_called()
  • assert_tool_result()
  • assert_agent_completed()

Step 5: Write Tests

  • Create tests/sdk/test_testing_utilities.py
  • Test MockLLMProvider
  • Test MockVLMClient
  • Test temp_database
  • Test temp_directory
  • Test create_test_agent

Step 6: Export

  • Export from src/gaia/testing/__init__.py
  • Export from src/gaia/__init__.py
  • Add to __all__

Step 7: Document

  • Add section to docs/sdk/core/agent-system.mdx
  • Add usage examples
  • Update agent testing guide

Step 8: Validate

  • Can import: from gaia.testing import MockLLMProvider
  • Example tests work
  • All tests pass
  • External agents can use it

Test Utilities Technical Specification