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.
You can also start one yourself with POST /v2/sessions, then pass its session_id to a task or workflow run. See Preparing a session.
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
credential_id or source_id; the session doesn’t supply them. Runs in a session against the same source must use the same credential. To run against that source with a different credential, start a new session.
Preparing a session
To cut latency on the first run, start the session before your user is ready and pass asource_id:
POST /v2/sessions
session_id, and the agent can start the login from there. A workflow run ends the session when it finishes.
The session object includes source_id when one was passed. An unknown source_id returns source_not_found.
source_id is a hint, not a constraint:
- A run on the session can target any source. If it targets a different one, it still runs in the prepared session and the agent navigates to the run’s source. The session’s
source_idstays as passed. - The run still requires its own
credential_idorsource_id. - A prepared session counts toward your organization’s session limit, and follows the same timeout as any other. If no run arrives within 10 minutes, it closes. End it if your user leaves before running anything.
Staying logged in across sessions
Sessions always start from a clean environment, so a new session normally means a fresh login. If the credential has credential persistence enabled, Deck restores the credential’s saved login state into the new session, and the agent can pick up already logged in when the source honors it. This is a credential setting, not a session one: the session lifecycle described on this page is unchanged.Session statuses
Timeout
Sessions time out after 10 minutes of inactivity. Inactivity means no task runs are executing in the session. When the timeout elapses, the session is torn down automatically and transitions tocompleted.
To keep a session alive across multiple tasks, start the next run before the 10-minute window elapses.
Ending a session
completing and then to completed once teardown finishes. Any running task runs in the session are canceled as part of teardown.
You can only end a session that is queued, running, or idle. Ending a session that has already finished (completed or failed) returns an error.