> ## Documentation Index
> Fetch the complete documentation index at: https://docs.baseten.co/llms.txt
> Use this file to discover all available pages before exploring further.

# Manage interactive sessions

> Check a training job's interactive sessions, change a session's trigger on a running job, extend its expiry, and see when it ends.

An interactive session keeps a training container available for [SSH](https://docs.baseten.co/training/ssh.md) or a [VS Code or Cursor remote tunnel](https://docs.baseten.co/training/interactive-sessions.md). The session activates according to its [trigger mode](https://docs.baseten.co/training/remote-access.md#trigger-modes) and expires when its timeout runs out.

## Prerequisites

* A running training job with an interactive session. See [Session configuration](https://docs.baseten.co/training/remote-access.md#session-configuration) to add one.
* The [Baseten CLI](https://docs.baseten.co/reference/cli/baseten/overview.md#install) with [uv](https://docs.astral.sh/uv/) on your `PATH`. The [`baseten truss`](https://docs.baseten.co/reference/cli/baseten/truss) commands on this page fetch Truss through uv.

## Check session status

To see each replica's live session, auth URL, and expiry, run:

```bash theme={"system"}
baseten train job session describe --job-id <job_id>
```

The command prints one row per replica, with the columns `REPLICA`, `SESSION`, `AUTH URL`, and `EXPIRES`. `EXPIRES` stays empty until the tunnel authenticates. If no session is live, it prints `No interactive sessions found.`

To print each replica's auth code as well, run:

```bash theme={"system"}
baseten train job session describe --job-id <job_id> --jq '.auth_codes[] | {replica_id, auth_code, auth_url}'
```

The command lists remote tunnel sessions only. An SSH session doesn't appear in it, even while you're connected; to check an SSH session, connect to it.

## Session expiry

A session expires [`timeout_minutes`](https://docs.baseten.co/reference/sdk/training#param-timeout-minutes) after it starts. The default is 480 minutes, or 8 hours.

To choose the length before you push the job, set `timeout_minutes` on the job's [`InteractiveSession`](https://docs.baseten.co/reference/sdk/training#interactivesession); see [Configure an interactive session](https://docs.baseten.co/training/interactive-sessions.md#configuration) for the CLI and SDK examples. Set it to `-1` to extend the expiry to 10 years. [`baseten train workstation create`](https://docs.baseten.co/reference/cli/baseten/train) sets neither, so a workstation's session uses the default.

How the expiry behaves depends on the session type:

| Session type | Expiry |
| - | - |
| SSH | Fixed when the session starts. Reconnecting doesn't extend it. |
| Remote tunnel | Set to `now + timeout_minutes` when the tunnel starts, and reset on every tunnel reconnect. Idle time in a connected IDE doesn't reset it. |

When the expiry passes, Baseten signals the container to shut down gracefully, and you lose everything in the container's local filesystem. Where your work survives depends on the job's configuration: a job with [`cache_config`](https://docs.baseten.co/reference/sdk/training#param-cache-config) enabled has [`$BT_PROJECT_CACHE_DIR`](https://docs.baseten.co/reference/sdk/training#environment-variables), and a job with [checkpointing](https://docs.baseten.co/training/concepts/checkpoints.md#enable-checkpointing) enabled has [`$BT_CHECKPOINT_DIR`](https://docs.baseten.co/reference/sdk/training#environment-variables), which Baseten syncs to storage. A job with neither has no persistent directory in the container, so [copy out the files you want to keep](https://docs.baseten.co/training/ssh.md#file-transfer) before the expiry.

## Change the session trigger

The Baseten CLI has no command that changes a session's trigger or timeout. The commands on this page with the `baseten truss` prefix run the Truss CLI with your Baseten CLI login.

These commands reach remote tunnel sessions only. For a job with an SSH session, they print `No auth codes found for this job.`

To change the trigger on a running job, for example to activate an `on_demand` session, run:

```bash theme={"system"}
baseten truss train isession --job-id <job_id> --update-trigger on_startup
```

The command prints `✓ Successfully updated 1 session(s)` when it changes the session. You can't change the trigger of an `on_startup` session.

## Extend a session

To add minutes to a remote tunnel session's expiry, run:

```bash theme={"system"}
baseten truss train isession --job-id <job_id> --update-timeout 120
```

The command adds 120 minutes to the expiry and prints `✓ Successfully updated 1 session(s)`. Baseten sets an SSH session's expiry when the session starts, so set `timeout_minutes` before you push the job instead; see [Session expiry](#session-expiry).

## Next steps

* [Monitor training jobs](https://docs.baseten.co/training/management.md): Stream a job's logs while you work in a session.
* [Stop or recreate a job](https://docs.baseten.co/training/stop-jobs.md): Stop the job when you finish, so it stops billing.
