Skip to content

Prepare a Python Environment

Adi edited this page Oct 19, 2026 · 2 revisions

How-to. Give the network-less agent a working Python environment (dependencies + pytest), so it can run the project's tests.

The sandbox can't pip install. Build the venv inside the agent image (so paths and the Python version match), then pass its path:

skills/local-agent-delegation/scripts/make_venv.sh ~/Projects/foo     # prints e.g. ~/.cache/local-agent-venvs/foo-1a2b3c4
skills/local-agent-delegation/scripts/make_venv.sh ~/Projects/foo extra-pkg another-pkg

The script installs:

  • the repo, editable;
  • pytest;
  • any dependency-groups whose name contains test or dev;
  • common requirements*/test*.txt files.

Re-running reuses the venv. The venv is named after the repo and its current commit, so rebuild after dependency changes.

Then pass the printed path to delegate_task(..., python_env=...) and to run_checks(..., python_env=...). It's mounted read-only at /opt/venv and put first on PATH. Allowed locations are under AGENTBOX_VENVS (default ~/.cache/local-agent-venvs) or under AGENTBOX_REPOS_ROOT.

Other languages: the agent image includes build-base, make, git, node/npm, python 3.13 and uv. For other toolchains, extend images/agent/Dockerfile, then rebuild with docker compose --profile build build agent.

Clone this wiki locally