Now inviting automation leaders: publish your playbook as a skill, under your own name. Publish yours →
Automation Skills
All skills/Workflow orchestration patterns/Details
Reference · Workflow orchestration patterns

Details

Part of Workflow orchestration patterns. Install the skill and your agent reads this page when it needs the depth.

workflow-orchestration-patterns — detailed patterns and worked examples

Critical Design Decision: Workflows vs Activities

The Fundamental Rule (Source: temporal.io/blog/workflow-engine-principles):

Workflows (Orchestration)

Characteristics:

Example workflow tasks:

Activities (External Interactions)

Characteristics:

Example activity tasks:

Design Decision Framework

Does it touch external systems? → Activity
Is it orchestration/decision logic? → Workflow

Core Workflow Patterns

1. Saga Pattern with Compensation

Purpose: Implement distributed transactions with rollback capability

Pattern (Source: temporal.io/blog/compensating-actions-part-of-a-complete-breakfast-with-sagas):

For each step:
  1. Register compensation BEFORE executing
  2. Execute the step (via activity)
  3. On failure, run all compensations in reverse order (LIFO)

Example: Payment Workflow

  1. Reserve inventory (compensation: release inventory)
  2. Charge payment (compensation: refund payment)
  3. Fulfill order (compensation: cancel fulfillment)

Critical Requirements:

2. Entity Workflows (Actor Model)

Purpose: Long-lived workflow representing single entity instance

Pattern (Source: docs.temporal.io/evaluate/use-cases-design-patterns):

Example Use Cases:

Benefits:

3. Fan-Out/Fan-In (Parallel Execution)

Purpose: Execute multiple tasks in parallel, aggregate results

Pattern:

Scaling Rule (Source: temporal.io/blog/workflow-engine-principles):

4. Async Callback Pattern

Purpose: Wait for external event or human approval

Pattern:

Use Cases:

State Management and Determinism

Automatic State Preservation

How Temporal Works (Source: docs.temporal.io/workflows):

Determinism Constraints

Workflows Execute as State Machines:

Prohibited in Workflows (Source: docs.temporal.io/workflows):

Allowed in Workflows:

Versioning Strategies

Challenge: Changing workflow code while old executions still running

Solutions:

  1. Versioning API: Use workflow.get_version() for safe changes
  2. New Workflow Type: Create new workflow, route new executions to it
  3. Backward Compatibility: Ensure old events replay correctly

Resilience and Error Handling

Retry Policies

Default Behavior: Temporal retries activities forever

Configure Retry:

Non-Retryable Errors:

Idempotency Requirements

Why Critical (Source: docs.temporal.io/activities):

Implementation Strategies:

Activity Heartbeats

Purpose: Detect stalled long-running activities

Pattern:

Publish your skill

Copy this prompt into Claude Code, Codex or any agent. It walks you through your first skill in about 20 minutes, with you as the author.

Click to copy.