Skip to main content

Reactive marimo notebooks for ML with MLflow tracking, PINA physics-informed neural networks, and a multi-agent team on pydantic-graph + Ollama Cloud.

Project description

Marimo Flow ๐ŸŒŠ

Python Marimo MLflow MCP Docker Version License Ask DeepWiki Contributing


Like marimo algae drifting in crystal waters, your data flows and evolves โ€“ each cell a living sphere of computation, gently touching others, creating ripples of reactive change. In this digital ocean, data streams like currents, models grow like organic formations, and insights emerge naturally from the depths. Let your ML experiments flow freely, tracked and nurtured, as nature intended.

Why Marimo Flow is Powerful ๐Ÿš€

Marimo Flow combines reactive notebook development with AI-powered assistance and robust ML experiment tracking:

  • ๐Ÿค– AI-First Development with MCP: Model Context Protocol (MCP) integration brings live documentation, code examples, and AI assistance directly into your notebooks - access up-to-date library docs for Marimo, Polars, Plotly, and more without leaving your workflow
  • ๐Ÿ”„ Reactive Execution: Marimo's dataflow graph ensures your notebooks are always consistent - change a parameter and watch your entire pipeline update automatically
  • ๐Ÿ“Š Seamless ML Pipeline: MLflow integration tracks every experiment, model, and metric without breaking your flow
  • ๐ŸŽฏ Interactive Development: Real-time parameter tuning with instant feedback and beautiful visualizations

This combination eliminates the reproducibility issues of traditional notebooks while providing AI-enhanced, enterprise-grade experiment tracking.

Features โœจ

๐Ÿค– AI-Powered Development (MCP)

  • Model Context Protocol Integration: Live documentation and AI assistance in your notebooks
  • Context7 Server: Access up-to-date docs for any Python library without leaving marimo
  • Marimo MCP Server: Specialized assistance for marimo patterns and best practices
  • Local LLM Support: Ollama integration for privacy-focused AI code completion

๐Ÿ“Š ML Development Workflow

  • ๐Ÿ““ Reactive Notebooks: Git-friendly .py notebooks with automatic dependency tracking
  • ๐Ÿ”ฌ MLflow Tracking: Complete ML lifecycle management with model registry
  • ๐ŸŽฏ Interactive Development: Real-time parameter tuning with instant visual feedback
  • ๐Ÿ’พ SQLite Backend: Lightweight, file-based storage for experiments

๐Ÿง  PINA โ€” composition-first (no hardcoded PDE factories)

  • compose_problem(ProblemSpec): agents emit typed EquationSpec + SubdomainSpec + ConditionSpec and the composer compiles a pina.Problem subclass at runtime (sympy.lambdify + pina.operator.grad/laplacian). No ProblemKind enum โ€” any PDE sympy can express is reachable.
  • Inverse problems: UnknownParameterSpec + data-fitting ObservationSpec โ†’ composer wires a pina.LearnableParameter and routes a 3-arg residual.
  • Mesh geometry: MeshSpec + meshio + MeshDomain barycentric sampling (tri/tetra/quad/hex). SubdomainSpec.mesh_ref picks cell groups.
  • 3D visualisation: core/viz3d.py via plotly (Mesh3d, Volume, Scatter3d, Isosurface) โ€” no 150 MB VTK stack.
  • Design optimisation: OptimizationPlan + DesignVariableSpec + ConstraintSpec driving Optuna TPE or scipy SLSQP with penalty / augmented-Lagrangian handling.
  • Stochastic + non-local: NoiseSpec (white / colored / fbm) wraps the residual; fractional Laplacian via Riesz-kernel Monte-Carlo quadrature.
  • MPC: marimo_flow.control โ€” rolling-horizon scipy SLSQP on a trained PINN surrogate.
  • Walrus foundation model adapter for Poisson-class problems.

