Agent

Open-MAI-Dx-Orchestrator

About this agent

An open source implementation of the paper: "Sequential Diagnosis with Language Models" From Microsoft Built with Swarms Framework

MAI Diagnostic Orchestrator (MAI-DxO)

An open-source implementation of Microsoft Research's "Sequential Diagnosis with Language Models" paper, built with the Swarms AI framework.

MAI-DxO (MAI Diagnostic Orchestrator) is a sophisticated AI-powered diagnostic system that simulates a virtual panel of physician-agents to perform iterative medical diagnosis with cost-effectiveness optimization. This implementation faithfully reproduces the methodology described in the Microsoft Research paper while providing additional features and flexibility.

Paper License Python

โœจ Key Features

  • 8 AI Physician Agents: Specialized roles for comprehensive diagnosis.
  • 5 Operational Modes: Instant, question-only, budgeted, no-budget, and ensemble modes.
  • Cost Tracking: Real-time budget monitoring with costs for 25+ medical tests.
  • Clinical Evaluation: 5-point accuracy scoring with detailed feedback.
  • Model Agnostic: Works with GPT, Gemini, Claude, and other leading LLMs.
  • Token-Optimized Prompts: Ultra-compact role prompts reduce token usage and latency without sacrificing reasoning quality.

๐Ÿš€ Quick Start

1. Installation

Install the package directly via pip:

BASH
pip install mai-dx

Or, for development, clone the repository and install the requirements:

BASH
git clone https://github.com/The-Swarm-Corporation/Open-MAI-Dx-Orchestrator.git
cd Open-MAI-Dx-Orchestrator
pip install -r requirements.txt

2. Environment Setup

Create a .env file in your project root and add your API keys:

TXT
OPENAI_API_KEY="Your OpenAI API key"
GEMINI_API_KEY="Your Gemini API key"
ANTHROPIC_API_KEY="Your Anthropic API key"

3. Basic Usage

PYTHON
from mai_dx import MaiDxOrchestrator

# Create the orchestrator (defaults to a capable model)
orchestrator = MaiDxOrchestrator()

# Run a diagnosis
result = orchestrator.run(
    initial_case_info="29-year-old woman with sore throat and peritonsillar swelling...",
    full_case_details="Patient: 29-year-old female. History: Onset of sore throat...",
    ground_truth_diagnosis="Embryonal rhabdomyosarcoma of the pharynx"
)

# Print the results
print(f"Final Diagnosis: {result.final_diagnosis}")
print(f"Accuracy: {result.accuracy_score}/5.0")
print(f"Total Cost: ${result.total_cost:,.2f}")

โš™๏ธ Advanced Usage & Configuration

Customize the orchestrator's model, budget, and operational mode.

PYTHON
from mai_dx import MaiDxOrchestrator

# Configure with a specific model and budget
orchestrator = MaiDxOrchestrator(
    model_name="gemini/gemini-2.5-flash",  # or "gpt-4", "claude-3-5-sonnet"
    max_iterations=10,
    initial_budget=3000,
    mode="budgeted"  # Other modes: "instant", "question_only", "no_budget"
)

# Run the diagnosis
# ...

๐Ÿฅ How It Works: The Virtual Physician Panel

MAI-DxO employs a multi-agent system where each agent has a specific role:

  • ๐Ÿง  Dr. Hypothesis: Maintains the differential diagnosis.
  • ๐Ÿ”ฌ Dr. Test-Chooser: Selects the most cost-effective diagnostic tests.
  • ๐Ÿค” Dr. Challenger: Prevents cognitive biases and diagnostic errors.
  • ๐Ÿ’ฐ Dr. Stewardship: Ensures cost-effective care.
  • โœ… Dr. Checklist: Performs quality control checks.
  • ๐Ÿค Consensus Coordinator: Synthesizes panel decisions.
  • ๐Ÿ”‘ Gatekeeper: Acts as the clinical information oracle.
  • โš–๏ธ Judge: Evaluates the final diagnostic accuracy.

Documentation

Learn more about this repository with the docs

๐Ÿค Contributing

We welcome contributions! Please feel free to open an issue or submit a pull request.

๐Ÿ“„ License

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

๐Ÿ“š Citation

If you use this work in your research, please cite both the original paper and this software implementation.

BIBTEX
@misc{nori2025sequentialdiagnosislanguagemodels,
    title={Sequential Diagnosis with Language Models}, 
    author={Harsha Nori and Mayank Daswani and Christopher Kelly and Scott Lundberg and Marco Tulio Ribeiro and Marc Wilson and Xiaoxuan Liu and Viknesh Sounderajah and Jonathan Carlson and Matthew P Lungren and Bay Gross and Peter Hames and Mustafa Suleyman and Dominic King and Eric Horvitz},
    year={2025},
    eprint={2506.22405},
    archivePrefix={arXiv},
    primaryClass={cs.CL},
    url={https://arxiv.org/abs/2506.22405}, 
}

@software{mai_dx_orchestrator,
    title={Open-MAI-Dx-Orchestrator: An Open Source Implementation of Sequential Diagnosis with Language Models},
    author={The-Swarm-Corporation},
    year={2025},
    url={https://github.com/The-Swarm-Corporation/Open-MAI-Dx-Orchestrator.git}
}

๐Ÿ”— Related Work

๐Ÿ“ž Support


<p align="center"> <strong>Built with Swarms for advancing AI-powered medical diagnosis</strong> </p>

Source: https://github.com/The-Swarm-Corporation/Open-MAI-Dx-Orchestrator

ai
microsoft
ml
multi-agent
paper-implementation
swarms
swarms-agents
swarms-ecosystem
ehr
epic
medical-agents
healthcare-agennts
xray-agents

Requirements

PackageInstallation
swarmspip3 install swarms

Agent Code

The main implementation code for this agent. You can view, copy, and use this code directly in your projects.

Comments & Discussion

Items You'd Like

Check out similar agents that match your interests