SSH sessions must be enabled for your Baseten workspace. Contact support to request access. Remote tunnel sessions are available to all workspaces.
Configuration at a glance
Configure both methods on theInteractiveSession 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
InteractiveSession fields.
Trigger modes
Thetrigger field controls when the session’s container stays alive for interactive use, and applies to both SSH and remote tunnel sessions.
On-demand session activation
If you pushed a job withon_demand (the default), activate it by connecting:
- SSH: Connect with
ssh training-job-<job_id>-<node>.ssh.baseten.co. The session activates on first connection. - Remote tunnel: Complete the device code flow. Open the Auth URL and enter the Auth Code from
truss train isession.
Clone a private GitHub repository
Training jobs sometimes need code from a private GitHub repo: an internal library, a dataset loader, or the training script itself. The right flow depends on whether you’re connecting interactively or running unattended.With SSH agent forwarding
Best for interactive work over SSH. Agent forwarding doesn’t apply to interactive sessions, which connect through Remote Tunnels. Use the PAT flow for those. Load your GitHub-registered key into the local agent, then connect with-A:
~/.ssh/config block written by baseten ssh setup doesn’t include ForwardAgent yes. Pass -A on every connection, or append ForwardAgent yes to the Match host training-job-*.ssh.baseten.co block in ~/.ssh/config.
The SSH agent forgets added keys on reboot. On macOS, add keys to your login keychain to reload them automatically:
AddKeysToAgent yes and UseKeychain yes in ~/.ssh/config. On Windows, the OpenSSH ssh-agent service keeps added keys across reboots.
With a personal access token
Best when the repo needs to be pulled before you connect, for example fromstart_commands. Store a fine-grained GitHub PAT with Contents: Read-only as a Baseten secret, then inject it through a SecretReference:
config.py
x-access-token username is GitHub’s convention for token-based HTTPS auth. $GITHUB_PAT stays set for the container’s lifetime, so later git pull or git fetch commands reuse the same credential.
Session management
Both SSH and remote tunnel sessions share the same management commands.Session status
Check auth codes, connection status, and trigger: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:
Session timeout
Use--update-timeout to add minutes to the session expiry:
isession options.