๐Ÿณ Deployment

  • Docker: docker-compose setup with CPU, CUDA, and XPU image variants
  • ๐Ÿ“š MCP-Powered Docs: Live documentation via Context7 and Marimo MCP servers

Quick Start ๐Ÿƒโ€โ™‚๏ธ

With Docker (Recommended)

# Clone repository
git clone https://github.com/synapticore-io/marimo-flow.git
cd marimo-flow

# Build and start services
docker compose -f docker/docker-compose.yaml up --build -d

# Access services
# Marimo: http://localhost:2718
# MLflow: http://localhost:5000

# View logs
docker compose -f docker/docker-compose.yaml logs -f

# Stop services
docker compose -f docker/docker-compose.yaml down

Docker Image Variants

Variant Image Tag Use Case
CPU ghcr.io/synapticore-io/marimo-flow:latest No GPU (lightweight)
CUDA ghcr.io/synapticore-io/marimo-flow:cuda NVIDIA GPUs
XPU ghcr.io/synapticore-io/marimo-flow:xpu Intel Arc/Data Center GPUs
# NVIDIA GPU (requires nvidia-docker)
docker compose -f docker/docker-compose.cuda.yaml up -d

# Intel GPU (requires Intel GPU drivers)
docker compose -f docker/docker-compose.xpu.yaml up -d

Local Development

# Install dependencies
uv sync

# Start MLflow server (in background or separate terminal)
uv run mlflow server \
  --host 0.0.0.0 \
  --port 5000 \
  --backend-store-uri sqlite:///data/mlflow/db/mlflow.db \
  --default-artifact-root ./data/mlflow/artifacts \
  --serve-artifacts

# Start Marimo (in another terminal)
uv run marimo edit examples/

Example Notebooks ๐Ÿ“š

All notebooks live in examples/ and can be opened with uv run marimo edit examples/<file>.py.

  • 01_pina_poisson_solver.py โ€“ Solve the Poisson equation with baseline PINNs or the Walrus foundation model. Training is tracked in MLflow with integrated Optuna sweep analytics and experiment history. Uses marimo_flow.core directly.
  • 02_provenance_dashboard.py โ€“ Review surface over the DuckDB provenance store. Five tables (tasks, experiments, agent decisions, validation verdicts, handoffs) side-by-side plus 3D preset preview. Uses marimo_flow.agents.services.ProvenanceStore.
  • 03_navier_stokes_3d_cavity.py โ€“ 3D lid-driven cavity composed end-to-end from a declarative ProblemSpec (no hardcoded NS factory). Sliders for viscosity, lid speed, collocation-point count, hidden width, epochs. Renders the spatial domain + mid-plane velocity slice with plotly. Uses the composition-first services/composer.py.
  • 04_mpc_heat_rod.py โ€“ Closed-loop MPC on a 1D heat-rod PINN surrogate. Trains a small surrogate via the composer, then drives a rolling-horizon scipy-SLSQP MPC loop from marimo_flow.control toward a user-set temperature setpoint.
  • lab.py โ€“ PINA multi-agent team chat demo (see PINA Multi-Agent Team). Requires Ollama running locally.

Project Structure ๐Ÿ“

