Skip to content

Support Hatchet Workflow Patterns #31

Description

@yedidyakfir

Summary

Currently, mageflow only supports individual Hatchet tasks. When a task completes, we activate callbacks (success/error). We need to extend support to Hatchet workflow patterns, which are a flow of multiple tasks.

Current Behavior

  • Mageflow wraps individual Hatchet tasks with TaskSignature
  • Callbacks are triggered when a single task completes
  • Existing patterns (Chain, Swarm) orchestrate multiple TaskSignature instances via callbacks

Desired Behavior

Support Hatchet native workflow patterns where:

  • A workflow consists of multiple connected tasks (DAG)
  • Mageflow only intervenes at the endpoint of the workflow flow
  • Callbacks (success/error) are triggered only when the entire workflow completes, not on individual task completion

Use Case

When using Hatchet's native workflow capabilities (multi-step workflows with task dependencies), we want to:

  1. Let Hatchet handle the internal task flow natively
  2. Only wrap the workflow endpoints with mageflow's callback mechanism
  3. Trigger success callbacks when the workflow reaches its final task(s)
  4. Trigger error callbacks if any task in the workflow fails

Technical Considerations

  • Need to identify workflow entry and exit points
  • Should not interfere with Hatchet's internal task-to-task communication within a workflow
  • May require a new WorkflowSignature model similar to existing TaskSignature
  • Need to handle workflows with multiple exit points (branching)

Related

  • Current implementation: mageflow/signature/model.py
  • Callback handling: mageflow/callbacks.py
  • Hatchet invoker: mageflow/invokers/hatchet.py

Tasks

  • implement workflow and ensure it call signature callback on error and on success
  • ensure that retry in inner task in workflow works

Metadata

Metadata

Assignees

No one assigned

    Type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions