Skip to main content
Use this page as a quick reference for environment variable scopes in Sandboxes. For endpoint-level and workflow details, also see Execute Commands and PTY Sessions.

Prerequisites

  • You have the tl CLI installed and authenticated.
  • You have a running sandbox connection in the CLI, Python, or TypeScript.
  • You already set TENSORLAKE_API_KEY in your local environment.

1. Env vars for a single command in a sandbox

Use command-scoped env when values should not persist across all sandbox processes.

2. Env vars when creating a PTY session

Use PTY-scoped env when you need custom variables inside one interactive terminal session.
tl sbx ssh always creates a PTY session with defaults like TERM and COLORTERM=truecolor; your --env values are merged in and can override those defaults.

Choosing the right scope

  • Use run(..., env=...) for one-off command values.
  • Use PTY env for interactive terminal sessions.