Skip to main content
Each trial of an agent evaluation starts from the image that the runner declares in eval.py. The image holds your app and its dependencies. It is built from your current source tree, so the evals test the code you ship. lmnr-cli builds the image before each run and adds the services to it. When nothing changed, Docker’s cache is reused. You don’t bump tags or push to a registry.

Declare the image

Chain Image’s methods in the order the layers should be built. Each method returns a new Image and adds one layer. For example, this is an image for a Python app that needs a system package:
Example: evals/support/agent/eval.py
Databases and caches don’t go in the image steps. Declare them in services, and lmnr-cli installs them for you. Some guidelines:
  • Install from the project’s lockfile, so the image has the versions production runs. Match the language version too.
  • Order the steps from rarely to often changing: system packages, dependencies, then the code. Then a change to the app rebuilds one small layer. A --remote run then uploads only that layer. Services are installed before your steps, so an app change doesn’t reinstall them.
  • Add specific paths from your source tree, and nothing from evals/. Harness scripts reach the container through ctx.container.run_file. Reference answers stay in each case’s tests/ folder.

Paths and the build context

Host paths are relative to the file that declares the step, usually eval.py. So ../../.. from evals/<dataset>/agent/eval.py is the repo root. The build context is the deepest folder that holds all the paths the image adds. Only those paths are sent to Docker, so a large repo doesn’t slow the build. .dockerignore in the context applies. Builds that lmnr-cli starts don’t receive .git or .env* files.

See what gets built

eval describe prints each image’s steps and services, with the file and line that declared each one. With --json, the output includes the whole generated Dockerfile. Each local run also keeps a copy of the Dockerfile it built in its job folder, evals/<dataset>/jobs/<job>/<image>.Dockerfile. For a --remote run, the trial’s Files view has it under agent/.generated/.

Start from a Dockerfile

Your app may already have an image definition, or need more than these steps. Then start from its Dockerfile. For example:
Example: evals/support/agent/eval.py
The path is relative to the file that calls from_dockerfile. context defaults to the Dockerfile’s folder. Set it to the repo root, so the Dockerfile can copy your source. Services, and any methods you chain after it, go on top of its last stage.
Example: evals/support/agent/Dockerfile
  • COPY the specific paths you need instead of COPY . . from the repo root. A broad copy would put the cases’ tests/ folders into the image, with the reference answers. The agent could read them there.
  • Services’ migrations must be inside context, because lmnr-cli copies them into the image from there. If one isn’t, eval describe stops with a hint.
  • Build compiled binaries in a builder stage of the same Dockerfile. A binary built on your Mac has the wrong format. The builder base’s libc shouldn’t be newer than the final stage’s.

Several images

Most datasets need one image. When a case needs a different system, declare named images as a dict. Then pick one in that case’s task.toml. For example, for cases that need OCR:
Example: evals/support/agent/eval.py
Example: evals/support/tasks/scanned-invoice/task.toml
The first image is the default, which lmnr-cli writes into new cases. A variant built from the same base shares its layers, so it costs one extra layer. A single image is named <dataset folder>-evals. Cases can’t bring an image of their own. If a case has an environment/Dockerfile, or a docker_image that the runner doesn’t declare, the run stops before anything starts.

What lmnr-cli adds to the image

On top of your steps, lmnr-cli adds:
  • The services. They are copied from each vendor’s official image, at the version you pinned. Each one is in a stage of its own, so changes to your app don’t reinstall them.
  • The services’ migrations, in one last small layer.
  • The Laminar layer under /opt/lmnr. It has its own Python with the lmnr package, for the runner’s helpers and the mock server. It adds nothing to PATH, so your app’s Python and Node stay as they are.
These need a Debian or Ubuntu base. See Base image compatibility. --remote runs have a few more image requirements.

Next steps

Services

Postgres, ClickHouse, Valkey, custom services, and simulated SaaS APIs.

Write eval.py

The runner’s attributes, its phases, and the ctx API.

Run evals with lmnr-cli

Local and remote modes, flags, CI, and sandbox limits.

Troubleshooting

Fixes for stale images, missing env vars, and empty traces.