MicrosandboxInterpreter
- require_confirm (bool, optional): If True, prompt user before running code strings for security. (default: :obj:
True
) - server_url (str, optional): URL of the microsandbox server. If not provided, will use MSB_SERVER_URL environment variable, then fall back to http://127.0.0.1:5555. (default: :obj:
None
) - api_key (str, optional): API key for microsandbox authentication. If not provided, will use MSB_API_KEY environment variable. (default: :obj:
None
) - namespace (str, optional): Namespace for the sandbox. (default: :obj:
"default"
) - sandbox_name (str, optional): Name of the sandbox instance. If not provided, a random name will be generated by the SDK. (default: :obj:
None
) - timeout (int, optional): Default timeout for code execution in seconds. (default: :obj:
30
) Environment Variables: - MSB_SERVER_URL: URL of the microsandbox server.
- MSB_API_KEY: API key for microsandbox authentication.
init
run
- code (str): The code string to execute.
- code_type (str): The type of code to execute. Supported types: ‘python’, ‘javascript’, ‘bash’. (default: :obj:
python
)
_confirm_execution
- execution_type (str): Type of execution (‘code’ or ‘command’).
supported_code_types
update_action_space
- action_space: Action space dictionary (unused in microsandbox).
execute_command
- command (str): The shell command to execute (e.g., “pip install numpy”, “ls -la”, “apt-get update”).