Skip to main content
Worker Versioning is in Pre-Release stage and not recommended for production use. Future breaking changes may be made if necessary. The Version Set concept and related APIs have been deprecated.

Overview

Worker Versioning simplifies deploying changes to Worker Programs by:
  • Build ID routing - Route workflows to workers based on Build ID
  • Determinism guarantee - Workflows started on a Build ID only run on that Build ID
  • Zero-downtime deploys - Run multiple worker versions simultaneously
  • Redirect rules - Control when to route new work to new versions
  • Reachability API - Determine when old versions can be decommissioned

How It Works

Worker Versioning guarantees that workflow executions started on a particular Build ID will only be processed by workers of the same Build ID, unless instructed otherwise via Redirect Rules.

When to Use Worker Versioning

Best Suited For

Short-Running Workflows

Workflows that complete quickly, minimizing the time you need to run multiple worker versions simultaneously.

Blue-Green Deploys

Deployment strategy where each version runs at full capacity during rollout.

Alternatives for Long-Running Workflows

If deployment frequency is low relative to workflow lifetime, you can afford running multiple versions for extended periods.
Use Continue-as-New with UseAssignmentRules versioning intent so each new execution starts on the latest Build ID.
Avoid nondeterministic changes by using Workflow Patching or GetCurrentBuildID() along with redirect rules.

Prerequisites

1

Server Version

Temporal Server v1.24.0 or higher required for Worker Versioning API.
2

SDK Support

Updating versioning rules:
  • Temporal CLI >= v0.13.1
  • Go SDK >= v1.27.0
Creating versioned workers:
  • Go SDK >= v1.27.0
  • TypeScript SDK >= v1.11.0
  • Python SDK >= v1.7.0
  • Java SDK >= v1.25.0
  • .NET SDK >= v1.2.0

Build IDs

A Build ID is a free-form string identifying a worker version:
  • Recommended format: Semantic version or git commit SHA
  • Examples: v1.0.0, v2.1.3, abc123def456
  • Assignment: Set when creating worker
  • Persistence: Recorded with workflow execution metadata

Assignment Rules

Assignment rules control which Build ID receives new workflow executions:

Default Assignment Rule

The rule with the highest precedence (most recent) is the default:
New workflows are routed to the default Build ID unless overridden.

Compatible Versions

Mark Build IDs as compatible to enable gradual rollout:
Workflows started on v2.0.0 can now run on v2.0.1 workers.

Redirect Rules

Redirect rules force workflows from an old Build ID to a new one:
Use redirect rules carefully with long-running workflows. Redirecting to a version with nondeterministic changes will cause workflow task failures.

Deployment Workflow

1

Deploy new worker version

Start workers with new Build ID running alongside existing version:
2

Add new Build ID as default

Route new workflows to the new version:
3

Monitor new version

Verify new workflows execute successfully on v2.0.0.Check metrics:
  • Workflow success rate
  • Task failure rate
  • Error logs
4

Check reachability of old version

Determine if old workers are still needed:
Wait until REACHABLE_BY_NEW_WORKFLOWS is false.
5

Decommission old workers

Once old Build ID is no longer reachable, stop old workers:

Reachability API

The reachability API tells you if a Build ID can receive:
  • New workflows - Default assignment rule targets this ID
  • Existing workflows - Open workflows were started on this ID
  • Open workflow tasks - Workflow tasks from open workflows

Reachability States

bool
Build ID is the default and will receive new workflow starts
bool
Build ID has open workflows that may generate tasks
bool
Build ID has pending workflow tasks to process

Example: Check Reachability

Task Queue Versioning Data

Versioning data is stored per task queue:

User Data Table

Versioning rules stored in task_queue_user_data table:

Versioned Task Matching

Matching Service routes tasks based on Build ID:
  1. Worker polls with Build ID in PollWorkflowTaskQueue request
  2. Task added to queue with associated Build ID from workflow metadata
  3. Matching Service routes task to worker with matching Build ID
  4. Assignment rules consulted for compatible Build IDs
  5. Redirect rules applied if configured
See Matching Service for implementation details.

Best Practices

Clear versioning makes debugging and rollback easier:
  • v1.0.0, v1.0.1, v1.1.0 for releases
  • Include git SHA for traceability: v1.0.0-abc123
Bug fixes that don’t change workflow logic:
Run both versions at full capacity during rollout:
  • Deploy v2 workers at 100% capacity
  • Keep v1 workers at 100% capacity
  • Switch default assignment to v2
  • Monitor for issues
  • Decommission v1 when safe
Always check reachability before stopping workers:

Migrating from Version Sets

Version Sets are deprecated. Migrate to Build ID-based versioning.
Migration process:
  1. Stop using AddActivityTaskToVersionSet and AddWorkflowTaskToVersionSet
  2. Set Build IDs on workers using UseBuildIDForVersioning
  3. Convert Version Sets to Assignment Rules:
  4. Update clients to use Build ID APIs
  5. Remove Version Set configurations

See Also

Matching Service

Understand task routing with versioning

Workers

Learn about worker processes and polling

Task Queues

Understand task queue partitioning