marimo-flow/
โ”œโ”€โ”€ examples/                         # Marimo notebooks
โ”‚   โ”œโ”€โ”€ 01_pina_poisson_solver.py        # Poisson PINN demo (uses core/)
โ”‚   โ”œโ”€โ”€ 02_provenance_dashboard.py       # DuckDB review + 3D preset preview
โ”‚   โ”œโ”€โ”€ 03_navier_stokes_3d_cavity.py    # 3D NS lid-driven cavity (composer)
โ”‚   โ”œโ”€โ”€ 04_mpc_heat_rod.py               # Closed-loop MPC via scipy SLSQP
โ”‚   โ””โ”€โ”€ lab.py                           # PINA team chat demo (uses agents/)
โ”œโ”€โ”€ src/marimo_flow/                  # Installable package
โ”‚   โ”œโ”€โ”€ core/                         # PINA solvers, training, plotly viz3d
โ”‚   โ”œโ”€โ”€ control/                      # Rolling-horizon MPC (scipy SLSQP)
โ”‚   โ””โ”€โ”€ agents/                       # Multi-agent team (pydantic-graph + MLflow)
โ”‚       โ”œโ”€โ”€ nodes/                    # TriageNode, RouteNode, specialists, ValidationNode
โ”‚       โ”œโ”€โ”€ schemas/                  # TaskSpec / ProblemSpec / ObservationSpec /
โ”‚       โ”‚                             #   MeshSpec / OptimizationPlan / ControlPlan / โ€ฆ
โ”‚       โ”œโ”€โ”€ toolsets/                 # FunctionToolset per role (incl. design, control)
โ”‚       โ””โ”€โ”€ services/                 # composer, mesh_domain, design aggregator,
โ”‚                                     #   provenance (DuckDB 13 tables), experiments
โ”œโ”€โ”€ tests/                            # Pytest suite (216 passing, 1 xfailed)
โ”œโ”€โ”€ docs/                             # Project documentation (see docs/INDEX.md)
โ”œโ”€โ”€ docker/                           # Dockerfiles + compose (CPU, CUDA, XPU)
โ”œโ”€โ”€ data/mlflow/                      # MLflow storage (artifacts, db)
โ””โ”€โ”€ pyproject.toml                    # Dependencies

Two Workflows

Workflow Import Use Case
Classic (core/) from marimo_flow.core import ... You know the PDE, pick a solver, log to MLflow. See examples/01_pina_poisson_solver.py.
Agents (agents/) from marimo_flow.agents import lead_chat, FlowDeps Describe the problem in natural language; a multi-agent team composes Problem + Model + Solver. See examples/lab.py.

Both write to the same MLflow backend (data/mlflow/). The two packages do not depend on each other โ€” pick whichever matches the task.

The marimo_flow.core Package

from marimo_flow.core import (
    ProblemManager,           # Define PDE problems and domains
    SolverManager,            # Configure PINN / SAPINN solvers
    FoundationModelAdapter,   # Walrus foundation model adapter
    create_model_for_problem, # Build a PINA neural-network model for a Problem
    train_solver,             # Run training via PINA's Trainer
    build_optuna_history_figure,
    build_optuna_param_importance_figure,
    build_optuna_parallel_figure,
    build_trials_scatter_chart,
    study_trials_dataframe,
)

MCP (Model Context Protocol) Integration ๐Ÿ”Œ

marimo and AI-assisted IDEs share MCP servers for live documentation and notebook operations. For the full configuration reference see docs/mcp-setup.md.

marimo (in-notebook AI)

Pre-configured in .marimo.toml:

[mcp]
presets = ["marimo", "context7"]

[mcp.mcpServers.mlflow]
command = "mlflow"
args = ["mcp", "run"]

[mcp.mcpServers.mlflow.env]
MLFLOW_TRACKING_URI = "http://localhost:5000"

[ai.ollama]
model = "gpt-oss:20b-cloud"
base_url = "http://localhost:11434/v1"

The Docker container uses a separate docker/.marimo.toml without MCP presets โ€” containerized sessions run only the notebook UI; MCP servers run on the host and are reached over host.docker.internal.

VS Code / Claude Code

Four MCP servers configured in .vscode/mcp.json:

Server Purpose
marimo Notebook inspection, linting (HTTP on port 2718)
mlflow Trace search, feedback, evaluation (stdio via mlflow mcp run)
context7 Live library documentation (stdio via npx)
serena Semantic code search (stdio via uvx)

Start the marimo MCP server (required for the marimo tool):

uv tool install "marimo[lsp,recommended,sql,mcp]>=0.18.0"
marimo edit --mcp --no-token --port 2718 --headless

