> This page is for version 0.2.1.
> For other versions, use one of these documentation indexes:
> - Main (default): https://docs.nvidia.com/nemo/gym/main/llms.txt
> - 0.7.0: https://docs.nvidia.com/nemo/gym/v0.7.0/llms.txt
> - 0.6.0: https://docs.nvidia.com/nemo/gym/v0.6.0/llms.txt
> - 0.5.1: https://docs.nvidia.com/nemo/gym/v0.5.1/llms.txt
> - 0.5.0: https://docs.nvidia.com/nemo/gym/v0.5.0/llms.txt
> - 0.4.0: https://docs.nvidia.com/nemo/gym/v0.4.0/llms.txt
> - 0.3.0: https://docs.nvidia.com/nemo/gym/v0.3.0/llms.txt
> - 0.2.1: https://docs.nvidia.com/nemo/gym/v0.2.1/llms.txt

> For clean Markdown of any page, append .md to the page URL.
> For a complete documentation index, see https://docs.nvidia.com/nemo/gym/llms.txt.

# nemo_gym.sandbox.harness_config

The typed `sandbox_config` of a harness sandbox: the sandbox an agent's harness runs in.

## Module Contents

### Classes

| Name                                                                            | Description                                                      |
| ------------------------------------------------------------------------------- | ---------------------------------------------------------------- |
| [`HarnessSandboxConfig`](#nemo_gym-sandbox-harness_config-HarnessSandboxConfig) | `SandboxConfig` for a harness sandbox, whichever server owns it. |

### API

```python
class nemo_gym.sandbox.harness_config.HarnessSandboxConfig()
```

**Bases:** [SandboxConfig](/nemo/gym/nemo-gym/nemo_gym/sandbox/config#nemo_gym-sandbox-config-SandboxConfig)

`SandboxConfig` for a harness sandbox, whichever server owns it.

The owner is the server that starts it and stops it: an Environment Server that starts one for an attempt and
lends it, or an agent that starts its own because nothing was lent. A lent sandbox is borrowed instead, with
`borrow()` from `nemo_gym.server_runtime`.

A server takes the image, working directory and files of a task sandbox from its task. A harness sandbox has no
task to take them from, so they are configured here, with the keys agent recipes set today.

Its `network` rule replaces an agent's own `network_access`: an agent that adopts this config refuses the two
set together, so a sandbox never has two egress settings.

A recipe's other `SandboxSpec` keys, such as `sidecars`, are refused here; an agent that moves onto this
config with recipes that set them warns about them for one release first.

**`derive_cpu_env`** `bool = False`

Cap tool parallelism to `resources.cpu` in the sandbox's environment. Off by default, as
in most agents today. The OpenCode and Pi sandboxed agents turn the caps on in their code rather than in
a recipe, so a subclass of this config for either defaults it to `True`.

---

**`entrypoint`** `list[str] | None = None`

The command the sandbox's container runs, when the image's own does not keep it alive.

---

**`files`** `dict[str, str] = Field(default_factory=dict)`

Files to place in the sandbox at start, by absolute path.

---

**`image`** `str | None = None`

The sandbox image.

---

**`ports`** `list[int] = Field(default_factory=list)`

The ports the sandbox exposes.

---

**`user`** `str | int | None = None`

The user commands run as, when not the image's default.

---

**`workdir`** `str | None = None`

The working directory the harness runs in.

---

```python
nemo_gym.sandbox.harness_config.HarnessSandboxConfig.spec(
    sandbox_provider: str | collections.abc.Mapping[str, typing.Any],
    image: str | None = None,
    workdir: str | None = None,
    metadata: collections.abc.Mapping[str, str] | None = None,
    files: collections.abc.Mapping[str, str | bytes] | None = None,
    named_configs: collections.abc.Mapping[str, typing.Any] | None = None,
    network_options: nemo_gym.sandbox.config.NetworkRuleOptions | None = None
) -> nemo_gym.sandbox.providers.base.SandboxSpec
```

The spec of the harness sandbox, with this config's image, workdir, files, entrypoint, user and ports.

`image` and `workdir` override the config's, and `files` add to its files. The CPU caps go under the
config's `env`, so a recipe's own value wins.