Description
sbx exec supports Docker-style environment flags:
-e, --env to set environment variables
--env-file to read environment variables from a file
It would be useful for sbx run to support the same flags when starting an agent sandbox.
Current Behavior
The sbx exec command can pass environment variables into a command that runs inside an existing sandbox:
sbx exec -e NODE_ENV=development my-sandbox node script.js
sbx exec --env-file .env my-sandbox node script.js
However, sbx run does not currently provide equivalent flags for passing environment variables when creating or starting an agent sandbox.
Requested Behavior
Allow environment variables to be passed when creating or starting a sandbox through sbx run, for example:
sbx run -e NODE_ENV=development claude .
sbx run --env-file .env claude .
This would make sbx run more consistent with sbx exec and Docker-style workflows, and would avoid needing a separate sbx create / sbx exec step just to inject environment configuration.
Use Cases
- Passing API keys or tokens into agent sandboxes
- Loading project-specific .env files
- Setting language/runtime configuration such as NODE_ENV, PYTHONPATH, RUST_LOG, etc.
- Keeping sandbox startup behavior consistent with sbx exec
Suggested Behavior
- -e/--env KEY=VALUE may be provided multiple times
- --env-file PATH may be provided multiple times, or follow the same behavior as docker run --env-file
- Environment variables should apply when the sandbox is run (not only created) and be available to the initial agent process
This would make sbx run more ergonomic for common development and agent workflows.
Description
sbx execsupports Docker-style environment flags:-e, --envto set environment variables--env-fileto read environment variables from a fileIt would be useful for
sbx runto support the same flags when starting an agent sandbox.Current Behavior
The
sbx execcommand can pass environment variables into a command that runs inside an existing sandbox:However, sbx run does not currently provide equivalent flags for passing environment variables when creating or starting an agent sandbox.
Requested Behavior
Allow environment variables to be passed when creating or starting a sandbox through sbx run, for example:
This would make sbx run more consistent with sbx exec and Docker-style workflows, and would avoid needing a separate sbx create / sbx exec step just to inject environment configuration.
Use Cases
Suggested Behavior
This would make
sbx runmore ergonomic for common development and agent workflows.