Skip to main content

A self-hostable, zero-cost, local-first automation platform for creating and running visual workflows

Project description

ModusFlow

A self-hostable, zero-cost, local-first automation platform for creating and running visual workflows.

Features

  • ๐ŸŽจ Visual Workflow Editor: Drag-and-drop interface using React Flow
  • ๐Ÿค– AI-Assisted Generation: Generate workflows from plain English prompts
  • โšก Async DAG Engine: Parallel execution where possible
  • ๐Ÿ’พ Local-First: SQLite for history, JSON/YAML for workflows (Git-friendly)
  • ๐Ÿ–ฅ๏ธ CLI Tool: Headless execution and validation
  • ๐Ÿ”ง Node Types: Python scripts, HTTP requests, AI models, Shell commands, Delays
  • ๐Ÿ“Š Live Logging: Real-time execution logs per node
  • ๐Ÿ’ฐ Cost Estimation: Token and cost tracking for AI nodes
  • ๐Ÿ”„ Error Handling: Retries, on_fail paths, custom error handling

Quick Start

Prerequisites

  • Python 3.8+
  • Node.js 16+
  • (Optional) API keys for AI providers (Anthropic, OpenAI, or OpenRouter)

Backend Setup

cd backend
pip install -r requirements.txt

# Copy .env.example to .env and add your API keys
cp .env.example .env

# Start the backend
uvicorn app.main:app --reload --port 8000

Frontend Setup

cd frontend
npm install
npm run dev

Visit http://localhost:5173 to access the visual editor.

CLI Installation

cd cli
pip install -e .

CLI Usage

# Run a workflow
modusflow run data/workflows/example_web_scraper.json

# Generate a workflow from a prompt
modusflow generate "scrape a website and summarize with AI" -o my_workflow.json

# Validate a workflow
modusflow validate data/workflows/example_web_scraper.json

Architecture

  • Backend: FastAPI + Python async execution engine
  • Frontend: React + TypeScript + React Flow + Monaco Editor
  • Storage:
    • SQLite database for execution history (data/modusflow.db)
    • JSON/YAML files for workflows (data/workflows/*.json)
  • AI: Free-tier LLMs via Anthropic (Claude Haiku), OpenAI (GPT-3.5), or OpenRouter

Node Types

Python Node

Execute Python code. Output should be JSON-printable or plain text.

import json
result = {"message": "Hello, World!"}
print(json.dumps(result))

HTTP Node

Make HTTP requests (GET, POST, PUT, DELETE, PATCH).

{
  "url": "https://api.example.com/data",
  "method": "GET",
  "headers": {"Authorization": "Bearer token"}
}

AI Node

Call AI models (Claude, GPT, etc.).

{
  "provider": "anthropic",
  "model": "claude-3-haiku-20240307",
  "prompt": "Summarize: ${previous_node}",
  "system_prompt": "You are a helpful assistant."
}

Shell Node

Execute shell commands.

{
  "command": "ls -la | head -10"
}

Delay Node

Wait for a specified duration.

{
  "seconds": 2.5
}

Using Node Outputs

Reference outputs from previous nodes using ${node_id} syntax:

{
  "prompt": "Summarize this: ${fetch_node}"
}

Error Handling

  • Retries: Set retries and retry_delay on any node
  • On-Fail Path: Set on_fail to a node ID that executes on failure
  • Status Tracking: Each node tracks success/failure status

Docker Deployment

# Build and run with Docker Compose
docker-compose up --build

# Or build manually
docker build -t modusflow .
docker run -p 8000:8000 -v $(pwd)/data:/app/data modusflow

Development

Project Structure

ModusFlow1/
โ”œโ”€โ”€ backend/           # FastAPI backend
โ”‚   โ”œโ”€โ”€ app/
โ”‚   โ”‚   โ”œโ”€โ”€ main.py   # FastAPI app
โ”‚   โ”‚   โ”œโ”€โ”€ executor.py  # DAG execution engine
โ”‚   โ”‚   โ”œโ”€โ”€ ai_client.py  # AI provider clients
โ”‚   โ”‚   โ”œโ”€โ”€ routes/      # API routes
โ”‚   โ”‚   โ””โ”€โ”€ models.py    # Pydantic models
โ”‚   โ””โ”€โ”€ requirements.txt
โ”œโ”€โ”€ frontend/         # React frontend
โ”‚   โ”œโ”€โ”€ src/
โ”‚   โ”‚   โ”œโ”€โ”€ components/  # React components
โ”‚   โ”‚   โ”œโ”€โ”€ store/       # Zustand state
โ”‚   โ”‚   โ””โ”€โ”€ types.ts     # TypeScript types
โ”‚   โ””โ”€โ”€ package.json
โ”œโ”€โ”€ cli/              # CLI tool
โ”‚   โ””โ”€โ”€ modusflow/
โ”‚       โ””โ”€โ”€ cli.py
โ””โ”€โ”€ data/             # Data directory
    โ”œโ”€โ”€ workflows/    # Workflow JSON files
    โ””โ”€โ”€ modusflow.db  # SQLite database

License

MIT

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

modusflow-1.0.0.tar.gz (18.1 kB view details)

Uploaded Source

Built Distribution

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

modusflow-1.0.0-py3-none-any.whl (18.9 kB view details)

Uploaded Python 3

File details

Details for the file modusflow-1.0.0.tar.gz.

File metadata

  • Download URL: modusflow-1.0.0.tar.gz
  • Upload date:
  • Size: 18.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.0

File hashes

Hashes for modusflow-1.0.0.tar.gz
Algorithm Hash digest
SHA256 94d422c15a8a2ed978e3bedda1bc0eca7a50b4b33f0bf494154cddff5108d306
MD5 5ff9ef85c87427fff6b4cdde493440e2
BLAKE2b-256 8234f4af847b494d6f3c5783631e7019dbb1fc525c392b62f04c2603efcfcd61

See more details on using hashes here.

File details

Details for the file modusflow-1.0.0-py3-none-any.whl.

File metadata

  • Download URL: modusflow-1.0.0-py3-none-any.whl
  • Upload date:
  • Size: 18.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.0

File hashes

Hashes for modusflow-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 8802d4cc53a107ba97fff0bf85d7f7676c6ff5787b2e8f1b97af8181ebaed70d
MD5 d012543090e0d92212c8ff3e2b311b6c
BLAKE2b-256 bc9a0d8c5b0792bee4a64cbebdc17ee0a9ab89a2d22cc866a542270dc0753f3c

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