How sessions fit in
When you run a task, Deck creates a session (or reuses one you specify) and executes the work. The session manages the compute lifecycle so your application doesn’t have to.Session lifecycle
Sessions are created implicitly when a task runs. You don’t need to create them ahead of time. The response includes asession_id you can reuse.
Reusing a session
To run additional tasks in the same session, pass thesession_id from a previous task run:
POST /v2/tasks/{task_id}/run
Session statuses
| Status | Meaning |
|---|---|
queued | Waiting to be provisioned |
running | Active and executing work |
completing | Work is done, session is shutting down |
completed | All work finished and the session was closed |
failed | The session encountered an error |
Ending a session
completed. Any running task runs in the session will be canceled.
Sessions are also cleaned up automatically after the last task run completes or after a period of inactivity, so ending a session explicitly is optional.
