| Scope | Use this when | API surface |
|---|---|---|
| Command-scoped | Variables should apply to one command only | tl sbx exec --env KEY=VALUE ..., sandbox.run(..., env=...) |
| PTY-scoped | Variables should apply to one interactive PTY session only | tl sbx ssh --env KEY=VALUE ..., create_pty(..., env=...) / createPty({ env: ... }) |
Prerequisites
- You have the
tlCLI installed and authenticated. - You have a running sandbox connection in the CLI, Python, or TypeScript.
- You already set
TENSORLAKE_API_KEYin 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.- CLI
- Python
- TypeScript
2. Env vars when creating a PTY session
Use PTY-scoped env when you need custom variables inside one interactive terminal session.- CLI
- Python
- TypeScript
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
envfor interactive terminal sessions.