Writing

Step Functions and Azure Durable Functions for multi-step AI workflows

Workflow infrastructure for AI: branching, retries, parallel processing and human-in-the-loop review, with a real batch-document use case on AWS Step Functions.

Diagram of an AI deployment pattern using Step Functions or Azure Durable Functions for multi-step orchestration.

Not every AI workload is a single call. Some workflows span multiple steps, need to branch, retry on failure, or wait for a human to review something before continuing.

Step Functions (AWS) and Azure Durable Functions are built exactly for this.

Step Functions / Azure Durable Functions - multi-step orchestration

This is workflow infrastructure. You define the steps, the platform manages state, retries, branching, and waits - across as many steps as you need.

What it does:

  • Chains Lambda functions (or containers) into a defined sequence
  • Runs branches in parallel and waits for all to finish before moving on
  • Retries failed steps automatically with configurable backoff
  • Pauses mid-workflow for a human approval, then resumes when approved
  • Keeps full state - if a step fails at hour 3, it doesn’t restart from the beginning

When to use it:

  • Your AI workflow spans multiple models or tools in sequence
  • You need parallel processing with a merge step
  • Human-in-the-loop review is part of the process
  • Failures need to be recoverable without restarting the whole job

When to avoid it:

  • The job is a single step - Lambda is simpler
  • The work is hours of heavy compute per item - Batch is the right fit

Real use case: 1000+ PDFs batch-upload to S3 → Step Functions loops each document → parallel branches extract fields and line items simultaneously → validate totals → flag for human review if mismatched → save to DB once approved. The Lambdas do the AI work; Step Functions handles the loop, the parallel branches, the retries, and the approval wait.