Versioning & Migration
Sequences are versioned. Running instances are bound to the version that was active when they were created. New versions deploy without touching in-flight instances — they keep running on their original definition.
Version lifecycle
- ✓Each sequence has a version field and a unique index on (tenant_id, name, version)
- ✓New instances bind to the latest non-deprecated version at creation time
- ✓Running instances complete on their original version — immutable binding
- ✓Deprecate a version: POST /sequences/{id}/deprecate — blocks new instances on that version
- ✓List all versions: GET /sequences/versions
Hot migration
Rebind a running instance to a new sequence version without stopping it. The new definition applies at the next step boundary.
POST /sequences/migrate-instance
{
"instance_id": "<uuid>",
"target_sequence_id": "<new-version-uuid>"
}
// Response
{
"migrated": true,
"instance_id": "<uuid>",
"from_sequence_id": "<old-uuid>",
"to_sequence_id": "<new-uuid>"
}Only non-terminal instances (not Completed, Failed, or Cancelled) can be migrated. Terminal instances return a 422 error.
Dynamic step injection
Add blocks to a running instance at runtime. Injected blocks are stored in metadata._injected_blocks and executed after the current position in the sequence. Designed for AI agent workflows where the next step is determined dynamically.
POST /instances/{id}/inject-blocks
{
"blocks": [
{
"type": "step",
"id": "dynamic_followup",
"handler": "send_email",
"params": { "template": "agent-suggested-followup" }
}
],
"inject_after": "current"
}