-
Notifications
You must be signed in to change notification settings - Fork 545
Description
Why do you need it?
Currently, environment variables must be predefined during sandbox creation or written to the file specified by the EXECD_ENVS environment variable. However, in many scenarios, we need to inject or override environment variables dynamically at execution time.
Specific Use Case:
When using tools like the gh-issue skill, a GH_TOKEN is required. If a user updates their token after the sandbox has been created, recreating the entire sandbox environment is not performance-efficient.
While EXECD_ENVS works for some use cases, it is not suitable when multiple commands are executed concurrently, as they share the same environment file. Supporting execution-level environment variables would allow for greater flexibility and better isolation without the overhead of environment recreation.
How could it be?
We should add an env property to the command execution request model and update the SDKs accordingly.
- Backend Change:
Add theEnvfield to theRunCommandRequeststruct:
type RunCommandRequest struct { - SDK Update:
Update all Official SDKs (Python, JS, etc.) to support passing environment variables in the command options.
Example usage in Python SDK:
# Expected API usage
execution = await sandbox.commands.run(
"echo $GH_TOKEN",
opts=RunCommandOpts(env={'GH_TOKEN': 'your_token_here'})
)