apflow
Durable, distributed workflow orchestration with REST, MCP, A2A, and CLI interfaces
apflow is a Python orchestration engine for building, running, and governing dependable task workflows. It separates workflow structure from execution dependencies and records accepted Runs with frozen definitions, completed-result snapshots, and retry lineage. Durable background submission, shared token budgets, invocation-level usage records, recurring schedules, and coordinated workers support embedded SQLite deployments and distributed PostgreSQL services. Register capabilities once for REST/OpenAPI, MCP, A2A, and CLI, with service identity, ownership, and executor permission checks at authenticated boundaries.
Get Started
Command-line interface built on apcore-cli: serve REST, MCP and A2A, then create, submit and inspect Runs from the terminal.
$ pip install apflow# Serve REST + A2A + MCP together on one port (/, /a2a, /mcp)
apflow serve --all
# A2A only, with the Explorer UI at http://localhost:8000/explorer
apflow serve --explorer
# MCP server on stdio for Claude/Cursor
apflow mcp
# Inspect version, config and every registered module
apflow info
# Module commands use the local database, not the HTTP server
export APFLOW_DATABASE_URL=sqlite:////tmp/apflow.db
apflow dispatcher --db "$APFLOW_DATABASE_URL" # skip if REST/unified serve runs
# Create a draft, accept it for execution, then inspect the Run
apflow task create --name example --idempotency-key demo-1 --input - <<'JSON'
{"params":{"executor_id":"aggregate_results_executor"}}
JSON
apflow task submit --task-id ROOT_ID
apflow run get --run-id ROOT_ID
# Retries create a new Run; retry creation alone does not execute it
apflow run retry --run-id ROOT_ID --idempotency-key demo-retry-1