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_databaseOverview
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
-
Mock LLM Provider
- Simulate LLM responses without API calls
- Configurable response sequences
- Track call history for assertions
-
Mock VLM Client
- Simulate image text extraction
- Configurable extracted text
- Track calls for testing
-
Temporary Database
- In-memory SQLite for testing
- Automatic cleanup
- Isolation between tests
-
Agent Test Factory
- Create agents with mocked dependencies
- Simplified agent instantiation
- Pre-configured for testing
-
Assertion Helpers
- Verify tool calls
- Check agent state
- Validate responses
Non-Functional Requirements
-
Performance
- Fast test execution (no real API calls)
- Minimal setup overhead
-
Ease of Use
- Simple, intuitive API
- Good defaults
- Clear error messages
-
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)
Documentation Updates Required
docs/sdk/core/agent-system.mdx
Add new section: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
-
MockLLMProviderclass -
MockVLMClientclass - 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