Skip to content

Commit dbeb031

Browse files
committed
fix(sandbox): migrate ECS config to the #1708 decoupled provider pattern
Rebased onto main, which merged #1708 (decouple sandbox provider config from the agent config). Align the ECS Fargate provider with that pattern: - Add a standalone provider config nemo_gym/sandbox/providers/ecs_fargate/configs/ecs_fargate.yaml -- a top-level `sandbox` block selected via `sandbox_provider: sandbox`, matching opensandbox/apptainer. Region-only; task cpu/memory/disk come from sandbox_spec.resources. - Drop the agent-coupled configs/mini_swe_agent_ecs_fargate.yaml; the generic mini_swe_agent_2.yaml now runs on ECS by adding the provider config path. - Bump the generic config's sandbox_spec.resources.disk_gib 20 -> 30 so it is valid on every provider (Fargate rejects an explicit 20; 21-200 only). - Update the ECS Fargate docs (Fern page + agent README) to the config-paths recipe. - Reconcile uv.lock (boto3 / botocore, sandbox extra) after the rebase. Signed-off-by: Michal Bien <mbien@nvidia.com>
1 parent 5259409 commit dbeb031

6 files changed

Lines changed: 96 additions & 50 deletions

File tree

fern/versions/latest/pages/infrastructure/sandbox/ecs-fargate.mdx

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -20,15 +20,14 @@ uv pip install boto3
2020

2121
## Provider Configuration
2222

23-
Region-only is enough; everything else auto-discovers from SSM (explicit YAML always wins):
23+
NeMo Gym ships this provider config at `nemo_gym/sandbox/providers/ecs_fargate/configs/ecs_fargate.yaml`. It defines a top-level `sandbox` block that an agent selects with `sandbox_provider: sandbox`. Region-only is enough; everything else auto-discovers from SSM (explicit YAML always wins), and task cpu/memory/disk come from the agent's `sandbox_spec.resources`:
2424

2525
```yaml
26-
sandbox_provider:
26+
sandbox:
27+
default_metadata:
28+
sandbox-api: ecs-fargate
2729
ecs_fargate:
2830
region: ${oc.env:AWS_REGION}
29-
cpu: "2048"
30-
memory: "8192"
31-
ephemeral_storage_gib: 50
3231
```
3332
3433
| Field | Default | Purpose |
@@ -106,7 +105,11 @@ async def main() -> None:
106105
asyncio.run(main())
107106
```
108107

109-
For an end-to-end agent run, `mini_swe_agent_2` ships a ready config at `responses_api_agents/mini_swe_agent_2/configs/mini_swe_agent_ecs_fargate.yaml` that selects this provider with region-only auto-discovery.
108+
For an end-to-end agent run, add this provider config to `mini_swe_agent_2`'s config paths — the agent config is unchanged:
109+
110+
```bash
111+
ng_run "+config_paths=[responses_api_agents/mini_swe_agent_2/configs/mini_swe_agent_2.yaml, nemo_gym/sandbox/providers/ecs_fargate/configs/ecs_fargate.yaml, <MODEL_CONFIG>]"
112+
```
110113

111114
## Troubleshooting
112115

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
# ECS Fargate sandbox provider config.
2+
#
3+
# `sandbox` is the instance name an agent references via `sandbox_provider: sandbox`;
4+
# the child key `ecs_fargate` selects the provider and its value is passed to the
5+
# provider constructor. Every shipped provider config binds the same name `sandbox`,
6+
# so swapping providers is swapping this config path in `+config_paths` (no agent edit):
7+
#
8+
# AGENT=responses_api_agents/mini_swe_agent_2/configs/mini_swe_agent_2.yaml
9+
# MODEL=responses_api_models/vllm_model/configs/vllm_model.yaml
10+
# ng_run "+config_paths=[$AGENT, nemo_gym/sandbox/providers/ecs_fargate/configs/ecs_fargate.yaml, $MODEL]"
11+
#
12+
# Requires AWS credentials (AWS_REGION + access keys or an instance role) and the `sandbox`
13+
# extra (boto3). See the ECS Fargate provider page under infrastructure/sandbox for setup
14+
# (SSM infrastructure, the :52222 network requirement, and on-demand image mirroring).
15+
#
16+
# `default_metadata` (optional) is merged into every sandbox's spec metadata
17+
# (SandboxSpec.metadata); an agent's own sandbox_spec.metadata overrides it.
18+
sandbox:
19+
default_metadata:
20+
sandbox-api: ecs-fargate
21+
ecs_fargate:
22+
# Region-only: cluster / subnets / security-groups / roles and the SSH-sidecar key ARNs
23+
# auto-discover from SSM (/<ssm_project>/ecs-sandbox/config; ssm_project defaults to harbor).
24+
# Task cpu / memory / disk come from the agent's sandbox_spec.resources (mapped onto the
25+
# Fargate task); set cpu / memory / ephemeral_storage_gib here only to change the defaults.
26+
region: ${oc.env:AWS_REGION}

responses_api_agents/mini_swe_agent_2/README.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -487,11 +487,11 @@ Kubernetes wrapper, add any outer per-sample guard there.
487487

488488
## Running SWE-bench on ECS Fargate
489489

490-
Swap OpenSandbox for ECS Fargate by using
491-
`configs/mini_swe_agent_ecs_fargate.yaml` — the agent loop and SWE-bench
492-
verifier are unchanged. For provider setup (AWS infra/SSM, credentials, the
493-
`:52222` network requirement, and automatic image mirroring via `auto_mirror`)
494-
see the [ECS Fargate provider README](../../nemo_gym/sandbox/providers/ecs_fargate/README.md).
490+
Swap OpenSandbox for ECS Fargate by adding the ECS provider config to your
491+
`+config_paths` — the agent config (`configs/mini_swe_agent_2.yaml`), agent loop,
492+
and SWE-bench verifier are unchanged. For provider setup (AWS infra/SSM,
493+
credentials, the `:52222` network requirement, and automatic image mirroring via
494+
`auto_mirror`) see the ECS Fargate provider page under `infrastructure/sandbox`.
495495
SWE-bench task images are pulled into the ECR mirror on first use, so no manual
496496
image staging is needed.
497497

@@ -503,7 +503,7 @@ Each input row needs the SWE-bench instance fields shown under
503503
the verifier in-sandbox, so the model is never called:
504504

505505
```bash
506-
CONFIG_PATHS="responses_api_agents/mini_swe_agent_2/configs/mini_swe_agent_ecs_fargate.yaml,responses_api_models/vllm_model/configs/vllm_model.yaml"
506+
CONFIG_PATHS="responses_api_agents/mini_swe_agent_2/configs/mini_swe_agent_2.yaml,nemo_gym/sandbox/providers/ecs_fargate/configs/ecs_fargate.yaml,responses_api_models/vllm_model/configs/vllm_model.yaml"
507507

508508
AWS_REGION=us-east-1 ng_run "+config_paths=[$CONFIG_PATHS]" \
509509
++mini_swe_agent_2.responses_api_agents.mini_swe_agent_2.run_golden=true

responses_api_agents/mini_swe_agent_2/configs/mini_swe_agent_2.yaml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,9 @@ mini_swe_agent_2:
2727
resources:
2828
cpu: 2
2929
memory_mib: 8192
30-
disk_gib: 20
30+
# 30 GiB works on every provider: within Fargate's 21-200 GiB ephemeral range
31+
# (an explicit 20 is rejected there) and fine as an ephemeral request elsewhere.
32+
disk_gib: 30
3133
provider_options:
3234
platform:
3335
os: linux

responses_api_agents/mini_swe_agent_2/configs/mini_swe_agent_ecs_fargate.yaml

Lines changed: 0 additions & 37 deletions
This file was deleted.

uv.lock

Lines changed: 52 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)