Skip to main content

Manage Graph Execution Flow - A unified interface for task orchestration across different task managers

Project description

MageFlow

Manage Graph Execution Flow - A unified interface for task orchestration across different task managers.

Why MageFlow?

Instead of spreading workflow logic throughout your codebase, MageFlow centralizes task orchestration with a clean, unified API. Switch between task managers (Hatchet, Taskiq, etc.) without rewriting your orchestration code.

Key Features

🔗 Task Chaining - Sequential workflows where tasks depend on previous completions
🐝 Task Swarms - Parallel execution with intelligent coordination
📞 Callback System - Robust success/error handling
🎯 Task Signatures - Flexible task definition with validation
⏯️ Lifecycle Control - Pause, resume, and monitor task execution
💾 Persistent State - Redis-backed state management with recovery

Installation

pip install mageflow[hatchet]  # For Hatchet backend

Quick Setup

import asyncio
import redis
from hatchet_sdk import Hatchet, ClientConfig
import mageflow

# Configure backend and Redis
config = ClientConfig(token="your-hatchet-token")
redis_client = redis.asyncio.from_url("redis://localhost", decode_responses=True)
hatchet_client = Hatchet(config=config)

# Create MageFlow instance
mf = mageflow.Mageflow(hatchet_client, redis_client=redis_client)

Example Usage

Define Tasks

from pydantic import BaseModel

class ProcessData(BaseModel):
    data: str

@mf.task(name="process-data", input_validator=ProcessData)
async def process_data(msg: ProcessData):
    return {"processed": msg.data}

@mf.task(name="send-notification") 
async def send_notification(msg):
    print(f"Notification sent: {msg}")
    return {"status": "sent"}

Chain Tasks

# Sequential execution
workflow = await mageflow.chain([
    process_data_task,
    send_notification_task
], name="data-pipeline")

Parallel Swarms

# Parallel execution
swarm = await mageflow.swarm([
    process_user_task,
    update_cache_task,
    send_email_task
], task_name="user-onboarding")

Task Signatures with Callbacks

task_signature = await mageflow.sign(
    task_name="process-order",
    task_identifiers={"order_id": "12345"},
    success_callbacks=[send_confirmation_task],
    error_callbacks=[handle_error_task]
)

Use Cases

  • Data Pipelines - ETL operations with error handling
  • Microservice Coordination - Orchestrate distributed service calls
  • Batch Processing - Parallel processing of large datasets
  • User Workflows - Multi-step onboarding and registration
  • Content Processing - Media processing with multiple stages

Documentation

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

mageflow-0.0.5.tar.gz (26.5 kB view details)

Uploaded Source

Built Distribution

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

mageflow-0.0.5-py3-none-any.whl (37.9 kB view details)

Uploaded Python 3

File details

Details for the file mageflow-0.0.5.tar.gz.

File metadata

  • Download URL: mageflow-0.0.5.tar.gz
  • Upload date:
  • Size: 26.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for mageflow-0.0.5.tar.gz
Algorithm Hash digest
SHA256 d1ab2c90e842f47583a7d6057ffc5854ac95e03bd89fa22ef09bda282bfd8b9f
MD5 f6f7226cf11796da6bf7dac690046853
BLAKE2b-256 238527345044c31a32991530b181ecb4b45108ad13101666bee4e72557d9c2b1

See more details on using hashes here.

Provenance

The following attestation bundles were made for mageflow-0.0.5.tar.gz:

Publisher: publish.yml on imaginary-cherry/mageflow

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

File details

Details for the file mageflow-0.0.5-py3-none-any.whl.

File metadata

  • Download URL: mageflow-0.0.5-py3-none-any.whl
  • Upload date:
  • Size: 37.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for mageflow-0.0.5-py3-none-any.whl
Algorithm Hash digest
SHA256 0b5744b9c57bd9d2e5b761cce91f18002bd0bb93080cfb565ebf8b2a4cec37ef
MD5 30647178c5a9883e233cdc50b296535c
BLAKE2b-256 5f116e4400d76c72f502a05c440fa3c84a3f2a8ad9e3cff5cee7428b74c99f3d

See more details on using hashes here.

Provenance

The following attestation bundles were made for mageflow-0.0.5-py3-none-any.whl:

Publisher: publish.yml on imaginary-cherry/mageflow

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