Claude Code skills & hooks

Three domain skills in .claude/Skills/ (marimo, mlflow, pina) provide expert guidance and pre-resolved context7 library IDs (/marimo-team/marimo, /mlflow/mlflow, /mathlab/pina).

Automated cross-platform hooks in .claude/settings.json:

Hook Trigger Action
PostToolUse Edit/Write .py files Auto-format with ruff
PreToolUse Edit uv.lock Block (protection)

Configuration โš™๏ธ

Environment Variables

Docker setup (configured in docker/docker-compose.yaml):

  • MLFLOW_BACKEND_STORE_URI: sqlite:////app/data/mlflow/db/mlflow.db
  • MLFLOW_DEFAULT_ARTIFACT_ROOT: /app/data/mlflow/artifacts
  • MLFLOW_HOST: 0.0.0.0 (allows external access)
  • MLFLOW_PORT: 5000
  • OLLAMA_BASE_URL: http://host.docker.internal:11434 (requires Ollama on host)

Local development:

  • MLFLOW_TRACKING_URI: defaults to sqlite:///data/mlflow/db/mlflow.db (lead agent auto-creates data/mlflow/{db,artifacts}/ and pins the marimo-flow experiment's artifact root). Set to http://localhost:5000 if you run a separate MLflow server.

Docker Services

The Docker container runs both services via docker/start.sh:

  • Marimo: Port 2718 - Interactive notebook environment
  • MLflow: Port 5000 - Experiment tracking UI

GPU Support: Use docker-compose.cuda.yaml for NVIDIA GPUs or docker-compose.xpu.yaml for Intel GPUs. The default docker-compose.yaml is CPU-only.

PINA Multi-Agent Team (marimo_flow.agents) ๐Ÿง‘โ€๐Ÿš€๐Ÿง‘โ€๐Ÿš€๐Ÿง‘โ€๐Ÿš€

Reactive multi-agent team that orchestrates PINA workflows via pydantic-graph, backed by MLflow for tracing + persistence, exposed via marimo's chat UI and optionally as A2A and AG-UI ASGI servers.

from marimo_flow.agents import lead_chat, FlowDeps
import marimo as mo

deps = FlowDeps()  # uses sqlite:///data/mlflow/db/mlflow.db by default
chat = mo.ui.chat(lead_chat(deps=deps))
chat

Roles (each loads its .claude/Skills/<name>/SKILL.md as instructions= where applicable):

  • triage โ€” parses free-form user intent into a typed TaskSpec (start node)
  • notebook โ€” marimo MCP cell ops (skills: marimo, marimo-pair)
  • problem โ€” defines a PINA Problem from an open spec (skill: pina-problem)
  • model โ€” designs a neural architecture for the problem (skill: pina-model)
  • solver โ€” wires Solver + Trainer config (skill: pina-solver)
  • training โ€” runs pina.Trainer.fit() via the training toolset (skill: pina-training)
  • validation โ€” grades the run against task_spec.constraints and records a ValidationReport with an accept/retry/escalate/reject verdict
  • mlflow โ€” MLflow MCP tracking + registry (skill: mlflow)
  • lead โ€” chat/A2A/AG-UI front-end; wraps the whole graph as one tool

TriageNode runs first and produces the TaskSpec. RouteNode then dispatches between specialists, emits a HandoffRecord on every dispatch, and short-circuits to End when the validation verdict is escalate / reject (SPEC ยง13 HITL).

Typed specs + provenance (SPEC ยง8, ยง12): Every graph run builds typed ProblemSpec / ModelSpec / SolverPlan / RunConfig on FlowState and mirrors them โ€” plus AgentDecision, HandoffRecord, ValidationReport, ExperimentRecord, ArtifactRef, and lineage edges โ€” into a DuckDB provenance store (./provenance.duckdb by default, or MARIMO_FLOW_PROVENANCE_DB). MLflow still owns the binary artifacts; DuckDB owns the queryable index. DuckDB 1.5.2 ships transitively via marimo[sql].

