Skip to main content
Reference

Dependencies reference

Declares runtime dependencies, services, and packages for container image builds.

Declaration

Add dependencies to the dependencies list in agent.yaml:

dependencies:
  - node@20
  - python@3.11
  - git
  - npm:lodash@4.17.21
  - postgres@17

The --dep CLI flag adds dependencies for a single run without modifying agent.yaml:

moat run --dep node@20 --dep git ./my-project

See the agent.yaml reference for the complete dependencies field specification.

Dependency types

Registry

Registry dependencies defined in Moat’s internal registry. Includes language runtimes, system packages, CLI tools, GitHub binaries, and custom installers.

Syntax: <name> or <name>@<version>

dependencies:
  - node@20        # Runtime with version
  - python         # Runtime with default version
  - git            # System package
  - claude-code    # Custom installer
  - golangci-lint  # GitHub binary

Run moat deps list for the full registry.

Dynamic

Packages installed from language-specific package managers.

Syntax: <prefix>:<package> or <prefix>:<package>@<version>

dependencies:
  - node
  - npm:lodash@4.17.21
  - python
  - pip:requests@2.31.0
  - go
  - go:github.com/junegunn/fzf@latest

Supported prefixes:

PrefixPackage managerRequired runtime
npm:npmnode
pip:pippython
uv:uv tooluv
go:go installgo
cargo:cargorust

Moat validates that the required runtime is present and returns an error if it is missing.

Meta

Bundles that expand to multiple packages during resolution.

Syntax: <bundle-name>

dependencies:
  - go-extras       # gofumpt, govulncheck, goreleaser
  - cli-essentials  # jq, yq, fzf, ripgrep, fd, bat
  - python-dev      # uv, ruff, black, mypy, pytest

Run moat deps info <name> to see the expanded contents of any meta dependency.

Service

Sidecar containers (databases, caches) that run alongside the agent.

Syntax: <service> or <service>@<version>

dependencies:
  - postgres@17
  - redis@7

Moat starts each service as a sidecar, generates random credentials, waits for readiness, and injects MOAT_{SERVICE}_* environment variables into the agent container.

See Available services below for the full list, and the service dependencies guide for configuration, environment variables, and networking details.

Available dependency categories

CategoryExamplesNotes
Runtimesnode, python, go, rust, bunVersion-pinnable with @version
Package managersuv, yarn, pnpm
Development toolsgit, gh, lazygit, task
Language toolsgolangci-lint, ruff, typescriptGo, Python, Node tool ecosystems
CLI toolsjq, yq, ripgrep, fd, bat
AI coding toolsclaude-code, codex-cliOr use moat claude / moat codex
Database clientspsql, mysql-client, redis-cli, sqlite3Pair with corresponding service
Cloud toolsaws, gcloud, kubectl, terraform, helm
Servicespostgres, mysql, redisRun as sidecar containers

Run moat deps list --type <type> to filter by category.

Version resolution

Partial versions resolve to the latest matching release within the specified major or minor line.

You writeResolves to
node@20node@20.11.0
go@1.22go@1.22.12
python@3.11python@3.11.8
nodeDefault version for that runtime

Version data is cached locally at ~/.moat/cache/versions.json for 24 hours.

Base image selection

Moat selects the base image based on declared runtime dependencies.

DependenciesBase image
node onlynode:20-slim
python onlypython:3.11-slim
go onlygolang:1.22
Mixed or nonedebian:bookworm-slim

When multiple runtimes are declared (e.g., both node and python), Moat uses debian:bookworm-slim and installs each runtime as a separate layer.

Layer caching

Moat orders Dockerfile instructions to maximize BuildKit cache hits. Layers are ordered from least to most frequently changed:

  1. Base packages (curl, ca-certificates)
  2. User setup (moatuser)
  3. APT packages
  4. Runtimes
  5. GitHub binaries
  6. npm packages
  7. Go packages
  8. Custom dependencies
  9. Dynamic packages

When a dependency changes, only that layer and subsequent layers rebuild. BuildKit layer caching is shared across runs.

Docker dependencies

Dependencies for running Docker inside containers.

DependencyDescriptionUse when
docker:hostMounts the host Docker socketFast startup; agent is trusted
docker:dindRuns an isolated Docker daemon with BuildKit sidecarIsolation from the host Docker daemon is required
dependencies:
  - docker:host  # or docker:dind

Both modes require Docker runtime. Apple containers do not support Docker socket mounting or privileged mode. See the agent.yaml reference for detailed configuration.

Available services

ServiceDefault versionEnvironment variables injected
postgres17MOAT_POSTGRES_*
mysql8MOAT_MYSQL_*
redis7MOAT_REDIS_*

Service dependencies require Docker or Apple container runtime. See the service dependencies guide for environment variable details, networking, and security information.

Hooks

Hook commands run after dependency installation completes. See the agent.yaml hooks reference for field specifications and the lifecycle hooks guide for all hook types.

CLI commands

moat deps list

List all available dependencies in the registry.

$ moat deps list
$ moat deps list --type <type>
FlagDescription
--type <type>Filter by category (e.g., runtime, service, cli)
--jsonOutput as JSON

moat deps info

Show details for a specific dependency, including version, type, and expanded contents for meta dependencies.

$ moat deps info <name>
$ moat deps info go-extras
FlagDescription
--jsonOutput as JSON