Skip to main content

Agent workflow orchestration and execution platform

Project description

apflow

apflow Logo

Distributed Task Orchestration Framework

apflow is a distributed task orchestration framework that scales from a single process to multi-node clusters. It provides a unified execution interface with 12+ built-in executors, A2A protocol support, and automatic leader election with failover.

Start standalone in 30 seconds. Scale to distributed clusters without code changes.

Deployment Modes

Standalone (Development and Small Workloads)

pip install apflow

Single process, DuckDB storage, zero configuration. Ideal for development, testing, and small-scale automation.

from apflow.core.builders import TaskBuilder
from apflow import TaskManager, create_session

db = create_session()
task_manager = TaskManager(db)
result = await (
    TaskBuilder(task_manager, "rest_executor")
    .with_name("fetch_data")
    .with_input("url", "https://api.example.com/data")
    .with_input("method", "GET")
    .execute()
)

Distributed Cluster (Production)

pip install apflow[standard]

PostgreSQL-backed, leader/worker topology with automatic leader election, task leasing, and horizontal scaling. Same application code -- only the runtime environment changes.

# Leader node
APFLOW_CLUSTER_ENABLED=true \
APFLOW_DATABASE_URL=postgresql+asyncpg://user:pass@db:5432/apflow \
APFLOW_NODE_ROLE=auto \
apflow serve --port 8000

# Worker node (on additional machines)
APFLOW_CLUSTER_ENABLED=true \
APFLOW_DATABASE_URL=postgresql+asyncpg://user:pass@db:5432/apflow \
APFLOW_NODE_ROLE=worker \
apflow serve --port 8001

Add worker nodes at any time. The cluster auto-discovers them via the shared database.

Installation Options

Extra Command Includes
Core pip install apflow Task orchestration, DuckDB storage, core executors
Standard pip install apflow[standard] Core + A2A server + CLI + CrewAI + LLM + tools
A2A Server pip install apflow[a2a] A2A Protocol server (HTTP/SSE/WebSocket)
CLI pip install apflow[cli] Command-line interface
PostgreSQL pip install apflow[postgres] PostgreSQL storage (required for distributed)
CrewAI pip install apflow[crewai] LLM-based agent crews
LLM pip install apflow[llm] Direct LLM via LiteLLM (100+ providers)
SSH pip install apflow[ssh] Remote command execution
Docker pip install apflow[docker] Containerized execution
gRPC pip install apflow[grpc] gRPC service calls
Email pip install apflow[email] Email sending (SMTP)
All pip install apflow[all] Everything

Built-in Executors

Executor Purpose Extra
RestExecutor HTTP/REST API calls with auth and retry core
CommandExecutor Local shell command execution core
SystemInfoExecutor System information collection core
ScrapeExecutor Web page scraping core
WebSocketExecutor Bidirectional WebSocket communication core
McpExecutor Model Context Protocol tools and data sources core
ApFlowApiExecutor Inter-instance API calls for distributed execution core
AggregateResultsExecutor Aggregate results from multiple tasks core
SshExecutor Remote command execution via SSH [ssh]
DockerExecutor Containerized command execution [docker]
GrpcExecutor gRPC service calls [grpc]
SendEmailExecutor Send emails via SMTP or Resend API [email]
CrewaiExecutor LLM agent crews via CrewAI [crewai]
BatchCrewaiExecutor Atomic batch of multiple crews [crewai]
LLMExecutor Direct LLM interaction via LiteLLM [llm]
GenerateExecutor Natural language to task tree via LLM [llm]

Architecture

                    +--------------------------+
                    |    Client / CLI / API     |
                    +------------+-------------+
                                 |
              +------------------+------------------+
              |                  |                   |
    +---------v--------+ +------v------+ +----------v--------+
    |   Leader Node     | | Worker Node | |   Worker Node      |
    |  (auto-elected)   | |             | |                    |
    |  - Task placement | |  - Execute  | |  - Execute         |
    |  - Lease mgmt     | |  - Heartbeat| |  - Heartbeat       |
    |  - Execute        | |             | |                    |
    +---------+--------+ +------+------+ +----------+--------+
              |                  |                   |
              +------------------+------------------+
                                 |
                    +------------v-------------+
                    |  PostgreSQL (shared)      |
                    |  - Task state             |
                    |  - Leader lease           |
                    |  - Node registry          |
                    +--------------------------+

Standalone mode uses the same architecture with a single node and DuckDB storage.

Documentation

Full documentation: flow-docs.aipartnerup.com

Contributing

Contributions are welcome. See Contributing Guide for setup and guidelines.

License

Apache-2.0

Links

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

apflow-0.18.1.tar.gz (1.3 MB view details)

Uploaded Source

Built Distribution

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

apflow-0.18.1-py3-none-any.whl (474.8 kB view details)

Uploaded Python 3

File details

Details for the file apflow-0.18.1.tar.gz.

File metadata

  • Download URL: apflow-0.18.1.tar.gz
  • Upload date:
  • Size: 1.3 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.10

File hashes

Hashes for apflow-0.18.1.tar.gz
Algorithm Hash digest
SHA256 0deb99acf1b2b7ecdc7c0cc192457a9bdd92785a214e6e6ecf0a43112e6e45dd
MD5 b853a2c1165fba03dcce04ee339f10d9
BLAKE2b-256 162a7058de509435fe18d38b74f88a7a217b61532249b6a1668bd4170a7114ab

See more details on using hashes here.

File details

Details for the file apflow-0.18.1-py3-none-any.whl.

File metadata

  • Download URL: apflow-0.18.1-py3-none-any.whl
  • Upload date:
  • Size: 474.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.10

File hashes

Hashes for apflow-0.18.1-py3-none-any.whl
Algorithm Hash digest
SHA256 bfda00ca7a04c818dc339442d83739e736ff4be74b12c5ef94f1e2a913eedf05
MD5 4c4c788d883414c4c04d437412319d02
BLAKE2b-256 8b14d7db766a7e7f32b0fabed187762509febb3e0b7132549cd83ba5ac8f4af9

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