Skip to main content
Baseten offers two ways to connect to a running training container: SSH for terminal sessions and file transfer, and rSSH for IDE-based debugging in VS Code or Cursor.
MethodBest forRequirements
SSHTerminal sessions, file transfer with scp or sftp, scriptingOpenSSH client, truss ssh setup run once
rSSH (interactive sessions)Debugging and editing inside an IDEVS Code or Cursor with the Remote - Tunnels extension, a Microsoft or GitHub account
SSH sessions must be enabled for your Baseten workspace. Contact support to request access. rSSH is available to all workspaces.

Configuration at a glance

Configure both methods on the InteractiveSession field of your TrainingJob. Set session_provider to choose the connection method. These examples set trigger=ON_STARTUP so the session is available from job start; the default is ON_DEMAND, covered in Trigger modes:
config.py
from truss_train.definitions import (
    InteractiveSession,
    InteractiveSessionTrigger,
    InteractiveSessionProvider,
)

# SSH: connect from any OpenSSH client
interactive_session=InteractiveSession(
    trigger=InteractiveSessionTrigger.ON_STARTUP,
    session_provider=InteractiveSessionProvider.SSH,
)

# rSSH (default): connect from VS Code or Cursor
interactive_session=InteractiveSession(
    trigger=InteractiveSessionTrigger.ON_STARTUP,
    session_provider=InteractiveSessionProvider.VS_CODE,
)
For more information, see the SDK reference for all InteractiveSession fields.

Trigger modes

The trigger field controls when the session’s container stays alive for interactive use, and applies to both SSH and rSSH.
ModeWhen to useBehavior
on_startupDevelop interactively, run commands, or test code while training runs.Session is active from job start. Your start_commands still run alongside the session.
on_failureDebug a failing training run. Your most common choice for production jobs.Session activates when training exits with a non-zero exit code. The container stays alive for you to inspect the failure.
on_demandDecide later whether you need a session. This is the default.Session activates when you connect (SSH) or authenticate through the device code flow (rSSH), or when you change the trigger on a running job.

On-demand session activation

If you pushed a job with on_demand (the default), activate it in one of two ways:
  • SSH: Connect with ssh training-job-<job_id>-<node>.ssh.baseten.co. The session activates on first connection.
  • rSSH: Complete the device code flow. Open the Auth URL and enter the Auth Code from truss train isession.
You can also activate a session by changing the trigger on a running job:
truss train isession --job-id <job_id> --update-trigger on_startup

Session management

Both SSH and rSSH sessions share the same management commands.

Session status

Check auth codes, connection status, and trigger:
truss train isession --job-id <job_id>
For SSH sessions, the auth code columns are empty. SSH uses certificate-based auth instead of device codes.

Live session logs

The --tail flag on truss train logs displays a live view with the session table pinned at the top and training logs streaming below:
truss train logs --job-id <job_id> --tail

Session timeout

Use --update-timeout to add minutes to the session expiry:
truss train isession --job-id <job_id> --update-timeout 120
See the CLI reference for all isession options.