Skip to article frontmatterSkip to article content
Site not loading correctly?

This may be due to an incorrect BASE_URL configuration. See the MyST Documentation for reference.

The Modular Autonomous Discovery for Science (MADSci) Framework

Docker Pre-Commit PyPI Pytests Coverage badge JOSS status

Diagram of a MADSci laboratory's Architecture

Experiment Control Flow Using MADSci

Overview

MADSci is a modular, autonomous, and scalable framework for scientific discovery and experimentation. It aims to provide:

Diagram of a MADSci laboratory's Architecture

Diagram of a MADSci Laboratory’s Infrastructure

Notes on Stability

MADSci is currently in beta. Most of the core functionality is working and tested, but there may be bugs or stability issues (if you run into any, please open an issue so we can get it fixed). New releases will likely include breaking changes, so we recommend pinning the version in your dependencies and upgrading only after reviewing the release notes.

Documentation

MADSci is made up of a number of different modular components, each of which can be used independently to fulfill specific needs, or composed to build more complex and capable systems. Below we link to specific documentation for each system component.

Guides

Installation

Python Packages

All MADSci components are available via PyPI. Install individual components as needed:

# Core components
pip install madsci.common          # Shared types and utilities
pip install madsci.client          # Client libraries
pip install madsci.experiment_application # Experiment Logic

# Manager services
pip install madsci.event_manager    # Event logging and querying
pip install madsci.workcell_manager # Workflow coordination
pip install madsci.location_manager # Location management
pip install madsci.resource_manager # Resource tracking
pip install madsci.data_manager     # Data capture and storage
pip install madsci.experiment_manager # Experiment management

# Lab infrastructure
pip install madsci.squid           # Lab manager with dashboard
pip install madsci.node_module      # Node development framework

Docker Images

We provide pre-built Docker images for easy deployment:

For users new to docker, we recommend checking out our Docker Guide

Quick Start

pip install madsci-client
madsci init my_lab          # Interactive lab setup wizard
cd my_lab
madsci start                # Start with Docker
# or
madsci start --mode=local   # Start without Docker (pure Python)

Access the dashboard at http://localhost:8000 to monitor your lab.

To try the complete example lab instead:

git clone https://github.com/AD-SDL/MADSci.git
cd MADSci
docker compose up  # Starts all services with example configuration

Configuration

MADSci uses environment variables for configuration with hierarchical precedence. Key patterns:

See Configuration.md for comprehensive options, example_lab/ for working configurations, and OBSERVABILITY.md for OpenTelemetry setup.

Roadmap

We’re working on bringing the following additional components to MADSci:

Getting Started

Learning Resources

  1. Example Lab: Complete working lab with virtual instruments (robot arm, liquid handler, plate reader)

  2. Example Notebooks: Jupyter notebooks covering core concepts and implementation patterns, included in the example lab

  3. Configuration examples: See example_lab/settings.yaml and example_lab/compose.yaml for lab configuration

CLI Overview

MADSci provides a unified CLI (madsci) with 17 commands:

CommandAliasDescription
initInitialize a new lab interactively
newnCreate components from 26 built-in templates
startStart lab services (Docker or local mode)
stopStop lab services
statussCheck service health
doctordocRun diagnostic checks
logslView and filter event logs
runRun workflows or experiments
validatevalValidate configuration files
configcfgExport or create configuration files
backupCreate database backups
registryManage service registry
migrateRun database migrations
tuiuiLaunch interactive terminal interface
completionGenerate shell completions
commandscmdList all commands
versionShow version information

Run madsci <command> --help for details on any command. See CLI Reference for full documentation.

Templates

Generate scaffolding for any MADSci component:

madsci new list                       # Browse all 26 templates
madsci new module                     # Interactive module creation
madsci new experiment --modality tui  # TUI experiment
madsci new lab --template standard    # Full lab with Docker Compose

See Template Catalog for the complete list.

TUI (Terminal User Interface)

madsci tui    # Launch interactive dashboard

Provides real-time service status, log browsing, node management, and workflow monitoring with auto-refresh.

Local Mode

Run all managers without Docker using in-memory backends:

madsci start --mode=local

Useful for development, testing, and environments without Docker. Data is ephemeral.

Configuration Management

madsci config export event     # Export Event Manager settings to YAML
madsci config export --all     # Export all manager settings
madsci config create manager event  # Create a new manager config file

Common Usage Patterns

Creating custom nodes:

# See examples/example_lab/example_modules/ for reference implementations
from madsci.node_module import AbstractNodeModule

class MyInstrument(AbstractNodeModule):
    def my_action(self, param1: str) -> dict:
        # Your instrument control logic
        return {"result": "success"}

Submitting workflows:

# See examples/example_lab/workflows/ for workflow definitions
from madsci.client.workcell_client import WorkcellClient

client = WorkcellClient("http://localhost:8005")
result = client.submit_workflow("path/to/workflow.yaml")

Contributing

Interested in contributing to MADSci? We welcome all contributions, from bug reports to new features!

See our Contributing Guide for:

For quick development setup:

git clone https://github.com/AD-SDL/MADSci.git
cd MADSci
just init  # Installs dependencies and sets up pre-commit hooks
just up    # Start example lab for testing

Note: The pdm.lock file was generated using uv as the resolver. If pdm install fails with resolver errors, either install uv and run pdm config use_uv true, or delete pdm.lock to let PDM regenerate it with the standard resolver. See CONTRIBUTING.md for details.