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:
- Let Hatchet handle the internal task flow natively
- Only wrap the workflow endpoints with mageflow's callback mechanism
- Trigger success callbacks when the workflow reaches its final task(s)
- 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
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
TaskSignatureTaskSignatureinstances via callbacksDesired Behavior
Support Hatchet native workflow patterns where:
Use Case
When using Hatchet's native workflow capabilities (multi-step workflows with task dependencies), we want to:
Technical Considerations
WorkflowSignaturemodel similar to existingTaskSignatureRelated
mageflow/signature/model.pymageflow/callbacks.pymageflow/invokers/hatchet.pyTasks