Sandboxes#

Sandbox environments for isolated task execution.


Podman Sandbox#

Simple Podman sandbox environment for inspect_ai.

This module provides a minimal PodmanSandboxEnvironment that uses the Podman CLI directly (not podman-compose) for running containers.

class dash_evals.runner.sandboxes.podman.podman.PodmanSandboxEnvironment[source]#

Bases: SandboxEnvironment

Simple Podman-based sandbox environment.

__init__(container_id, working_dir='/workspace')[source]#
Parameters:
  • container_id (str)

  • working_dir (str)

classmethod config_files()[source]#

Standard config files for this provider (used for automatic discovery)

Return type:

list[str]

classmethod default_concurrency()[source]#

Default max_sandboxes for this provider (None means no maximum)

Return type:

int | None

async classmethod task_init(task_name, config)[source]#

Validate podman is available.

Return type:

None

Parameters:
  • task_name (str)

  • config (BaseModel | str | None)

async classmethod sample_init(task_name, config, metadata)[source]#

Start a container for this sample.

Return type:

dict[str, SandboxEnvironment]

Parameters:
async classmethod sample_cleanup(task_name, config, environments, interrupted)[source]#

Stop and remove containers.

Return type:

None

Parameters:
  • task_name (str)

  • config (BaseModel | str | None)

  • environments (dict[str, SandboxEnvironment])

  • interrupted (bool)

async classmethod task_cleanup(task_name, config, cleanup)[source]#

No task-level cleanup needed - containers are removed per-sample.

Return type:

None

Parameters:
  • task_name (str)

  • config (BaseModel | str | None)

  • cleanup (bool)

async classmethod cli_cleanup(id)[source]#

CLI cleanup for orphaned containers.

Return type:

None

Parameters:

id (str | None)

async exec(cmd, input=None, cwd=None, env=None, user=None, timeout=None, timeout_retry=True, concurrency=True, truncate=True)[source]#

Execute command inside the container.

Return type:

ExecResult[str]

Parameters:
async write_file(file, contents)[source]#

Write file to container.

Return type:

None

Parameters:
async read_file(file, text=True)[source]#
Overloads:
  • self, file (str), text (Literal[True]) → str

  • self, file (str), text (Literal[False]) → bytes

Parameters:
Return type:

str | bytes

Read file from container.

async connection(*, user=None)[source]#

Get connection info for debugging.

Return type:

SandboxConnection

Parameters:

user (str | None)

default_polling_interval()[source]#

Polling interval for sandbox service requests.

Return type:

float


Sandbox Provider#

dash_evals.runner.sandboxes.provider.podman()[source]#