Skip to main content

A powerful framework for orchestrating collaborative AI agents with sophisticated reasoning, planning, and autonomous capabilities

Project description

MARSYS - Multi-Agent Reasoning Systems

MARSYS Logo Python License CLA assistant Documentation

A framework for orchestrating collaborative AI agents with sophisticated reasoning, planning, and autonomous capabilities

Documentation | Quick Start | Examples | Contributing


What is MARSYS?

MARSYS (Multi-Agent Reasoning Systems) is a Python framework for building and coordinating multi-agent AI systems. It provides flexible topology definitions, parallel execution with agent pools, state persistence, and human-in-the-loop support.

Core Features

  • Multi-Agent Orchestration: Coordinate workflows with multiple specialized agents
  • Flexible Topologies: Define agent relationships using strings, objects, or pre-defined patterns
  • Parallel Execution: True concurrency with AgentPool and dynamic branch spawning
  • State Persistence: Pause/resume with checkpointing for long-running tasks
  • Human-in-the-Loop: Built-in user interaction for approval workflows and error recovery
  • Multi-Model Support: OpenAI, Anthropic, Google, OpenRouter, xAI, and local models

Quick Start

Installation

Create and activate a virtual environment with uv:

uv venv
source .venv/bin/activate  # Unix/macOS
# .venv\Scripts\activate   # Windows

Install MARSYS:

pip install marsys

With optional dependencies:

pip install marsys[local-models]  # Local model support (PyTorch, Transformers)
pip install marsys[production]    # Production inference (vLLM, Flash Attention)
pip install marsys[dev]           # Everything (local-models + production + testing + docs)

Install from source (for development):

git clone https://github.com/rezaho/MARSYS.git
cd MARSYS
pip install -e ".[dev]"

API Key Configuration

Configure your API keys via environment variables or a .env file:

# Environment variables
export OPENROUTER_API_KEY="your-key-here"
export ANTHROPIC_API_KEY="your-key-here"
export OPENAI_API_KEY="your-key-here"

Or create a .env file in your project root:

OPENROUTER_API_KEY=your-key-here
ANTHROPIC_API_KEY=your-key-here

OAuth alternative (no API keys):

  • OpenAI ChatGPT subscription: codex login → credentials in ~/.codex/auth.json
  • Anthropic Claude Max subscription: claude login → credentials in ~/.claude/.credentials.json
  • Google Antigravity gateway: marsys oauth add <profile> --provider google-oauth → credentials in ~/.marsys/oauth/<profile>/credentials.json

Use provider="openai-oauth", provider="anthropic-oauth", or provider="google-oauth" in ModelConfig.

Note:

  • anthropic-oauth and google-oauth rely on non-official integration paths and may violate provider Terms of Service. Use at your own risk.

Playwright Setup (BrowserAgent only)

Only required if you plan to use BrowserAgent for web automation:

playwright install chromium --with-deps

Basic Usage

A simple two-agent collaboration using allowed_peers:

from marsys.agents import Agent
from marsys.models import ModelConfig

model_config = ModelConfig(
    type="api",
    name="anthropic/claude-opus-4.6",
    provider="openrouter"
)

researcher = Agent(
    model_config=model_config,
    name="Researcher",
    goal="Expert at finding and analyzing information",
    instruction="You are a research specialist. Find and analyze information thoroughly.",
    allowed_peers=["Writer"]
)

writer = Agent(
    model_config=model_config,
    name="Writer",
    goal="Skilled at creating clear, engaging content",
    instruction="You are a skilled writer. Create clear, engaging content based on research.",
    allowed_peers=[]
)

result = await researcher.auto_run(
    task="Research the latest AI breakthroughs and write a summary",
    max_steps=20,
    verbosity=1
)

print(result)

Using Orchestra with Topology

For more control, define the topology explicitly using Orchestra.run():

from marsys.coordination import Orchestra
from marsys.agents import Agent
from marsys.models import ModelConfig

model_config = ModelConfig(
    type="api",
    name="anthropic/claude-opus-4.6",
    provider="openrouter"
)

researcher = Agent(
    model_config=model_config,
    name="Researcher",
    goal="Expert at finding and analyzing information",
    instruction="You are a research specialist. Find and analyze information thoroughly."
)

writer = Agent(
    model_config=model_config,
    name="Writer",
    goal="Skilled at creating clear, engaging content",
    instruction="You are a skilled writer. Create clear, engaging content based on research."
)

topology = {
    "agents": ["Researcher", "Writer"],
    "flows": ["Researcher -> Writer"]
}

result = await Orchestra.run(
    task="Research the latest AI breakthroughs and write a summary",
    topology=topology
)

print(result.final_response)

More examples


Contributing

We welcome contributions from the community. MARSYS is an open-source project that thrives on collaboration.

Contributor License Agreement (CLA)

Before your first contribution can be merged, you must sign our CLA. This is a one-time, automated process:

  1. Open a pull request
  2. CLA Assistant bot will comment with a link
  3. Click the link and sign
  4. Your PR will be automatically unblocked

The CLA ensures legal clarity and protects both contributors and the project. You retain ownership of your code and can use it elsewhere. See docs/CLA.md for full details.

How to Contribute

  1. Fork the repository and create your branch from main
  2. Make your changes and ensure tests pass
  3. Write/update tests for your changes
  4. Submit a pull request with a clear description

Development Setup

git clone https://github.com/rezaho/MARSYS.git
cd MARSYS
pip install -e ".[dev]"

# Run tests
pytest tests/

# Run linting
flake8 src/
black src/ --check

Contributing guide


Citation

If you use MARSYS in your research or projects, please cite:

@software{marsys2025,
  author = {Hosseini, Reza},
  title = {MARSYS: Multi-Agent Reasoning Systems Framework},
  year = {2025},
  publisher = {GitHub},
  url = {https://github.com/rezaho/MARSYS}
}

License

MARSYS is released under the Apache License 2.0. See LICENSE for full terms.

Copyright 2025 Marsys Project. Original Author: rezaho


Built by Reza Hosseini and contributors

Documentation | Examples | GitHub

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

marsys-0.2.1.tar.gz (1.3 MB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

marsys-0.2.1-py3-none-any.whl (642.4 kB view details)

Uploaded Python 3

File details

Details for the file marsys-0.2.1.tar.gz.

File metadata

  • Download URL: marsys-0.2.1.tar.gz
  • Upload date:
  • Size: 1.3 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.3

File hashes

Hashes for marsys-0.2.1.tar.gz
Algorithm Hash digest
SHA256 863fe0ebbfa12b3a86572a4c1446d9e5f47148d1d58e4508505c95960882308a
MD5 2bed3edf6d4c0863bf709e7a96d4e5fa
BLAKE2b-256 286be5c53b5f494e011778811fe87541f03bbead99c9f6d4b69485380092afd7

See more details on using hashes here.

File details

Details for the file marsys-0.2.1-py3-none-any.whl.

File metadata

  • Download URL: marsys-0.2.1-py3-none-any.whl
  • Upload date:
  • Size: 642.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.3

File hashes

Hashes for marsys-0.2.1-py3-none-any.whl
Algorithm Hash digest
SHA256 d8dfe582b24ca2e93d60d8f133e6f213d67ca0245775dc88dd2cf7937227ba88
MD5 9dce868d47ca63b67874cca82eea1a8e
BLAKE2b-256 e97454d78759d6ae189d63e1f7258f9c4cd3b4b7c3c736ff58451aeee15e438f

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page