> ## Documentation Index
> Fetch the complete documentation index at: https://agent-compass.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# Configure an Environment

Selecting a provider and passing Environment parameters are separate operations: the provider chooses the Environment implementation that executes the task, while its parameters control how that Environment is created and run. Set only the fields you need to change, and let provider defaults or an applicable [Recipe](https://agent-compass.mintlify.site/en/user_guide/other_features/recipes.md) supply the rest.

Environment parameters must belong to the selected provider's public schema shown by `agentcompass config docs env <provider-id>`. Undeclared fields and misspellings raise an unknown-parameter error. Configure outbound access through the shared network policies; adapters generate the corresponding native API options internally.

All providers share execution settings and can declare additional provider-specific parameters. `setup` includes `image`, `dockerfile`, `workdir`, `build_timeout_seconds`, `os`, `compose_file`, and `main_env`. `evaluation_setup` uses the same structure for a fresh verifier. Resource, network, and environment-variable fields are also shared. Host credentials are configured through the adapter’s existing environment variables or SDK configuration, outside task execution settings.

> [!NOTE]
>
> AgentCompass matches recipes automatically. A normal evaluation does not require setting or modifying a recipe;
> configure one manually only when a benchmark page names an alternative, troubleshooting requires restricted matching,
> or your team loads custom adaptation logic.

## Dockerfile environments

Docker and Daytona accept `setup.dockerfile`, a Dockerfile on the driver, and build a single-environment image with the Dockerfile's directory as the build context, as Harbor does. Precedence is `compose_file` > `image` > `dockerfile`: a set `image` is used directly, and Compose mode also ignores `dockerfile`. Other providers reject a setup that provides only `dockerfile`.

```json theme={"system"}
{"setup":{"dockerfile":"/path/to/environment/Dockerfile"}}
```

Docker builds the image locally and reuses it by build-input fingerprint, following [Compose image reuse and cleanup](https://agent-compass.mintlify.site/en/user_guide/modules/environments/providers/docker.md#compose-image-reuse-and-cleanup). Daytona creates the sandbox with the SDK's `Image.from_dockerfile`, uploading only context files referenced by `COPY`/`ADD`. Build time counts toward `build_timeout_seconds`; resources, network policies, and environment variables behave as for any single environment.

## Compose environments

Docker and Daytona accept `setup.compose_file`, a complete Compose file on the driver, and `setup.main_env`, the default service name (`main` when omitted). The Benchmark merges format-specific base definitions and overrides during task loading; the provider deploys the complete definition.

```json theme={"system"}
{"setup":{"compose_file":"/path/to/compose.yaml","main_env":"agent"}}
```

The Compose file declares each service's CPU, memory, and GPU limits. In DinD mode, `environment.resources` configures the outer sandbox; `run_resources` and `evaluation_resources` override the outer resources for execution and fresh evaluation respectively. These fields do not change inner service limits. Native Docker Compose has no outer sandbox, so shared resources do not set service limits; use the Compose file or `compose_override`. Provider capability checks, including GPU model validation, still apply.

Service images and builds come from the Compose definition and `compose_override`. Compose mode ignores the `image` and `dockerfile` fields in that environment's setup. Execution and fresh evaluation select their modes independently: `evaluation_setup.image` is ignored only when the verifier itself uses Compose. The common workdir and task environment variables override only the default service. Direct `ComposeEnvSession` operations delegate to that service; `env["database"]` returns an operation view of another service. Closing the group releases its owned containers, networks, and volumes. Child views cannot independently close resources. The runtime does not automatically expose the Docker socket or other service shells to the agent.

Setting `evaluation_setup.image` prevents the verifier from inheriting `compose_file` and `main_env` from execution. A single-image verifier declared by the task also does not inherit those fields. An explicit `evaluation_setup.compose_file` still selects Compose for evaluation. Other setup fields keep their existing merge rules; without an independent verifier setup, fresh evaluation inherits the execution setup.

Docker Compose supports all four phase network policies and dynamic changes; see [Compose Network Policies](https://agent-compass.mintlify.site/en/user_guide/modules/environments/providers/docker.md#compose-network-policies) for topology and proxy requirements. Daytona Compose still supports only `public`. Each service represents one container; fixed `container_name` and scaling are unsupported. Images must provide the `timeout` utility for command deadlines. Daytona selects the outer host image through `dind_image` and configures its resources through `resources`; see [Terminal-Bench 4](https://agent-compass.mintlify.site/en/user_guide/modules/benchmarks/terminal_bench_4.md) for budget rules.

When Daytona DinD Compose pulls or builds private images, pass a base64-encoded Docker `config.json` through `dind_config_secret`. AgentCompass writes it only to `/root/.docker/config.json` on the outer DinD host before image preparation; it is never injected into inner Compose service containers and cannot be used in single-container mode. Only static `auths` are kept; `credsStore` and `credHelpers` are unsupported. Avoid putting the secret directly in the config: reference an environment variable, or omit the field and let Compose mode read `DIND_CONFIG_SECRET` from the driver process environment:

```bash theme={"system"}
export DIND_CONFIG_SECRET="$(base64 -w0 /run/secrets/docker-config.json)"
```

```yaml theme={"system"}
environments:
  daytona:
    dind_config_secret: ${DIND_CONFIG_SECRET}
```

### External overrides

Docker and Daytona accept `compose_override` as a dictionary with the same structure as Compose YAML. Use it to set build arguments, build networking, or other Compose fields without editing Benchmark files. For example, configure a build proxy for TB4 execution and verifier images in your configuration file:

```yaml theme={"system"}
environments:
  docker:
    compose_override:
      services:
        "*":
          build:
            network: host
            args:
              HTTP_PROXY: http://127.0.0.1:7890
              HTTPS_PROXY: http://127.0.0.1:7890
```

You can also pass it through the CLI:

```bash theme={"system"}
--env docker \
  --env-params '{"compose_override":{"services":{"*":{"build":{"network":"host","args":{"HTTP_PROXY":"http://127.0.0.1:7890"}}}}}}'
```

`"*"` matches every service declared in the base file or override document, including services that only have an `image`; adding `build` enables building those services too. Use actual service names to modify only selected services. When wildcard and named overrides coexist, they apply in this order: base definition, wildcard overrides, named overrides. Named overrides take precedence; the base definition includes resolved shared settings for the main service. Mappings merge recursively, commands and healthcheck commands are replaced, volumes merge by container target, and ports are deduplicated by address, ports, and protocol. You can also provide top-level settings such as `volumes` and `networks`.

AgentCompass writes temporary Compose files. Docker appends them as `--file` arguments to the startup command and uses the same files to validate the merged definition and query containers. Relative paths use the original `setup.compose_file` parent directory. Values follow Compose interpolation rules; write `$$` for a literal `$`. `build.network` controls build networking only, and the builder must support the selected mode. This parameter applies to both execution and fresh evaluation environments on Docker and Daytona. A nonempty override without Compose raises an error.

Daytona uses the framework’s built-in Python merger before estimating outer resources and uploading build inputs. The driver needs neither Docker nor the Compose CLI, and no additional Python dependencies are required. Each layer is interpolated before merging, using `.env` from the original Compose directory with process environment variables taking precedence. Service `env_file` and `label_file` inputs are also read on the driver. Uploads preserve literal dollar signs to prevent a second interpolation remotely. The remote host still needs Docker Compose and validates the complete configuration before startup. The built-in parser supports ordinary YAML and dictionary overrides; `!reset` and `!override` tags and unresolved `include` or `extends` are unsupported. Existing DinD restrictions on bind mounts, additional build contexts, and SSH forwarding still apply. Proxy addresses in overrides must be reachable from the remote builder; `127.0.0.1` refers to the remote host, not the driver.

## Prebuild task images

From the source repository root with AgentCompass installed, run `tools/build_benchmark_images.py` to build task Compose and Dockerfile images and record their task mappings. The tool accepts a registered Benchmark and obtains `TaskSpec` objects through its loader and task selector. It reads the execution and independent evaluation environments' `compose_file` fields, or their `dockerfile` fields when no `image` is set. Stages with neither are skipped; if no selected task declares anything to build, the tool exits without calling the container engine. It uses definitions already present in TaskSpec without applying Recipes or provider configuration.

For example, prepare images for one TB4 task:

```bash theme={"system"}
python tools/build_benchmark_images.py terminal_bench_4 \
  --benchmark-params '{"sample_ids":["kv-live-surgery"]}' \
  --output-dir ./exports/tb4-images \
  --image registry.example.com/team/tb4
```

Replace the Benchmark ID and `--benchmark-params` with your dataset's configuration. The Benchmark handles the JSON parameters, including the common `sample_ids` selector. The tool does not require `tasks_dir`, `task.toml`, or a specific dataset layout, and does not call a model or start task services.

The default uses the local Docker daemon and Compose. Select the engine with `--container-cli docker` or `--container-cli podman`. To use sudo, pass `--container-cli "sudo docker"` or `--container-cli "sudo podman"`, quoting the full command as one argument. Building, image inspection, tagging, pushing, and cleanup all use that command. Building only Dockerfiles does not require Compose. To build Compose stages, Podman requires an available API socket and a Compose provider supporting `config --format json --no-normalize`, such as Docker Compose v2 or newer. Select the provider through `PODMAN_COMPOSE_PROVIDER` or `containers.conf`. With sudo, root's configuration, image store, and login credentials apply.

All Compose profiles are enabled while building, so every service with `build` is included, including sidecars. Image-only services retain their original references. `--image` specifies a repository without a tag or digest, defaulting to `agentcompass/<benchmark-id>` with underscores in the Benchmark ID replaced by hyphens. Tags use `<task_id>-<phase>-<service>`, where phase is `run` or `evaluation`. Dockerfile stages build with the Dockerfile's directory as the context and use `<task_id>-<phase>` tags. Identifiers that contain invalid tag characters or exceed the length limit are normalized and receive an identity digest; the manifest retains the original task ID.

An existing local image with the same repository and tag skips the build. The tool does not detect changes to build inputs. Use `--rebuild` to force a build; the engine may still use its layer cache. Each service or Dockerfile stage builds under a temporary tag and receives its final tag only after image inspection succeeds. A failed build preserves the previous final image and cleans up temporary tags.

The output directory must not exist. A successful run produces `compose/` and `images.json`. Compose filenames contain the task index and phase. Built or reused services have `build` removed and their new `image` and `pull_policy: missing` set. Other service settings remain; the top-level project name is omitted so the caller can choose it. Compose resolves paths and environment variables relative to the source file, and exports preserve resolved values and literal dollar signs. Referenced local runtime files are not copied; move them and adjust paths yourself when using another host. Dockerfile stages export no files and appear only in the manifest.

The manifest's top-level `benchmark` identifies the Benchmark, and `images` is a list of Compose service or Dockerfile stage records:

| Field | Meaning |
| - | - |
| `task_id`, `phase`, `service` | Original task ID, execution or evaluation phase, and service name; Dockerfile records have no `service`. |
| `source_compose` | Absolute source Compose path from TaskSpec, which may be generated by the Benchmark; Compose records only. |
| `source_dockerfile` | Absolute Dockerfile path from TaskSpec; Dockerfile records only. |
| `compose_file` | Exported Compose path relative to the output directory; Compose records only. |
| `original_image` | Original image reference, or null when the source service has no image or for Dockerfile records. |
| `image` | Built image reference, or the unchanged reference of an image-only service. |
| `image_id` | Local ID of a built or reused image; absent for services that were not built. |

Use the output to edit dataset configuration manually. It is not a replacement dataset directory. The tool does not copy task data, rewrite the source dataset, or provide dataset-format export interfaces. Use the manifest to update task image fields or Compose references. If the loader regenerates Compose, update its source configuration as well.

A build failure does not stop the remaining services, phases, or tasks. Failures are listed at the end, the process exits with a nonzero status, and no output directory is published. Successful final images remain available. Rerun without `--rebuild` to reuse existing images and retry missing ones; retry failed forced builds with `--rebuild`.

Add `--push` to push built and reused images using the selected container command's login. The default does not push. Push failures are also listed and prevent publication of the output directory. Rerun with `--push` and without `--rebuild` to reuse local images and retry pushing. Docker and Podman use separate image stores, as do rootless and rootful Podman. Push images to an accessible registry before using another engine or host, and configure authentication where images are pulled. Prebuilding does not change GPU or other runtime resource requirements.

## Choose a Provider and Input Method

All of the following methods can provide Environment parameters. Choose one based on whether the values apply only to the current evaluation or should be reused by other runs or programs:

| Method | How to configure it | Use it for |
| - | - | - |
| [`agentcompass run`](https://agent-compass.mintlify.site/en/user_guide/using_agentcompass/cli/run) | Select the provider with `--env <provider-id>` and pass parameters with `--env-params '<json>'`. | Temporary settings for the current evaluation. |
| [Configuration file](https://agent-compass.mintlify.site/en/user_guide/using_agentcompass/cli/config.md#configuration-file-structure) | Store a provider's defaults under `environments.<provider-id>`. The provider is still selected by `run`, `launch`, or the SDK. | Defaults reused across evaluations. |
| [Python SDK: single evaluation](https://agent-compass.mintlify.site/en/user_guide/using_agentcompass/python_api.md#single-evaluation-request) | In `run_evaluation()`, select the provider with `environment="<provider-id>"` and pass parameters through `environment_params={...}`. | Single-evaluation requests started from Python. |
| [`agentcompass launch`](https://agent-compass.mintlify.site/en/user_guide/using_agentcompass/cli/launch) | In an orchestration file's `environment` mapping, use `id` to select the provider and place its parameters beside `id`. | One or more requests orchestrated through YAML or JSON. |
| [Python SDK: multiple evaluations](https://agent-compass.mintlify.site/en/user_guide/using_agentcompass/python_api.md#multiple-evaluation-requests) | Use the same orchestration structure in `OrchestrationSpec.defaults.environment` or `requests[].environment`. | Multiple-evaluation requests started from Python. |

### `agentcompass run`

Use `--env <id>` to select a provider. When it is omitted, AgentCompass uses `host_process`. Run `agentcompass list env` to see the provider IDs available in the current installation.

`--env-params` accepts a JSON object for the Environment parameters of this evaluation. Matching fields override configuration-file values:

```bash theme={"system"}
agentcompass run <benchmark> <harness> "$MODEL_NAME" \
  --env docker \
  --env-params '{"setup":{"image":"python:3.13-slim"},"resources":{"cpu":2,"memory_mb":6144}}'
```

### Configuration File

Write reusable provider parameters directly under `environments.<id>`. Do not add a `params` wrapper:

```yaml theme={"system"}
environments:
  docker:
    setup:
      image: python:3.13-slim
    resources:
      cpu: 2
      memory_mb: 6144
```

Select the same provider and load the file when running the evaluation:

```bash theme={"system"}
agentcompass run <benchmark> <harness> "$MODEL_NAME" \
  --env docker \
  --config config.yaml
```

### Python SDK Single Evaluation

The SDK accepts a Python dictionary, so the parameters do not need to be encoded as a JSON string:

```python theme={"system"}
from agentcompass import run_evaluation

result = run_evaluation(
    benchmark="swebench_verified",
    harness="mini_swe_agent",
    model="your-model",
    environment="docker",
    environment_params={
        "resources": {
            "cpu": 2,
            "memory_mb": 6144,
        },
    },
)
```

### `agentcompass launch` and SDK Multiple Evaluations

In a `launch` orchestration, `id` selects the provider and the remaining fields are written directly under `environment`:

```yaml theme={"system"}
defaults:
  environment:
    id: docker
    resources:
      cpu: 2
      memory_mb: 6144
```

Each evaluation request can override these defaults in its own `environment` section. The Python SDK's `OrchestrationSpec` uses the same field structure. See the [`agentcompass launch` mapping rules](https://agent-compass.mintlify.site/en/user_guide/using_agentcompass/cli/launch#mapping-rules) and [Python SDK multiple-evaluation requests](https://agent-compass.mintlify.site/en/user_guide/using_agentcompass/python_api.md#multiple-evaluation-requests).

> [!WARNING]
>
> When an orchestration mixes providers, do not place provider-specific parameters in `defaults.environment`. A request that overrides `environment.id` still inherits and merges the other fields in `defaults.environment`. Put provider-specific values in each `requests[].environment` instead.

## Write Nested Fields

Provider parameters can be strings, numbers, booleans, objects, or lists. In a parameter reference, `resources.cpu` means the `cpu` field inside the `resources` object; it is not a flat key named `resources.cpu`.

The following four forms are equivalent. Each requests 2 vCPUs and 6 GiB of memory from Daytona.

The CLI accepts a JSON object:

```bash theme={"system"}
--env daytona \
  --env-params '{"resources":{"cpu":2,"memory_mb":6144}}'
```

A configuration file preserves the nested YAML structure:

```yaml theme={"system"}
environments:
  daytona:
    resources:
      cpu: 2
      memory_mb: 6144
```

The Python SDK accepts a nested dictionary:

```python theme={"system"}
from agentcompass import run_evaluation

result = run_evaluation(
    benchmark="<benchmark>",
    harness="<harness>",
    model="<model>",
    environment="daytona",
    environment_params={"resources": {"cpu": 2, "memory_mb": 6144}},
)
```

A `launch` orchestration places provider parameters beside `id` while retaining their nested shape:

```yaml theme={"system"}
defaults:
  environment:
    id: daytona
    resources:
      cpu: 2
      memory_mb: 6144
```

Objects merge recursively by field, while a later scalar or list replaces the earlier value in full. For example, if a configuration file sets `resources.cpu: 2` and `resources.memory_mb: 6144`, then a request that passes only `{"resources":{"memory_mb":8192}}` resolves to 2 vCPUs and 8192 MiB of memory.

Do not add a `params` wrapper, and do not write a field path as `{"resources.cpu":2}`. See the selected provider's [parameter reference](https://agent-compass.mintlify.site/en/user_guide/modules/environments/overview.md#choose-an-environment-provider) for its nested fields, units, and accepted values.

## Understand Field Ownership

Environment parameters contain two kinds of fields:

| Field kind | Fields or examples | Meaning |
| - | - | - |
| Shared setup fields | `setup.image`, `setup.dockerfile`, `setup.workdir`, `setup.build_timeout_seconds`, `setup.os`, `setup.compose_file`, `setup.main_env` | Describe provider-neutral startup requirements. The provider maps supported fields to its adapter without treating workdir as the Benchmark workspace. |
| Shared network fields | `network_policy`, `run_network_policy`, `verifier_network_policy` | Set the baseline, agent-run, and verification policies. The latter two inherit the baseline when omitted. The provider must support the selected modes; see [Network Policies](https://agent-compass.mintlify.site/en/user_guide/modules/environments/configuration/network.md). |
| Provider fields | Credentials, resources, placement, and lifecycle settings | Defined by the selected provider. Names, units, and defaults cannot be copied directly between providers. |

With every input method, shared setup and network fields and provider fields are written at the same level, without another `params` wrapper. In a configuration file, for example, all are written directly under `environments.docker`.

## Inspect Fields and Resolved Configuration

Show the provider-specific fields, types, and defaults declared by one provider in the current installation:

```bash theme={"system"}
agentcompass config docs env docker
```

Show the result of merging built-in defaults with a configuration file:

```bash theme={"system"}
agentcompass config show \
  --env docker \
  --config config.yaml
```

`config show` includes only built-in values and configuration-file layers. It does not include extra CLI, SDK, or orchestration fields for a particular run, or the final Environment settings that a Recipe adds before a task starts. See [`agentcompass config`](https://agent-compass.mintlify.site/en/user_guide/using_agentcompass/cli/config) for the complete command behavior.

## How Environment Parameters Take Effect

Environment parameters are not read once from a single source. They are built in these stages:

| Stage | Effect |
| - | - |
| Provider defaults and configuration files | Form the reusable base configuration. Configuration-file values override matching built-in defaults. `config show` displays the result through this stage. |
| Explicit parameters for this request | Fields passed explicitly through the `run` CLI, Python SDK, or an orchestration request override matching configuration-file values. |
| [Recipe](https://agent-compass.mintlify.site/en/user_guide/other_features/recipes.md) | After the concrete task is known, a matching Recipe can add or adjust the image, Environment workdir, Benchmark workspace, resources, network, and required execution settings for the Benchmark, Harness, and provider combination. These task-specific changes do not appear in `config show`. |

The following command does not set a Docker image. The matching SWE-bench Verified Recipe derives the image and task workspace from the sample, so selecting the provider is usually enough:

```bash theme={"system"}
agentcompass run swebench_verified mini_swe_agent "$MODEL_NAME" \
  --env docker
```

Without a matching Recipe, you must still provide the provider's required fields, such as the task image for Docker. A Recipe is also not a universal "explicit parameters always win" rule: built-in Recipes usually preserve compatible explicit image and resource settings, but they may still adjust workspace, network, or execution settings required by the Benchmark or Harness.

Pass Environment parameters only when you intend to change the default behavior. Valid values still depend on the provider and are documented on its provider page and by `config docs`.

> [!NOTE]
>
> Configure overall and per-task time budgets under [Timeouts](https://agent-compass.mintlify.site/en/user_guide/using_agentcompass/timeouts.md), and concurrency and Environment startup rate under [Run Controls](https://agent-compass.mintlify.site/en/user_guide/using_agentcompass/run_controls.md). Fields such as [Modal's `timeout`](https://agent-compass.mintlify.site/en/user_guide/modules/environments/providers/modal) and [OpenSandbox's `lifecycle_seconds`](https://agent-compass.mintlify.site/en/user_guide/modules/environments/providers/opensandbox) limit the lifetime of one sandbox and are not evaluation timeouts.

## Related Pages

* [Network Policies](https://agent-compass.mintlify.site/en/user_guide/modules/environments/configuration/network.md)
* [Resource Limits](https://agent-compass.mintlify.site/en/user_guide/modules/environments/configuration/resource_limits.md)
* [Environment Provider List](https://agent-compass.mintlify.site/en/user_guide/modules/environments/overview.md#choose-an-environment-provider)

Native adapters may require particular variable values to launch their runner or translate canonical model/execution settings. If a declared environment variable conflicts with one of these requirements, the command fails before launch and reports only the variable name. Change the corresponding Model, Harness, or execution setting instead of overriding its generated variable. Matching values are accepted. This adds no new CLI field. Internal Python runners preserve your `PYTHONPATH` where they can bootstrap their imports; the mini-SWE-agent CLI still requires its generated module directory and rejects a conflicting `PYTHONPATH`.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.