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
Run multiple versions long-term
Run multiple versions long-term
If deployment frequency is low relative to workflow lifetime, you can afford running multiple versions for extended periods.
Break workflows into shorter segments
Break workflows into shorter segments
Use Continue-as-New with
UseAssignmentRules versioning intent so each new execution starts on the latest Build ID.Use patching for deterministic changes
Use patching for deterministic changes
Avoid nondeterministic changes by using Workflow Patching or
GetCurrentBuildID() along with redirect rules.Prerequisites
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:Compatible Versions
Mark Build IDs as compatible to enable gradual rollout:Redirect Rules
Redirect rules force workflows from an old Build ID to a new one:Deployment Workflow
Monitor new version
Verify new workflows execute successfully on v2.0.0.Check metrics:
- Workflow success rate
- Task failure rate
- Error logs
Check reachability of old version
Determine if old workers are still needed:Wait until
REACHABLE_BY_NEW_WORKFLOWS is false.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
Build ID is the default and will receive new workflow starts
Build ID has open workflows that may generate tasks
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 intask_queue_user_data table:
Versioned Task Matching
Matching Service routes tasks based on Build ID:- Worker polls with Build ID in
PollWorkflowTaskQueuerequest - Task added to queue with associated Build ID from workflow metadata
- Matching Service routes task to worker with matching Build ID
- Assignment rules consulted for compatible Build IDs
- Redirect rules applied if configured
Best Practices
Use semantic versioning for Build IDs
Use semantic versioning for Build IDs
Clear versioning makes debugging and rollback easier:
v1.0.0,v1.0.1,v1.1.0for releases- Include git SHA for traceability:
v1.0.0-abc123
Mark patch versions as compatible
Mark patch versions as compatible
Bug fixes that don’t change workflow logic:
Blue-green deployment strategy
Blue-green deployment strategy
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
Monitor reachability before decommission
Monitor reachability before decommission
Always check reachability before stopping workers:
Migrating from Version Sets
Migration process:- Stop using
AddActivityTaskToVersionSetandAddWorkflowTaskToVersionSet - Set Build IDs on workers using
UseBuildIDForVersioning - Convert Version Sets to Assignment Rules:
- Update clients to use Build ID APIs
- 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