Metadata-Version: 2.4
Name: marsys
Version: 0.2
Summary: A powerful framework for orchestrating collaborative AI agents with sophisticated reasoning, planning, and autonomous capabilities
Home-page: https://github.com/rezaho/MARSYS
Author: Reza Hosseini
Author-email: Reza Hosseini <reza@marsys.ai>
Maintainer: Reza Hosseini
Maintainer-email: Reza Hosseini <reza@marsys.ai>
License: Apache-2.0
Project-URL: Homepage, https://marsys.ai
Project-URL: Documentation, https://marsys.ai
Project-URL: Repository, https://github.com/rezaho/MARSYS
Project-URL: Issues, https://github.com/rezaho/MARSYS/issues
Project-URL: Changelog, https://github.com/rezaho/MARSYS/blob/main/CHANGELOG.md
Project-URL: Discussions, https://github.com/rezaho/MARSYS/discussions
Keywords: ai,agents,multi-agent,llm,orchestration,coordination,reasoning,planning,autonomous,openai,anthropic,claude,gpt,gemini,multi-agent-systems,agent-framework,ai-agents
Classifier: Development Status :: 4 - Beta
Classifier: Intended Audience :: Developers
Classifier: Intended Audience :: Science/Research
Classifier: License :: OSI Approved :: Apache Software License
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
Classifier: Topic :: Software Development :: Libraries :: Python Modules
Classifier: Framework :: AsyncIO
Requires-Python: >=3.12
Description-Content-Type: text/markdown
License-File: LICENSE
License-File: AUTHORS
Requires-Dist: pydantic>=2.11.9
Requires-Dist: requests>=2.32.3
Requires-Dist: click>=8.1.0
Requires-Dist: psutil>=7.1.0
Requires-Dist: packaging>=25.0
Requires-Dist: aiohttp>=3.12.15
Requires-Dist: pyyaml>=6.0.2
Requires-Dist: python-dotenv>=1.0.0
Requires-Dist: playwright>=1.55.0
Requires-Dist: pillow>=12.0.0
Requires-Dist: beautifulsoup4>=4.14.2
Requires-Dist: lxml>=6.0.2
Requires-Dist: brotli>=1.1.0
Requires-Dist: markdownify>=1.2.0
Requires-Dist: rich>=14.1.0
Requires-Dist: textual>=6.2.0
Requires-Dist: python-dateutil>=2.9.0
Requires-Dist: pypdf>=3.0.0
Requires-Dist: googlesearch-python>=1.3.0
Requires-Dist: PyMuPDF>=1.26.0
Requires-Dist: chardet>=5.2.0
Requires-Dist: structlog>=25.4.0
Requires-Dist: python-json-logger>=2.0.7
Requires-Dist: jsonschema>=4.23.0
Provides-Extra: local-models
Requires-Dist: torch>=2.6.0; extra == "local-models"
Requires-Dist: torchvision>=0.23.0; extra == "local-models"
Requires-Dist: transformers<5.0,>=4.54; extra == "local-models"
Requires-Dist: accelerate>=1.5.2; extra == "local-models"
Requires-Dist: peft>=0.17.1; extra == "local-models"
Requires-Dist: trl>=0.22.1; extra == "local-models"
Requires-Dist: datasets>=4.1.1; extra == "local-models"
Requires-Dist: decord>=0.6.0; extra == "local-models"
Requires-Dist: qwen-vl-utils>=0.0.8; extra == "local-models"
Provides-Extra: production
Requires-Dist: vllm>=0.10.2; extra == "production"
Requires-Dist: flash-attn>=2.7.4.post1; extra == "production"
Requires-Dist: triton>=3.4.0; extra == "production"
Requires-Dist: ninja>=1.13.0; extra == "production"
Provides-Extra: dev
Requires-Dist: torch>=2.6.0; extra == "dev"
Requires-Dist: torchvision>=0.23.0; extra == "dev"
Requires-Dist: transformers<5.0,>=4.54; extra == "dev"
Requires-Dist: accelerate>=1.5.2; extra == "dev"
Requires-Dist: peft>=0.17.1; extra == "dev"
Requires-Dist: trl>=0.22.1; extra == "dev"
Requires-Dist: datasets>=4.1.1; extra == "dev"
Requires-Dist: decord>=0.6.0; extra == "dev"
Requires-Dist: qwen-vl-utils>=0.0.8; extra == "dev"
Requires-Dist: vllm>=0.10.2; extra == "dev"
Requires-Dist: flash-attn>=2.7.4.post1; extra == "dev"
Requires-Dist: triton>=3.4.0; extra == "dev"
Requires-Dist: ninja>=1.13.0; extra == "dev"
Requires-Dist: pytest>=8.4.1; extra == "dev"
Requires-Dist: pytest-asyncio>=1.0.0; extra == "dev"
Requires-Dist: pytest-mock>=3.14.1; extra == "dev"
Requires-Dist: pytest-cov>=6.2.1; extra == "dev"
Requires-Dist: black>=25.0.0; extra == "dev"
Requires-Dist: flake8>=7.1.0; extra == "dev"
Requires-Dist: mypy>=1.13.0; extra == "dev"
Requires-Dist: mkdocs>=1.6.1; extra == "dev"
Requires-Dist: mkdocs-material>=9.6.21; extra == "dev"
Requires-Dist: mkdocstrings>=0.30.1; extra == "dev"
Requires-Dist: mkdocstrings-python>=1.18.2; extra == "dev"
Dynamic: author
Dynamic: home-page
Dynamic: license-file
Dynamic: maintainer
Dynamic: requires-python

# MARSYS - Multi-Agent Reasoning Systems

<div align="center">

![MARSYS Logo](https://img.shields.io/badge/MARSYS-v0.1--beta-blue?style=for-the-badge)
[![Python](https://img.shields.io/badge/python-3.12%2B-blue?style=for-the-badge)](https://www.python.org/)
[![License](https://img.shields.io/badge/license-Apache%202.0-green?style=for-the-badge)](LICENSE)
[![CLA assistant](https://cla-assistant.io/readme/badge/rezaho/MARSYS)](https://cla-assistant.io/rezaho/MARSYS)
[![Documentation](https://img.shields.io/badge/docs-marsys.ai-orange?style=for-the-badge)](https://marsys.ai/framework)

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

[Documentation](https://marsys.ai/framework) | [Quick Start](#quick-start) | [Examples](examples/) | [Contributing](#contributing)

</div>

---

## 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](https://docs.astral.sh/uv/getting-started/installation/):**
```bash
uv venv
source .venv/bin/activate  # Unix/macOS
# .venv\Scripts\activate   # Windows
```

**Install MARSYS:**
```bash
pip install marsys
```

With optional dependencies:
```bash
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):**
```bash
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:

```bash
# 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:
```bash
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`

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

### Playwright Setup (BrowserAgent only)

Only required if you plan to use BrowserAgent for web automation:
```bash
playwright install chromium --with-deps
```

### Basic Usage

A simple two-agent collaboration using `allowed_peers`:

```python
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()`:

```python
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](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](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

```bash
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](CONTRIBUTING.md)

---

## Citation

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

```bibtex
@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](LICENSE) for full terms.

Copyright 2025 Marsys Project. Original Author: [rezaho](https://github.com/rezaho)

---

<div align="center">

**Built by [Reza Hosseini](https://github.com/rezaho) and contributors**

[Documentation](https://marsys.ai/framework) | [Examples](examples/) | [GitHub](https://github.com/rezaho/MARSYS)

</div>
