Skip to main content

Maia

Multi-AI Agents Test Framework

Maia Test Framework is a pytest-based framework designed for testing multi-agent AI systems. It offers a flexible and extensible platform to create, run, and analyze complex multi-agent simulations.

Key Features

  • Multi-Agent Simulation: Simulate conversations and interactions between multiple AI agents.
  • Extensible Provider Model: Easily integrate with various AI model providers (e.g., Ollama, LiteLLM).
  • Built-in Assertions: A suite of assertions to verify agent behavior, including content analysis and participation checks.
  • Tool Integration: Agents can use external tools to perform actions.
  • Async Support: Built with asyncio for efficient I/O operations.

Installation

Install the framework using pip:

pip install maia-test-framework

Getting Started

1. Define Your Agents

Create a test class that inherits from MaiaTest and define your agents in the setup_agents method.

from maia_test_framework.testing.base import MaiaTest
from maia_test_framework.providers.ollama import OllamaProvider
from maia_test_framework.core.agent import Agent

class TestMyAgent(MaiaTest):
    def setup_agents(self):
        self.agents["coder"] = Agent(
            name="coder",
            provider=OllamaProvider(config={
                "model": "mistral",
                "system_message": "You are a helpful coding assistant.",
            })
        )

2. Create a Conversation Session

Use the create_session method to start a conversation with one or more agents.

import pytest

@pytest.mark.asyncio
async def test_code_generation(self):
    session = self.create_session(["coder"])
    # ...

3. Simulate a Conversation

Use the Session object to simulate user and agent interactions.

@pytest.mark.asyncio
async def test_code_generation(self):
    session = self.create_session(["coder"])
    await session.user_says("Write a Python function that returns the factorial of a number.")
    response = await session.agent_responds("coder")
    assert "def factorial" in response.content

4. Use Assertions

The framework includes powerful assertions to validate agent behavior.

Content Assertions

Check the content of agent messages for specific patterns.

from maia_test_framework.testing.assertions.content_patterns import assert_professional_tone

@pytest.mark.asyncio
async def test_professionalism(self):
    session = self.create_session(["coder"], assertions=[assert_professional_tone])
    await session.user_says("Write a Python function and add a joke to the comments.")
    with pytest.raises(AssertionError):
        await session.agent_responds("coder")

Participation Assertions

Ensure that agents are participating in the conversation as expected.

from maia_test_framework.testing.assertions.agents_participation import assert_agent_participated

@pytest.mark.asyncio
async def test_agent_participation(self):
    session = self.create_session(["coder", "reviewer"])
    await session.user_says("Write a Python function and have it reviewed.")
    await session.agent_responds("coder")
    await session.agent_responds("reviewer")
    assert_agent_participated(session, "coder")
    assert_agent_participated(session, "reviewer")

Running Tests

Run your tests using pytest:

pytest

Contributing

Contributions are welcome! Please open an issue or submit a pull request on GitHub.

License

This project is licensed under the Apache License 2.0. See the LICENSE file for details.

Metadata

Release files for maia-test-framework 0.9.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for maia-test-framework 0.9.0
File Size Uploaded
maia_test_framework-0.9.0.tar.gz 30.1 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for maia-test-framework 0.9.0
File Interpreter ABI Platform
maia_test_framework-0.9.0-py3-none-any.whl Python 3 none any Details

Total release size: 71.2 kB

Release files / maia_test_framework-0.9.0.tar.gz

Download URL maia_test_framework-0.9.0.tar.gz
Size 30.1 kB
Tags Source
SHA-256 checksum
How to use checksums
2c80449312d9107b218ea0a88b87a432aa7c6bb99bca5655938ee0ebae93f64d
BLAKE2b-256 checksum
How to use checksums
344dcba190cd7e9f92769c73a660af3c721fbdcfabfd1ad95f4bef136d8f6baa
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.12.10

Release files / maia_test_framework-0.9.0-py3-none-any.whl

Download URL maia_test_framework-0.9.0-py3-none-any.whl
Size 41.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
6605101020372e8f2ef3fa8d17b2cf0ce48558d5aa84de8c82e768a8f8815ddc
BLAKE2b-256 checksum
How to use checksums
106e7f472dca26160fd906ea74d47c52a7ef3b68f9af56e9678585a992d414fe
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.12.10

Release history Release notifications | RSS feed

This release

0.9.0 This release

2 release files

0.8.1

2 release files

0.8.0

2 release files

0.7.0

2 release files

0.6.1

2 release files

0.6.0

2 release files

0.5.1

2 release files

0.5.0

2 release files

0.4.0

2 release files

0.3.2

2 release files

0.3.1

2 release files

0.3.0

2 release files

0.2.4

2 release files

0.2.3

2 release files

0.2.2

2 release files

0.2.1

2 release files

0.2.0

2 release files

0.1.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page