| name | workflow-orchestration |
| description | Design workflow orchestration systems for complex, multi-step business processes. Outputs orchestration pattern selection, Temporal/Airflow implementation, error handling strategy, and observability. |
| argument-hint | ["workflow complexity","step count","failure requirements","team familiarity","language"] |
| allowed-tools | Read, Write |
Workflow Orchestration
Workflow orchestration manages the execution of multi-step processes: scheduling steps, handling failures, retrying, and maintaining state across long-running operations. The challenge is making complex workflows reliable, observable, and debuggable when any individual step can fail.
When to Use Orchestration
USE ORCHESTRATION when:
✓ Multi-step process with dependencies between steps
✓ Steps can fail and need automatic retry
✓ Process runs for minutes to months (long-running)
✓ You need visibility into process state
✓ Human approval gates required
✓ Compensation (rollback) needed on failure
USE SIMPLE QUEUES when:
✓ Single-step processing
✓ No dependencies between tasks
✓ Stateless; no need to track progress
ORCHESTRATION TOOLS:
Temporal — durable execution; code-first; any language
Apache Airflow — DAG-based; Python; batch/data pipelines
Step Functions — AWS-native; JSON DSL; serverless-friendly
Prefect — Python; data workflows; modern Airflow alternative
Conductor — Netflix; microservice workflows; polyglot
Temporal — Code-First Orchestration
from temporalio activity, workflow
temporalio.client Client
temporalio.worker Worker
datetime timedelta
asyncio
() -> :
order = db.get_order(order_id)
order:
ValueError()
order.()
() -> :
reservation_id = inventory_service.reserve(order_id, items)
reservation_id
() -> :
charge_id = payment_service.charge(order_id, amount)
charge_id
() -> :
inventory_service.release(reservation_id)
() -> :
payment_service.refund(charge_id)
:
() -> :
reservation_id =
charge_id =
:
order = workflow.execute_activity(
validate_order, order_id,
start_to_close_timeout=timedelta(seconds=),
retry_policy=RetryPolicy(maximum_attempts=, backoff_coefficient=),
)
reservation_id = workflow.execute_activity(
reserve_inventory, order_id, order[],
start_to_close_timeout=timedelta(seconds=),
retry_policy=RetryPolicy(maximum_attempts=),
)
charge_id = workflow.execute_activity(
charge_payment, order_id, order[],
start_to_close_timeout=timedelta(seconds=),
retry_policy=RetryPolicy(maximum_attempts=),
)
{: , : charge_id}
Exception e:
charge_id:
workflow.execute_activity(refund_payment, charge_id)
reservation_id:
workflow.execute_activity(release_inventory, reservation_id)
():
client = Client.connect()
handle = client.start_workflow(
OrderFulfillmentWorkflow.run,
order_id,
=,
task_queue=,
)
handle.