Skip to main content
Install packages and create a reusable image.

Description

The install-packages prompt provides instructions for installing packages in a container and tagging the result for future reuse. It follows the prepare-and-tag pattern.

Parameters

ParameterTypeRequiredDefaultDescription
packagesstringYes-Packages to install (space-separated)
imagestringNopython:3.11-slimBase image to use

Generated Instructions

When invoked with:
{
  "packages": "flask gunicorn",
  "image": "python:3.11-slim"
}
Returns:
Install packages in a container:

1. Check if base image `tag:python:3.11-slim` exists with `list_images`
2. If not, import it with `import_image`
3. Run `pip install flask gunicorn` with `disposable=false` to save the image
4. Tag the result for reuse (e.g., `claude/common/python/custom-deps:3.11`)

The returned `result_image` can be used for subsequent commands.

Example Usage

Python Packages

{
  "prompt": "install-packages",
  "args": {
    "packages": "numpy pandas matplotlib scikit-learn"
  }
}

Web Framework Stack

{
  "prompt": "install-packages",
  "args": {
    "packages": "fastapi uvicorn sqlalchemy alembic"
  }
}

System Packages

For system packages, use a different base image and package manager:
{
  "prompt": "install-packages",
  "args": {
    "packages": "curl wget git",
    "image": "ubuntu:22.04"
  }
}
Note: For Ubuntu, the agent should adapt to use apt install instead of pip install.

Implementation Notes

The agent should:
  1. Check if base image exists with list_images
  2. Import if needed with import_image
  3. Install packages with run:
    {
      "command": "pip install <packages>",
      "image": "tag:<base_image>",
      "disposable": false
    }
    
  4. Tag the result with set_tag:
    {
      "image_uuid": "<result_image>",
      "tag": "common/<purpose>/<base_image>"
    }
    

See Also