from marimo_flow.agents.services import ProvenanceStore

store = ProvenanceStore("provenance.duckdb")
print(store.query("SELECT title, verdict FROM tasks t "
                  "LEFT JOIN validation_reports v USING (task_id) "
                  "ORDER BY t.created_at DESC LIMIT 10"))

See examples/02_provenance_dashboard.py for a marimo review surface.

Models: provider-prefixed specs ("<provider>:<model>") resolved through pydantic-ai's infer_model. Defaults in marimo_flow.agents.deps.DEFAULT_MODELS all point at Ollama Cloud (http://localhost:11434/v1, :cloud-suffixed tags).

Override per role either via config.yaml at the repo root (see config.yaml.example) or with MARIMO_FLOW_MODEL_<ROLE>=<spec> env vars. Any provider in the pydantic-ai catalogue works โ€” openai, anthropic, groq, mistral, google-gla, bedrock, together, fireworks, openrouter, deepseek, cerebras, xai, ollama, huggingface, ...

Standalone servers:

uv run python -m marimo_flow.agents.server.a2a    # A2A on :8000
uv run python -m marimo_flow.agents.server.ag_ui  # AG-UI on :8001

See examples/lab.py for the full demo notebook.

Contributing ๐Ÿค

We welcome contributions! Please see our Contributing Guidelines for details on:

  • Development setup and workflow
  • Code standards and style guide
  • Testing requirements
  • Pull request process

Quick Start for Contributors:

  1. Fork the repository
  2. Create a feature branch: git checkout -b feature-name
  3. Make your changes following the coding standards
  4. Test your changes: uv run pytest
  5. Submit a pull request

See CONTRIBUTING.md for comprehensive guidelines.

Changelog ๐Ÿ“‹

See CHANGELOG.md for a detailed version history and release notes.

Current Version: 0.3.1

License ๐Ÿ“„

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


Built with โค๏ธ using Marimo and MLflow

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

marimo_flow-0.3.1.tar.gz (104.1 kB view details)

Uploaded Source

Built Distribution

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

marimo_flow-0.3.1-py3-none-any.whl (125.4 kB view details)

Uploaded Python 3

File details

Details for the file marimo_flow-0.3.1.tar.gz.

File metadata

  • Download URL: marimo_flow-0.3.1.tar.gz
  • Upload date:
  • Size: 104.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for marimo_flow-0.3.1.tar.gz
Algorithm Hash digest
SHA256 2cfe79df38189bc8e23f39d14769faa8333eefdf7f9b2ee6727d5303421b7d8f
MD5 91c22b4f055018bb5fef6cf8430d5484
BLAKE2b-256 8c4154e371d44d4bd328ac5ca5ffa1c63c6581e715b3e2e3491d61d232a9bcaa

See more details on using hashes here.

Provenance

The following attestation bundles were made for marimo_flow-0.3.1.tar.gz:

Publisher: python-publish.yml on synapticore-io/marimo-flow

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file marimo_flow-0.3.1-py3-none-any.whl.

File metadata

  • Download URL: marimo_flow-0.3.1-py3-none-any.whl
  • Upload date:
  • Size: 125.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for marimo_flow-0.3.1-py3-none-any.whl
Algorithm Hash digest
SHA256 55b5a4dc6f3a932b389f8c7775a3fece3900d153f22780862152c5b311bc3cd8
MD5 5b1246a62b8a636294b86c4e03862564
BLAKE2b-256 0613ea048c3296d6c4f2a7985566f45f3e3b22805c03b20742571381493a6877

See more details on using hashes here.

Provenance

The following attestation bundles were made for marimo_flow-0.3.1-py3-none-any.whl:

Publisher: python-publish.yml on synapticore-io/marimo-flow

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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