Releases
Stage a new version of each workflow, then make them all current in one step, with any agents and schedules. Everything named moves, or nothing does.
Stage, then release
A release makes new versions of several workflows, and agents, current at once. Deploy each workflow with ?stage=1 first, then name the versions in one release.
# Stage each workflow (developer key).
# Answers {"versionHash", "staged": true, "warnings"}.
# Runs keep starting on the current version.
curl -X PUT "https://api.shiftlabs.org/v1/workflows/refund-check?stage=1" \
-H "authorization: Bearer $SHIFTLABS_API_KEY" \
--data-binary @refund-check.ts
curl -X PUT "https://api.shiftlabs.org/v1/workflows/refund-notify?stage=1" \
-H "authorization: Bearer $SHIFTLABS_API_KEY" \
--data-binary @refund-notify.ts
# Make both current together. Answers 201 {"release", "changed", "warnings", "unnamed"}.
curl -X POST https://api.shiftlabs.org/v1/releases \
-H "authorization: Bearer $SHIFTLABS_API_KEY" \
-H "content-type: application/json" \
-d '{
"workflows": {
"refund-check": "<versionHash>",
"refund-notify": "<versionHash>"
}
}'
A staged deploy is checked like any deploy: the scan, package builds (Python's and npm's) and your quotas all apply. The version is stored. Webhooks and manual runs keep starting on the current one until a release names it.
A deploy with new Python packages or npm packages answers 202 with a deployId. When GET /v1/deploys/:id shows live, the version is stored, still staged, and result.versionHash is the hash to release. A staged version of a workflow that has never been current can be dropped after a day. Release it before then.
What a release changes
Everything is checked before anything changes. A release that is refused changes nothing.
- The body
{"workflows": {"name": "versionHash"}}names up to 50 workflows, each with the full 64-characterversionHashof one of its stored versions. A hash that isn't a stored version of that workflow returns409with the workflow's name."agents"can name agents beside them, and"schedules"replaces the workspace's schedules. A release names at least one workflow or agent, or sendsschedules. - All or nothing
Every workflow, agent and schedule named moves in one step, or none does.
- Runs
Webhooks and manual runs start on the new versions from then on. Runs already queued or sleeping finish on the version they started on.
- New workflows
A workflow that has never been current needs a free workflow slot, to be staged and again to be released. Over your quota, the release returns
403 {"error": "quota exceeded", "limit": "workflows", "max"}. - Nothing to change
If every workflow and agent named is already current as named, and the schedules sent are the ones in place, no release is recorded and the response is
200 {"release": null, "changed", "current", "warnings", "unnamed"}. A CI job can send the same release on every push.currentis the release that already has them, if one of the last 20 does. - Nothing deleted
A workflow or agent the release doesn't name stays as it is. The response's
unnamedlists them. Delete a workflow on the dashboard's Workflows screen or withDELETE /v1/workflows/:workflow. Delete an agent on its page on the dashboard's Agents screen or withDELETE /v1/agents/:agent. - One workflow
A deploy without
?stage=1andPOST /v1/workflows/:workflow/rollbackstill change one workflow at once. They aren't releases and don't appear in the history.
Agents in a release
A release can name agents beside workflows, each with its full definition. shiftlabs deploy and a template's Deploy make such releases.
# Developer key. Answers 201 {"release", "changed", "warnings", "unnamed"}.
curl -X POST https://api.shiftlabs.org/v1/releases \
-H "authorization: Bearer $SHIFTLABS_API_KEY" \
-H "content-type: application/json" \
-d '{
"workflows": {"lookup-invoice": "<versionHash>"},
"agents": {"billing": {
"title": "Billing assistant",
"instructions": "Answer questions about invoices. Look them up first.",
"model": "@cf/zai-org/glm-4.7-flash",
"tools": [{
"workflow": "lookup-invoice",
"description": "Look up an invoice by its id.",
"approval": "never"
}]
}}
}'
- An agent whose definition matches its current version keeps that version. A new or changed one gets the next version number.
- Each workflow tool must name a workflow that exists once the release is in, deployed before or named in the same release. Otherwise the release returns
409. - Each workflow tool in a new definition must set
approval. One without returns400 {"error": "invalid release", "detail"}, naming the agent and the tool. A rollback makes the versions it names current as they were stored. - Naming agents needs agents turned on (
400otherwise), theagent.deploycapability and models your plan includes (403 {"error": "plan", "detail"}). - An agent whose model or fallback Workers AI retires within 30 days is released, with a sentence for each in the response's
warnings. One naming a retired model returns400, or409for a rollback. - A new agent needs a free agent slot. Over your quota, the release returns
403 {"error": "quota exceeded", "limit": "agents", "max"}. - A release, rollback or promotion that names an agent in the trash returns
409with the item intrash. - Rolling back a release makes its agent versions current again. One whose fallback is of a lower tier than its model, possible for a version deployed before that rule, can't be: the rollback returns
409. - Rolling back to a release holding an agent named
shiftlabsorshiftlabs-draft, which a release made before those names were reserved can, returns400with the text its deploy gets, and changes nothing.
Schedules in a release
"schedules" maps each schedule's name to its definition, and replaces every schedule the workspace has. Leave it out and the schedules stay as they are; send {} to remove them all. shiftlabs deploy sends the project's schedules, and the dashboard's Schedules screen sends the whole set with each edit.
# Developer key. Answers 201 {"release", "changed", "warnings", "unnamed"}.
curl -X POST https://api.shiftlabs.org/v1/releases \
-H "authorization: Bearer $SHIFTLABS_API_KEY" \
-H "content-type: application/json" \
-d '{
"schedules": {
"nightly": {
"workflow": "sync",
"cron": "0 3 * * *",
"timezone": "America/Detroit",
"payload": {"full": true}
},
"monday-summary": {
"agent": "billing",
"message": "Summarize the refunds from last week.",
"cron": "0 9 * * 1"
}
}
}'
- A workflow schedule is
{"workflow", "cron", "timezone"?, "payload"?, "overlap"?, "jitter"?, "catchup"?, "pauseOnFailure"?}; an agent schedule is{"agent", "message", "cron", "timezone"?, "jitter"?, "catchup"?}.timezonedefaults toUTCandpayloadto{}; the options left out keep a schedule working as before. A bad field returns400 {"error": "invalid release", "detail"}, such asschedules.nightly: cron: minute: 60 is outside 0-59. - Only the schedules a release adds, changes or removes are checked. Schedules it leaves as they are never block it, for example after agents were turned off or the workspace moved to a smaller plan. A
schedulesthat changes nothing is ignored. - Each added or changed schedule's workflow or agent must exist once the release is in: deployed before, or named in the same release. Otherwise the release returns
409. A workflow schedule'spayloadmust pass that workflow's payload schema (400). It is checked again whenever a release or rollback changes that workflow's version, whether or not it sendsschedules. - If another release replaces the schedules while one that changes them is being checked, the later one returns
409and changes nothing. Send it again. - Your plan sets how many schedules you can have and how often each can run:
403 {"error": "quota exceeded", "limit": "schedules", "max"}when a release adds more than your plan allows, or403 {"error": "plan", "detail"}for an added or changed cron that runs too often. See Schedules. - An added or changed workflow schedule needs the
run.startcapability. An agent schedule needs agents turned on (400otherwise) and theagent.deploycapability. Developers hold both. - Rolling back a release puts its schedules back in place of the current ones, their options included. A release made before schedules existed recorded none, so rolling back to it leaves the current schedules as they are. Only a release that recorded
{}removes them all. - Whether a schedule is paused isn't part of a release. A release or rollback that changes a paused schedule keeps it paused, one that removes it drops the pause, and none pauses or resumes one.
History and rollback
Each release gets the next number, its seq. A rollback releases an earlier release's versions again, as a new release. The dashboard's Releases screen lists the same history, and developers and admins can roll back from a release there.
# The newest releases first, 20 at most.
curl https://api.shiftlabs.org/v1/releases \
-H "authorization: Bearer $SHIFTLABS_API_KEY"
# Make release 3's versions current again.
# Answers 201 {"release", "changed", "warnings"}, with the new release's seq.
curl -X POST https://api.shiftlabs.org/v1/releases/3/rollback \
-H "authorization: Bearer $SHIFTLABS_API_KEY"
release{seq, workflows, agents, schedules, releasedBy, releasedByName, releasedAt, cliVersion, promotedFrom}: its number, each workflow's version hash, each agent's version number, every schedule in place after it (null for a release made before schedules), the email of the person or the id of the API key that released it, that key's name (null for a person), the time in milliseconds since the epoch, the version of the CLI that made it (null when the dashboard, the API or MCP made it), and for a promoted release{workspace, release}of the release it copies (null otherwise).changed.workflows·changed.agents·changed.schedulesEach
{name, from, to}that moved: a version hash for a workflow, a version number for an agent, a definition for a schedule.fromis null for one the release made current for the first time, and a schedule'stois null when the release removed it.release: nullNothing moved and nothing was recorded.
currentis the newest release that names the same workflow versions, agent versions and schedules, or null. CI uses it to find the release a commit is in.warningsA sentence for each model or fallback that retires within 30 days, of every agent the release names, or for a rollback of each agent whose version it changes.
shiftlabs deployprints them.unnamed{workflows, agents}: the names of the workspace's workflows and agents thatPOST /v1/releasesdidn't name, which it left as they are. Only names your key can see: it needsworkflow.viewfor workflows andagent.viewfor agents, and a scoped key lists only its own. A rollback's response has none.shiftlabs deployprints them.
We keep the last 20 releases and every workflow version they name. Rolling back to a release that names a workflow deleted since returns 409. While the workflow is in the trash, the 409 names the trash, and restoring the workflow makes the rollback work again. Once the trash erases it, its versions are gone with it.
| Route | Method | Minimum role |
|---|---|---|
/v1/releases the newest first; ?limit= from 1 to 20, default 20 | GET | viewer |
/v1/releases {"workflows": {"name": "versionHash"}, "agents": {"name": definition}, "schedules"?: {"name": schedule}}, up to 50 workflows | POST | developer |
/v1/releases/:seq one release, or 404 {"error": "release not found"} | GET | viewer |
/v1/releases/:seq/rollback no body; that release's versions and schedules, current again as a new release | POST | developer |
/v1/releases/:seq/promote {"to": "workspace"}; that release, as a new release in a linked workspace, or 202 with the approval request there | POST | admin, or admin key with release.promote |
/v1/releases/:seq/promote ?to=workspace; the newest approval request for that release there, and what became of it | GET | admin, or admin key with release.promote |
/v1/links this workspace's links, each with workspace, direction, status, since and promotions | GET | viewer |
/v1/links/:workspace {"direction": "to" | "from"}; adds this workspace's side of a link | PUT | admin, or admin key with workspace.link |
/v1/links/:workspace {"promotions": "approve" | "direct"}; the workspace promoted to decides whether promotions wait for its approval | PATCH | admin, or admin key with workspace.link |
/v1/links/:workspace removes the link, from either side | DELETE | admin, or admin key with workspace.link |
/v1/schedules the current schedules, each with nextAt, lastAt, lastRun, lastConversation and lastError, the options it has, pausedAt, pausedBy, pauseNote, buffered and its latest backfill | GET | viewer |
- Viewers can list and read releases. Developers and admins release and roll back.
- A key whose
scopenames some workflows or agents can release only those. An agent's tools, and the workflow or agent of each schedule the release adds, changes (before and after) or removes, must be among them. It sees and rolls back only releases whose every workflow and agent, and every schedule they changed, it reaches, and gets403for any other. - Each release is written to the audit log as
release, with what changed and, for a rollback,rollbackOf. - Staged deploys count like any deploy: toward 20 deploys a minute and the new versions you can add in 24 hours. See Rate limits.
Linked workspaces
Run staging and production as two workspaces, such as acme-staging and acme-production, and link them. Releases of acme-staging can then be promoted to acme-production.
# An admin key of acme-staging.
# Answers 201 {"workspace", "direction": "to", "status": "waiting"}.
curl -X PUT https://api.shiftlabs.org/v1/links/acme-production \
-H "authorization: Bearer $STAGING_ADMIN_KEY" \
-H "content-type: application/json" \
-d '{"direction": "to"}'
# An admin key of acme-production.
# Answers 201 {"workspace", "direction": "from", "status": "active"}.
curl -X PUT https://api.shiftlabs.org/v1/links/acme-staging \
-H "authorization: Bearer $PRODUCTION_ADMIN_KEY" \
-H "content-type: application/json" \
-d '{"direction": "from"}'
"direction": "to"means this workspace promotes to the other one."from"means the other one promotes to this one.- An admin of each workspace adds the link in their own workspace. It is
activeonce both have. Until then it iswaitingin the workspace that added it andrequestedin the other. - An id that isn't a workspace answers the same
201 waitingas a workspace whose admins haven't answered, so links can't be used to find out which workspaces exist. A link added before its other workspace exists is removed when that workspace is created, whoever creates it. Add the link again once the workspace you meant exists. - An admin of either workspace removes it with
DELETE /v1/links/:workspace, whatever its status. Promotions stop at once, and requests waiting for an approval are never applied. - Two workspaces share at most one link, in one direction:
409 {"error": "linked the other way"}otherwise. A workspace can promote to several and receive from several, so dev, staging and production can form a chain. - A workspace adds at most 10 links:
403 {"error": "quota exceeded", "limit": "links", "max": 10}. Links another workspace requested don't count. Requests to one workspace are limited to 10 a minute:429 {"error": "rate limited"}. GET /v1/linkslists{workspace, direction, status, since, promotions}for any role. Adding, changing and removing need theworkspace.linkcapability. A signed-in admin holds it. An API key holds it only when an admin lists it in the key'scapabilities, so admin keys made without a list can't link.- Each workspace's audit log records the changes made in it as
workspace_link,workspace_unlinkandlink_promotions_set, with who made them. The other workspace's log records a change only when it makes the link active or removes it, at most once an hour. - In the dashboard: Workspace → Linked workspaces.
Approve or direct
The workspace promoted to decides how promotions reach it, for each link. An admin there sets it with PATCH /v1/links/:workspace {"promotions": "approve" | "direct"}, or in the dashboard. The promoting workspace sees the setting and can't change it: 409 {"error": "set by the workspace promoted to"}.
- approve, the default
Each promotion waits in the target's Approvals until someone there approves it. Admins of the promoting workspace, and its keys that list
release.promote, can ask for a promotion, but they can't change the target's code. A key that leaks there fills the target's inbox at worst. - direct
Each promotion applies at once. Anyone who can promote from the other workspace then decides what code the target runs, and that code runs with the target's secrets. Choose it only when the promoting workspace is guarded as well as the target, such as when the same admins run both. The dashboard asks you to confirm and says so.
- Either way, the target's secrets, vars, connections, members, keys and limits stay its own, and its audit log records every promotion.
- Switching is recorded in the target's audit log as
link_promotions_set, with the new setting and who chose it.
Promote a release
A promotion copies a release to a linked workspace as a new release there. Test a release in acme-staging, then promote that exact release to acme-production.
# An admin key of acme-staging that lists release.promote.
# Answers 201 {"release", "changed", "workspace"}, or 202
# {"status": "waiting for approval", "approval", ...} where acme-production
# approves promotions.
curl -X POST https://api.shiftlabs.org/v1/releases/12/promote \
-H "authorization: Bearer $SHIFTLABS_API_KEY" \
-H "content-type: application/json" \
-d '{"to": "acme-production"}'
- What it copies
Each workflow version the release names, byte for byte, so it has the same
versionHashin both workspaces. The release's agent definitions with their code, and its schedules, which replace the target's as a rollback does. Each workflow's connections are linked as they are in the source. - What stays
Secrets, vars, connections, API keys, members, limits and audit logs belong to each workspace. Nothing of them is copied.
- Checks
The target must have every secret and var the versions read that the source has, with each secret scoped to the workflows that read it, and every connection their workflows are linked to. Otherwise nothing changes and the answer is
409 {"error": "missing names", "workspace", "missing": {"secrets", "vars", "connections", "unscoped"?}, "detail", "hint"}, such as"detail": "acme-production has no secret STRIPE_KEY or connection twilio".unscopedlists{"secret", "workflow"}for a secret the target has but hasn't scoped to that workflow, and the detail sayssecret STRIPE_KEY is not scoped to workflow refund-check in acme-production. Then the target's plan and quotas apply, as to any release. - The new release
It gets the target's next number and records
promotedFrom: {"workspace", "release"}, with"approval"when an approval let it in. ItsreleasedByis whoever promoted it. - Nothing to change
When the target already runs those versions and schedules, no release is recorded:
200 {"release": null, "changed", "current"}.
- Promoting needs the
release.promotecapability. A signed-in admin holds it. An API key holds it only when an admin lists it in the key'scapabilities: for CI, a key with["release.promote"]alone. Admin keys made without a list, developer keys and keys limited to some workflows or agents can't promote. - The link must be active, or the answer is
403 {"error": "not linked"}. A suspended target answers403 {"error": "workspace suspended"}. - Names are read from the code as
secrets.NAME,secrets["NAME"],reveal("NAME"),sign("NAME", …),vars.NAMEandvars["NAME"], in TypeScript and Python. Names read any other way aren't checked. - The target's limits apply as on a deploy: its workflows, agents, schedules and versions per 24 hours, the models its plan includes, and its concurrent runs for a workflow's concurrency.
- The code is scanned again, as a deploy is (
400 {"error": "deploy blocked by the code scan"}). A version on a runtime that takes no new deploys returns409. Deploy it again, release it, and promote that release. - A release holding an agent named
shiftlabsorshiftlabs-draft, which a release made before those names were reserved can, returns400with the text its deploy gets, and a request for it waiting for approval fails when approved. - The source's audit log records
release_promote. The target's records the newrelease, withpromotedFromand who promoted it. - On the dashboard's Releases screen, a release's popup has Promote to … for each active link.
- Deploy from GitHub deploys to staging on every push to
mainand promotes on a tag.
Promotion approvals
Where the target approves promotions, a promotion is a request in the target's Approvals, beside agents' and workflow runs' requests. Every check runs first, so a request that can't apply is refused at once, as a direct promotion is.
# Answers 202 {"status": "waiting for approval", "approval", "workspace",
# "requestedBy", "expiresAt", "changes", ...}.
curl -X POST https://api.shiftlabs.org/v1/releases/12/promote \
-H "authorization: Bearer $SHIFTLABS_API_KEY" \
-H "content-type: application/json" \
-d '{"to": "acme-production"}'
# The newest request for release 12 there: status waiting for approval,
# approved, applied, denied, expired or failed.
curl "https://api.shiftlabs.org/v1/releases/12/promote?to=acme-production" \
-H "authorization: Bearer $SHIFTLABS_API_KEY"
- What approvers see
The promoting workspace, its release number, who asked, and
changes, each with its value there now and after: - Workflows: the version hashes. - Agents: the version in the promoting workspace, with the hashes of its definition and code. - Schedules: when each runs, and what it sends. - Connections: the ones each promoted workflow is linked to. - Who approves
Members and keys of the target with
approval.decidethat may deploy all of it (workflow.deploy, noscope), in the dashboard, with the API or in Slack. It needs the approvals the target's Settings → Approvals asks for. The request goes out in approval notices like any other. - Approved
Everything is checked again with the target as it is then: the link, its names, its plan and its quotas. Then the release is applied once, with
promotedFrom: {"workspace", "release", "approval"}. The request's status becomesapplied, with the newrelease. - Not applied
A denied request, one nobody answered within 72 hours, and one whose checks fail when it's approved apply nothing. The status says
denied,expiredorfailed, witherroranddetailfor a failure.
- A request is never applied after its link is removed, or removed and added again: it fails with
"error": "not linked". - Nothing is applied unless it is what was approved:
- If the promoting workspace links a promoted workflow to other connections, the request fails with
connections changed since the request. - If the target deploys or links something the request would change, it fails withtarget changed since the request. - Promote again to ask for the changes as they are then. - A promotion that changes no workflow, agent or schedule there asks nobody and changes nothing:
200 {"release": null}. - Each request counts toward the target's 20 deploys a minute, so another workspace can't bury its Approvals. See Rate limits.
- Promoting a release that already waits there answers the same request. Once it's answered, promoting again makes a new one.
- Both audit logs record what became of each request:
releaseandrelease_promotewith the approval, orpromotion_denied,promotion_expiredorpromotion_failedwith the reason. Only the target's names who answered it. The promoting workspace sees the status and the note, never who decided. Itschangeslist only what it sends: each change'sto. They leave out the target's current versions, schedules and connections, and the target's schedules the release would remove. shiftlabs promote 12 --to acme-production --waitwaits for the answer and exits7unless the release is applied. The GitHub Action takeswait: true.