Skip to main content

Podman sandbox environment for Inspect AI

Project description

Inspect Podman Sandbox

A Podman-backed sandbox environment for the Inspect evaluation framework. It provides a Podman implementation of Inspect’s sandbox API so evals can run containerized tool calls without Docker.

Features

  • Registers a podman sandbox provider via Inspect extension entry points.
  • Uses Podman Compose (podman compose) or the standalone podman-compose tool.
  • Supports compose.yaml, Dockerfile, and Containerfile discovery in task folders.
  • Provides per-sample container isolation with Inspect’s sandbox lifecycle hooks.

Start Podman

Make sure Podman and Podman Compose are installed and available on your PATH, then ensure the Podman service is running.

Linux does not require podman machine (Podman runs natively). If you are on macOS/Windows, start the Podman VM:

podman machine init
podman machine start

Verify connectivity:

podman info

Check the connection:

podman system connection list
podman info

Install

From this repo:

uv sync

For editable installs:

uv pip install -e .

Activate the environment:

source .venv/bin/activate

Some evals and model providers require extra Python packages (e.g., openai). Since this project uses uv, install any optional dependencies with uv as well. We don’t include these by default to keep the extension lightweight.

Example:

uv pip install openai

If you don’t use uv, you can install with pip instead:

python -m venv .venv
source .venv/bin/activate
pip install -e .

Usage with Inspect

In Python:

from inspect_ai import eval

eval("my_task.py", sandbox="podman")

From the CLI:

inspect eval my_task.py --sandbox podman

To specify a custom compose file:

eval("my_task.py", sandbox=("podman", "compose.yaml"))

Evals in This Repo

Sample evals live in evals/ and are for testing the Podman provider. Start with:

inspect eval evals/file_listing/file_listing.py

If you’re writing your own evals, set the sandbox to podman (e.g., sandbox="podman" or sandbox=("podman", "compose.yaml")) to run them with Podman instead of Docker.

See evals/README.md for details, including how to use this extension with inspect_evals.

Forcing podman-compose (optional)

By default we auto-detect the compose frontend. If you need to force the standalone podman-compose binary (e.g., to match an environment that only has podman-compose available), set:

export INSPECT_PODMAN_COMPOSE=podman-compose

Compose and Dockerfile Discovery

The provider searches the task directory in this order:

  1. compose.yaml, compose.yml, docker-compose.yaml, docker-compose.yml
  2. .compose.yaml (auto-generated)
  3. Containerfile
  4. Dockerfile
  5. A default compose that uses the aisiuk/inspect-tool-support image

If you provide sandbox=("podman", "path/to/compose.yaml"), that file is used directly.

Healthchecks

If a compose service defines a healthcheck, the provider waits for it to report healthy before running the sample. This mirrors how Inspect handles readiness in Docker-based sandboxes and is exercised by evals/file_listing_healthcheck/.

You can add a fixed startup delay (for services without healthchecks or when Podman doesn’t report health status) by setting:

export INSPECT_PODMAN_STARTUP_DELAY=5

This is useful when a service is ready shortly after startup but doesn’t expose a healthcheck, or when Podman does not surface health status for a container. Otherwise the eval may start too early and fail.

Cleanup

Inspect will clean up pods/containers automatically unless you disable it:

inspect eval my_task.py --no-sandbox-cleanup

Manual cleanup:

inspect sandbox cleanup podman
inspect sandbox cleanup podman <container-id>

Notes and Limitations

  • Compose services that set container_name are rejected because Inspect runs multiple epochs/samples and needs unique container names per run; fixed names would collide across runs.
  • This extension is intended as a Docker replacement for Inspect sandboxing, but behavior can differ across Podman versions and compose features. If an eval relies on Docker‑specific behavior, you may need small adjustments.

Acknowledgement

This project was conducted by the Vector Institute and the National Research Council of Canada, on behalf of the Canadian AI Safety Institute.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

inspect_podman-0.1.0.tar.gz (200.8 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

inspect_podman-0.1.0-py3-none-any.whl (26.0 kB view details)

Uploaded Python 3

File details

Details for the file inspect_podman-0.1.0.tar.gz.

File metadata

  • Download URL: inspect_podman-0.1.0.tar.gz
  • Upload date:
  • Size: 200.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for inspect_podman-0.1.0.tar.gz
Algorithm Hash digest
SHA256 501d8c0433949972bd7c5634999a54b33766b1345ca989d50fe18b5933f888d3
MD5 ac353f9b884c92c8385f9cff1eddacb5
BLAKE2b-256 c9b7b7e490f0f9f1d4cbe592449ae1c7c8d940d6afbeeb07f87cf9cf9c6f7332

See more details on using hashes here.

File details

Details for the file inspect_podman-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: inspect_podman-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 26.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for inspect_podman-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 2b31bf5698cb80fadea9f3d33083fd8283690ba9cfefabb95bc29ff0a8e899fd
MD5 942181fcd8ea8f66d7111b51528074fc
BLAKE2b-256 587549edf0da0cc0c353f68707addb57393a6374c6b2c4a5552946e88c35e083

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page