Skip to main content

Workflows

Build stateful workflows that orchestrate complex business processes, handle long-running operations, and guarantee durable execution through automatic checkpointing and recovery.

From Development to Production

While Dapr Workflow provides the orchestration framework, Catalyst takes you from code to production by providing a managed workflow runtime with deep observability, execution visualization, and debugging tools. Learn more about Running Workflows with Catalyst.

durable workflow overview

Workflow as Code

Dapr Workflow lets you define workflows programmatically using any supported language SDK (Python, JavaScript, .NET, Java, Go). Express complex orchestration logic with the full power and flexibility of a programming language, including conditionals, loops, error handling, and type safety.

Below is an example of an order approval workflow that demonstrates conditional logic, external events, and timeouts:

@wfr.workflow(name="request_escalation")
def request_escalation_workflow(ctx: DaprWorkflowContext, order_str: str):
order = json.loads(order_str) if isinstance(order_str, str) else order_str
amount = order.get("amount", 0)

# Auto-approve orders under $1000
if amount < 1000:
yield ctx.call_activity(auto_approve_activity, input=order)
return

# Orders $1000+ require human approval (7 days max)
approval_event = ctx.wait_for_external_event("human_approval")
timeout = ctx.create_timer(timedelta(days=7))
winner = yield when_any([approval_event, timeout])

# Handle approval event or timeout
if winner == timeout:
yield ctx.call_activity(handle_timeout_activity, input=order)
return

approval_result = approval_event.get_result()
yield ctx.call_activity(process_approval_activity, input=approval_result)

Key capabilities:

  • Durability - Every workflow step is persisted in a backing store (SQL, NoSQL, or cloud service), allowing workflows to survive process restarts and continue from their last recorded state
  • Built-in resiliency - Durable retry policies track retry state, wait with durable timers, and continue after restarts with automatic retries, timeouts, and circuit breakers
  • Child workflows - Compose complex processes by breaking them down into reusable sub-processes
  • Multi-application workflows - Orchestrate business processes that span different application instances, enabling workflow and activity reuse across services
  • Timers and reminders - Schedule delays or future events with durable timer support
  • External events - Wait for human approvals, external system responses, or custom triggers

Workflow Patterns

Dapr Workflow supports common stateful coordination patterns in microservice architectures.

Running and Operating Workflows with Catalyst

Catalyst provides deep workflow observability through a unified dashboard that tracks all executions, workflow states, and success rates. View summaries by workflow type, drill down into individual runs, and visualize execution paths to understand how each activity progressed or failed.

workflow dashboard

Key capabilities:

  • Workflow dashboard - Monitor workflow execution states (Running, Completed, Failed) and aggregate success rates across workflows for quick health insights
  • Execution visualization - View real-time diagrams of workflow paths, including branching, parallel activities, and dependencies
  • Execution history - View full workflow timelines, duration, and outcomes for debugging and auditing
  • Input and output inspection - Examine data at each stage for debugging and monitoring
  • API logs - Inspect real-time Dapr API calls including Workflow, State, Pub/Sub, and Invocation APIs for end-to-end visibility

Getting Started