Expiration
An expiration time makes ctrl stop or delete a Workspace automatically when it arrives. This page shows how to set, change, and clear it, at creation, on its own, or together with start and stop.
Setting at creation
Create a Workspace that expires eight hours after ctrl accepts the command:
kibo workspace create --template "$template_id" --expires-in 8h- The countdown starts when ctrl accepts the command and includes the time creation takes.
- Without
--expires-in, no expiration time is set. - Accessing files or running commands does not extend the expiration time.
kibo transfer restoreaccepts the same parameters.
--expiration-action chooses what happens at the expiration time:
| Action | Result |
|---|---|
stop (default) | The Workspace stops. Its Volumes and writable layer are kept |
delete | The Workspace is deleted |
Warning
A new Volume is deleted with the Workspace by default. With --expiration-action delete, the data in /data disappears when the Workspace expires.
Expiration actions are carried out by ctrl, so exiting kibo does not affect them.
Viewing the expiration
Show the Workspace and its expiration:
kibo workspace expiration get "$workspace_id"The expiration in the output of kibo workspace get and list contains:
| Field | Meaning |
|---|---|
revision | The revision of the expiration setting. It only increases. It exists even when no expiration time is set |
expires_at | The expiration time |
action | The expiration action: delete or stop |
claimed_command_id | The ID of the command, once ctrl has started carrying out the expiration action |
Changing it separately
Set a new expiration time and action, or clear the expiration time:
workspace_id=workspace-example
kibo workspace expiration set "$workspace_id" --expires-in 20m --expiration-action delete
kibo workspace expiration clear "$workspace_id"Which change is allowed depends on the Workspace state:
| State | expiration set | expiration clear |
|---|---|---|
AVAILABLE | Yes | Yes |
STOPPED | No | Yes |
FAILED, no longer holding an execution and not yet being deleted | No | Yes |
A FAILED Workspace can keep an expiration time, for example when a start failed during placement and left behind the expiration time set at start.
Important
Once ctrl has started carrying out the expiration action, you can no longer cancel it by extending the time.
Setting with start and stop
kibo workspace start and stop also accept --expires-in and --expiration-action, or --clear-expiration to clear the expiration time. The two groups of parameters are mutually exclusive.
Stop a Workspace and leave it without an expiration time, or start it with an expiration time for this run:
# Stop, and leave the stopped Workspace without an expiration time.
kibo workspace stop "$workspace_id" --clear-expiration
# Start, and set an expiration time for this run. Start time counts toward it.
kibo workspace start "$workspace_id" --expires-in 30m --expiration-action stop- The expiration setting is submitted in the same operation as the command. There is no intermediate state of "started but without an expiration time yet", and you do not need to run
expiration setagain after success. - When the command succeeds, the revision goes up by one, and the response carries the new
expiration.revisionandexpires_at. A failed command does not change the expiration setting. - Expiration parameters are part of the command input. The same command ID with a different
--expires-inis treated as a conflict and does not silently extend the time.
Without expiration parameters
| Command | Effect on the expiration setting |
|---|---|
stop | Consumes a stop-type expiration setting and keeps a delete-type one |
start | Does not change the expiration setting and does not restore a consumed one |
Expected revisions
These commands carry the revision of the expiration setting they expect, expiration.revision:
| Command | Flag |
|---|---|
kibo workspace expiration set, clear | --expected-revision |
kibo workspace start, stop, delete | --expected-expiration-revision, which must be positive when passed |
- Without the flag,
kiboreads the current revision before submitting. A value you pass is submitted as is. - A revision mismatch returns
failed_precondition. Forexpiration setandclear, a disallowed state returns the same code; tell the two apart byobserved_workspacein the error details. - When you get
failed_precondition, read the Workspace again before deciding. Do not overwrite the new state with the old intent.
For a script that needs to replay, pass --command-id together with the expected revision:
revision=$(kibo --json workspace get "$workspace_id" | jq -er '.result.expiration.revision')
kibo workspace expiration set "$workspace_id" --command-id renew-example \
--expected-revision "$revision" --expires-in 20mWith the API
kibo command | API | Expected revision field |
|---|---|---|
workspace expiration set, clear | UpdateWorkspaceExpiration | expected_revision |
workspace start, stop, delete | StartWorkspace, StopWorkspace, DeleteWorkspace | expected_expiration_revision |
Both fields correspond to expiration.revision.
Next steps
- Lifecycle: what stop, start, and delete do to a Workspace.
- Volumes, export, and restore: which Volumes are deleted with a Workspace.
- kibo CLI: command IDs and replaying a command safely.
Resources and health
This page shows how to change the CPU, memory, and disk of a Workspace, which task and memory limits apply inside the guest, how to tell whether the guest still responds or is stuck on memory, and how to read resource metrics over time.
Lifecycle
You stop, start, and delete a Workspace with the Go SDK, the E2B SDK, or kibo. In the Go examples, settleOptions resends a command while ctrl says it is still executing, as in examples/go/quickstart. This page also covers force stops, checking what a stop or deletion released, recovering a FAILED Workspace, and the cases where the server stops or restarts a Workspace on its own.