</>

Workers & Task Queues

Intermediate

Where your code actually executes, and how the Temporal service hands work to it.

conceptsworkersscaling

The service holds state; workers run code

A common surprise: the Temporal Service (the cluster, self-hosted or Temporal Cloud) does not run your workflow or activity code. It stores histories, schedules timers, and tracks state. Your code runs in Workers — long-running processes you deploy that host your workflow and activity implementations.

Task Queues route work

A Task Queue is a named channel. When you start a workflow you name a task queue; workers poll that queue for tasks to execute and report results back.

   start workflow (task queue = "payments")
                │
        ┌───────▼────────┐        poll
        │ Temporal        │◄───────────────  Worker A  (hosts payment workflows
        │ Service         │───────────────►            + activities)
        │ (history, timers)│   task/result
        └───────▲────────┘◄───────────────  Worker B  (same task queue)
                                  poll

Key consequences:

A worker, conceptually

# Read-only sketch. A worker registers what it can run and which queue to poll.
worker = Worker(
    client,
    task_queue="payments",
    workflows=[CheckoutWorkflow],
    activities=[charge_card, send_receipt],
)
await worker.run()  # polls "payments" forever

Versioning (why it matters)

Because running workflows can live for days or months, deploying changed workflow code can break replay determinism for in-flight executions. Temporal addresses this with Worker Versioning / patching APIs so old histories keep replaying against compatible logic. Treat workflow code changes as you would a database migration.

Next: making activities resilient — Retries & Timeouts.

Mark your progress with this note: