Skip to main content
Workflows allow you to orchestrate multiple tasks in a directed acyclic graph (DAG), defining dependencies and parallel execution paths.

Basic Workflow

Define a workflow using the hy.workflow() method:

Parallel Execution

Run multiple tasks in parallel using arrays:

Complex DAG Patterns

Build complex workflows with branching paths:

Workflow Arguments

Pass arguments to workflows using Zod schemas:

Access Workflow Context

Tasks within workflows can access workflow metadata:

Task Configuration in Workflows

Apply task-specific configuration within workflows:

Task Copies

Use the same task multiple times in a workflow with .copy():

Workflow Configuration

Configure workflow behavior:

Sending Workflows

Send workflows for execution:

Best Practices

  1. Define Clear Dependencies
  2. Use Type-Safe Arguments
  3. Share Data Between Tasks
  4. Handle Workflow Errors

Next Steps

Tasks

Learn about task configuration

Queues

Route workflows to worker pools

Key-Value Store

Share data between workflow tasks