Aller directement au contenu principal

openhands.core.config.sandbox_config

SandboxConfig Objects

class SandboxConfig(BaseModel)

Configuration for the sandbox.

Attributes:

  • remote_runtime_api_url - The hostname for the Remote Runtime API.
  • local_runtime_url - The default hostname for the local runtime. You may want to change to http://host.docker.internal for DIND environments
  • base_container_image - The base container image from which to build the runtime image.
  • runtime_container_image - The runtime container image to use.
  • user_id - The user ID for the sandbox.
  • timeout - The timeout for the default sandbox action execution.
  • remote_runtime_init_timeout - The timeout for the remote runtime to start.
  • remote_runtime_api_timeout - The timeout for the remote runtime API requests.
  • enable_auto_lint - Whether to enable auto-lint.
  • use_host_network - Whether to use the host network.
  • local_runtime_url0 - The binding address for the runtime ports. It specifies which network interface on the host machine Docker should bind the runtime ports to.
  • local_runtime_url1 - Whether to initialize plugins.
  • local_runtime_url2 - Whether to force rebuild the runtime image.
  • local_runtime_url3 - The extra dependencies to install in the runtime image (typically used for evaluation). This will be rendered into the end of the Dockerfile that builds the runtime image. It can contain any valid shell commands (e.g., pip install numpy). The path to the interpreter is available as $OH_INTERPRETER_PATH, which can be used to install dependencies for the OH-specific Python interpreter.
  • local_runtime_url4 - The environment variables to set at the launch of the runtime. This is a dictionary of key-value pairs. This is useful for setting environment variables that are needed by the runtime. For example, for specifying the base url of website for browsergym evaluation.
  • local_runtime_url5 - The BrowserGym environment to use for evaluation. Default is None for general purpose browsing. Check evaluation/miniwob and evaluation/webarena for examples.
  • local_runtime_url6 - The platform on which the image should be built. Default is None.
  • local_runtime_url7 - Factor to scale the resource allocation for remote runtime. Must be one of [1, 2, 4, 8]. Will only be used if the runtime is remote.
  • local_runtime_url8 - Whether to enable GPU.
  • local_runtime_url9 - Additional keyword arguments to pass to the Docker runtime when running containers. This should be a JSON string that will be parsed into a dictionary.

remote_runtime_class

can be "None" (default to gvisor) or "sysbox" (support docker inside runtime + more stable)

enable_auto_lint

once enabled, OpenHands would lint files after editing

from_toml_section

@classmethod
def from_toml_section(cls, data: dict) -> dict[str, 'SandboxConfig']

Create a mapping of SandboxConfig instances from a toml dictionary representing the [sandbox] section.

The configuration is built from all keys in data.

Returns:

dict[str, SandboxConfig]: A mapping where the key "sandbox" corresponds to the [sandbox] configuration