Skip to content

feat(environment): add a user-simulation base class and BIRD-Interact on it - #5202

Closed
ffrujeri wants to merge 19 commits into
mainfrom
ffrujeri/user-simulation-base-class
Closed

ffrujeri wants to merge 19 commits into
mainfrom
ffrujeri/user-simulation-base-class

Conversation

@ffrujeri

@ffrujeri ffrujeri commented Oct 28, 2026 •

Copy link
Copy Markdown
Contributor

What changed

BaseUserSimulationEnvironmentServer (nemo_gym/base_user_simulation_environment_server.py) is a base class for Environment Servers that write every user message. It owns the agent session, the turn loop, the turn and interaction deadlines, the agent close and the failure stages. A subclass implements five hooks:

Hook Required Purpose
start_episode yes Create the episode state, such as a Resources session or a sandbox, and register its cleanup.
agent_access no The tool grants and sandbox for the agent seed. The default gives neither.
responses_create_params yes The first turn's request: the opening messages, plus the tools and settings the session keeps. It is the same object as a dataset row's responses_create_params; later turns send only a UserMessage.
next_user_turn yes Read the agent's turn and return a UserMessage or Stop(reason). It runs after every turn, the last one included.
finish_episode yes Grade the episode after the agent is closed.

How the base class runs an episode:

  • Seed. When max_turns > 1, the seed requests resume_harness_session continuation. An agent without it fails the episode at seed with a terminal failure.
  • Activations. Each activation sends only the new user message, with the x-ng-agent-activation header, on the episode's capture path.
  • Interaction deadline. When it expires, the base class closes the agent and still grades the episode, with stop_reason="interaction_timeout".
  • Failures. They go through dependency_failure with the stages seed, agent, cleanup and verification. Every failure after the seed keeps the completed turns and the agent's observations.
  • Checkpoints. checkpoint_mode stays restart_only.

simple_agent now supports resume_harness_session continuation. It keeps the session's conversation and receives only the new input on each activation. Later activations keep the tools and instructions of the first, and one that tries to change them is refused with 422. At close the agent returns the trajectory of all activations. A continuation seed is refused when partial-rollout checkpointing is on, because checkpoints do not export the conversation.

BIRD-Interact, in both of its modes, is the first subclass.

  • resources_servers/bird_interact holds each episode's state:

    • a sandbox for each session, holding the SQLite database with preprocess_sql applied. The agent's SQL and the grading run there;
    • a two-stage user simulator (classify the question, then answer it) that calls user_model;
    • the grader;
    • the phase, attempts and reward;
    • the BIRD-COIN budget.

    The seed reply carries the context for the first turn's responses_create_params. In a-Interact it leaves out the schema, the column meanings and the knowledge base, which the tools charge for. In c-Interact the Environment Server calls /c_interact/ask and /c_interact/submit. In a-Interact the agent calls the same actions as nine tools at the server's root, which is Gym's convention, and over MCP (expose_tools_over_mcp: true). The names, descriptions and arguments live in schemas.A_INTERACT_TOOLS, so the agent sees the same tools over either transport. Each mode's routes refuse a session of the other mode, so an a-Interact agent cannot submit through the c-Interact route without paying its BIRD-COIN. A session's MCP token lists the nine tools in a-Interact and none in c-Interact, and MCP never exposes the /c_interact/ routes. A direct HTTP grant is only a base URL and the session cookie, and simple_agent does not check tool names against the declared tools, so it can reach any route through a name it was not given. fix(simple_agent): call only the tools that the request declares #5271 adds that check. The agent never gets the sandbox itself. The design RFC records the boundary between the Environment Server and the Resources Server as an open question.

    Session sandbox. The session starts the sandbox at seed and stops it at close. At shutdown the server stops any sandbox still open, and ttl_s lets the provider reclaim one that a crashed server left. The server uploads grading.py and the database source, then runs python3 grading.py <setup|execute|grade> <request.json> in the sandbox. Requests go in an uploaded file, not on the command line, and grading.py deletes the file once it has read it, so the solution SQL in a grade request does not stay in the sandbox. The image needs only python3. The server's requirements.txt installs nemo-gym[sandbox], so every provider's SDK, OpenSandbox included, is available. A command the sandbox does not run is an infrastructure failure:

    • it runs again on a fresh sandbox, up to inconclusive_verification_retries times;
    • after that the route answers 503. c-Interact then retries the episode, and in a-Interact /verify masks the sample with bird_interact:sandbox_failed;
    • a failed close keeps the session, so the next close retries the stop.
  • environment_servers/bird_interact is the subclass, with mode: c_interact | a_interact.

    • In c-Interact, the reply is the text of the turn's last message, so the messages of a harness's earlier steps don't count. A reply containing a fenced sql or sqlite block is a submission, and any other reply is a question.
    • Questions are allowed only before the first submission of a phase. A failed submission gets one more SQL attempt. A follow-up question becomes phase 2.
    • a-Interact runs in one turn. resources_tool_transports, as in single_agent_turn, picks the grant: direct_http (the default, for simple_agent), mcp, or both. Over mcp alone the first request declares no tools, because Codex refuses one that does. mcp without exposure on the Resources Server fails at seed, for good.
  • Config: resources_servers/bird_interact/configs/bird_interact.yaml defines one Environment Server for each mode, one shared Resources Server, user_model, and the taskset routes.

  • Row schema: resources_servers/bird_interact/task_data.py describes the dataset rows (BirdInteractTask), as every Resources Server must. It imports only Pydantic, so data tooling can load it without the server's dependencies.

  • Example data: five tasks on a synthetic bookshop SQLite database in the BIRD-Interact file layout. Two have a follow-up question, and two have two critical ambiguities, as most published tasks do. The config declares example.jsonl once for each mode's taskset, under one dataset name, because the metrics file example_metrics.json describes the file's rows and the taskset is only routing. example_rollouts.jsonl has five rollouts for each mode.

Data check. gym env test +should_validate_data=true (nemo_gym/cli/env.py) wanted exactly five rows in example_rollouts.jsonl. BIRD runs the same five examples under two tasksets, one for each mode, so it has ten. The check now wants five rollouts for each taskset in the rollouts' task IDs. Rollouts without a taskset, and the <PLACEHOLDER ROW> lines some servers commit, count as one group, so every other server needs five as before.

Harness support. What each main harness's Gym adapter accepts, read from its session seed checks. simple_agent, in both modes, and Codex, in a-Interact over MCP, have run BIRD with a model (see Rollout evidence). The table is also in environment_servers/bird_interact/README.md.

Harness c-Interact a-Interact
simple_agent Yes Yes, over direct_http
Codex, Pi, Hermes No: the adapter has no multi-turn sessions Yes, over mcp, in the harness's own sandbox
Stirrup No: no multi-turn sessions Yes, over direct_http, in its own sandbox. code_exec: false leaves out its shell.
OpenCode Yes, in its own sandbox. opencode_config.tools turns off its built-in tools. No: it refuses required tool grants
Claude Code, Kilo, OpenClaw No: no multi-turn sessions No: they refuse required tool grants, MCP included

The gaps are in the adapters, not in BIRD: multi-turn sessions (Codex, Pi, Hermes, Stirrup, Claude Code, Kilo, OpenClaw) for c-Interact, and tool grants (Claude Code, Kilo, OpenClaw, OpenCode) for a-Interact. Neither mode grants a sandbox, because BIRD's sandbox holds the database and the ground truth. A sandboxed harness runs in its own sandbox, with built-in tools such as a shell that BIRD-Interact doesn't have. Those tools cannot reach the database, but for scores comparable with the paper's they should be off where the adapter allows it.

Why

BIRD-Interact needs both an environment-driven conversation (c-Interact) and an agent-driven one (a-Interact). Gym's current user-simulation servers (nemo_user_sim, swe_together) each carry their own copy of the agent-session code (seed, activation, capture path, close and failure mapping). This base class puts that code in one place for the next servers. Migrating swe_together and nemo_user_sim to it is a follow-up and is not in this PR.

Refs #4160. That issue is closed as not planned, but BIRD-Interact is now planned. The design was reviewed as an internal RFC.

Validation

Command Result
pytest tests/unit_tests/test_base_user_simulation_environment_server.py 12 passed
pytest tests/unit_tests/test_base_resources_server.py tests/unit_tests/test_session_contract_repo.py 45 passed, including the new check that a seed reply with typed fields passes with its own seed_response_model and fails with the default
pytest responses_api_agents/simple_agent/tests/test_app.py 93 passed (4 new continuation tests)
pytest environment_servers/bird_interact/tests 15 passed. These run the real Resources Server in-process, with a scripted agent and local-provider sandboxes. They include an a-Interact episode over MCP (the agent lists the nine tools from /mcp and submits; the request declares no tools), mcp without exposure failing at seed for good, and a c-Interact turn whose SQL draft in an earlier step is not submitted.
pytest resources_servers/bird_interact/tests, in the server's own venv 41 passed. These include checks that an a-Interact MCP token lists and calls the nine tools with the same descriptions as the function tools, that a c-Interact token lists and calls none, that an a-Interact session cannot use the c-Interact routes, that its seed reply leaves out what the tools charge for, and that no request file stays in the sandbox. They also include 9 sandbox tests on the local provider: setup and preprocessing, a sandbox for each session, stop at close, a retry on a fresh sandbox, 503 and masking, a seed whose sandbox cannot start, a failed close retried, and shutdown.
pytest tests/unit_tests/ -n 8 13081 passed, 28 failed, before the task_data.py commit. 26 fail the same way at the previous head and are specific to this workstation: the venv lacks the sandbox extra (opensandbox, tenacity), the local env.yaml leaks into config tests, the host name resolves to 127.0.1.1, and file modes differ under this umask. The other 2 were in test_task_data.py, because bird_interact had no row schema; with task_data.py that file passes (425 passed).
pytest tests/unit_tests/test_base_user_simulation_environment_server.py tests/unit_tests/test_mcp_auto_exposure.py tests/unit_tests/test_task_data.py 497 passed, at the head
pytest tests/unit_tests/test_cli.py 142 passed, including 6 new data check cases: five rollouts for each of two tasksets, five without a taskset, and five placeholder rows pass; ten without a taskset, a taskset one short, and an empty file fail
gym env test +entrypoint=resources_servers/bird_interact +should_validate_data=true 41 passed, and the example data validated
The old and new rollout counts on the committed example_rollouts.jsonl of all 170 Resources Servers Same result for all but bird_interact, which passes now and failed the old count
pre-commit run (all files in this PR) passed

Rollout evidence

The committed example rollouts. On the five example tasks, with the Docker provider and the same two hosted GPT models (one as the policy, one as the simulator), I ran each task once in each mode with simple_agent. These ten rollouts are data/example_rollouts.jsonl.

Mode bookshop_1 bookshop_2 bookshop_3 (follow-up) bookshop_4 (follow-up) bookshop_5 Mean reward
c-Interact 0.0 0.0 1.0 1.0 0.0 0.40
a-Interact 0.7 0.7 1.0 1.0 0.7 0.82

All ten scored. None failed, none were masked, and no database sandbox was left running. In a-Interact 0.7 is the most a task without a follow-up scores, so the agent solved every task there. I read the c-Interact transcripts:

  • bookshop_1: the first SQL added an author_id column, and the debug attempt switched to a LEFT JOIN that keeps authors with no bestsellers.
  • bookshop_2: the agent asked whether "typical discount" meant a percentage or a dollar amount, the simulator answered "the average percentage discount", and the agent returned 10 for 0.10. It has scored 0.0 in every c-Interact run of this PR. In a-Interact the agent asked about the scale and the simulator answered "a fraction".
  • bookshop_5: the agent asked nothing, took "big markdowns" as 20% off, and left out the quantity.

A first run of these tasks found a defect in bookshop_4: "Rank the countries" made the agent add a RANK() column in both modes, which fails grading. The request now reads "top country first", with the same ambiguities and ground truth, and the rollouts above are from the run after that change.

At commit 65f2c194f, with the Docker provider and the same two hosted GPT models (one as the policy, one as the simulator), I ran the three example tasks with 2 repeats each:

Agent Mode bookshop_1 bookshop_2 bookshop_3 (with follow-up) Mean reward
simple_agent, direct HTTP c-Interact 0.0, 0.0 0.0, 0.0 1.0, 1.0 0.33
simple_agent, direct HTTP a-Interact 0.7, 0.7 0.7, 0.7 1.0, 1.0 0.80
Codex 0.144.4, over MCP a-Interact 0.7, 0.7 0.7, 0.7 1.0, 1.0 0.80

All 18 rollouts scored. None failed and none were masked. Docker destroyed every sandbox: 12 database sandboxes in the simple_agent run, and 6 database and 6 Codex sandboxes in the Codex run. None were left running. I read the transcripts:

  • c-Interact bookshop_1 dropped from 0.5 to 0.0. The first SQL is the same as in the earlier runs: a LEFT JOIN that keeps authors with no bestsellers. Earlier, the debug attempt switched to an inner join and passed; this time both debug attempts kept the extra rows. The question, the simulator's answer and the debug prompt match the earlier runs, so this is model variance, not a regression. bookshop_2 fails as before.
  • c-Interact first turn. Every first turn had the schema from the seed reply, and the masked knowledge entry stayed hidden. simple_agent writes one message per turn.
  • simple_agent in a-Interact made 43 tool calls at the root, across 8 of the 9 tools, execute included. None failed.
  • Codex in a-Interact listed the tools over MCP; the first request declared none. All 45 of its tool calls were BIRD's tools over MCP, and none returned an error. It never used its own shell. It solved the follow-up question as phase 2, and the BIRD-COIN counts went down with each call.
  • No tool returned a task's hidden knowledge entry in either a-Interact run.
  • Networking for Codex. The first Codex attempt failed all 6 episodes at the MCP handshake (a 30 s timeout), because this workstation's firewall drops traffic from the Docker bridge to host ports. With +default_host=172.17.0.1 and Codex's own sandbox on network: host, all 6 scored. BIRD's database sandbox stayed on the bridge. The Environment Server README now describes this setup.

Earlier runs, at earlier commits of this PR:

I ran gym env start --resources-server bird_interact --model-type vllm_model and gym eval run --no-serve on the example tasks in both modes, with 2 repeats, for 12 rollouts. The policy and the simulator were two different hosted GPT models.

Mode bookshop_1 bookshop_2 bookshop_3 (with follow-up) Mean reward
c-Interact 0.5, 0.5 (solved after the debug attempt) 0.0, 0.0 1.0, 1.0 0.50
a-Interact 0.7, 0.7 0.7, 0.7 1.0, 1.0 0.80

All 12 rollouts scored and none failed. I read every transcript:

  • Grading was correct each time.
  • Simulator answers matched the ground truth and contained no SQL.
  • The BIRD-COIN accounting matched the action costs.
  • Follow-up questions were asked and graded in both modes.

c-Interact scores lower than a-Interact, which is the same direction as the paper.

After moving the database into a sandbox, I ran the same 12 rollouts with the Docker provider (python:3.12-slim). The rewards were the same: 0.50 in c-Interact and 0.80 in a-Interact, with no failures and no masked samples. Docker destroyed 12 sandbox containers, one for each episode, and none were left running. All 14 submit tool calls were graded in the sandbox. No agent called execute in this run; the unit tests cover it.

Earlier smoke runs found three problems, now fixed and covered by tests:

  1. The c-Interact server answered questions after a failed submission. The reference treats that turn as one more SQL attempt.
  2. /verify dropped the failed phase when the BIRD-COIN budget ended the task.
  3. The simulator invented a 0–100 scale for a fraction. The responder prompt now requires facts in the form the SQL computes.

bookshop_2 in c-Interact still fails because the simulator sometimes calls the fraction "average percentage off list price". These prompts are written for Gym, so they are not the reference simulator.

Compatibility

  • simple_agent: sessions without continuation behave as before. The trajectory field on close is new and is set only for continuation sessions.
  • No existing Environment Server changes.
  • gym env test +should_validate_data=true counts example rollouts by taskset. A server whose rollouts have no taskset still needs exactly five, so the result is unchanged for every other server's committed rollouts.
  • BIRD-Interact's a-Interact tools moved from /a_interact/ to the server's root. They are new in this PR, so nothing else used them.
  • check_resources_session_contract takes a keyword-only seed_response_model, for a server whose seed reply adds typed fields. The default, ResourcesSeedSessionResponse, still forbids extra fields, so existing callers are unchanged.

Not in this PR

  • Migrating swe_together and nemo_user_sim to the base class.
  • The RFC's open_participant() for a second agent session. Nothing uses it yet.
  • The adapter gaps in the harness table: multi-turn sessions for c-Interact and tool grants for a-Interact.
  • A manifest-backed environments/bird_interact/ entry. The manifest copies each dataset without its taskset (_manifest_dataset in nemo_gym/environment/validation.py) and requires unique dataset names, so BIRD's two example entries, one for each mode, would fail validation. BIRD stays a Resources Server config here.
  • The simulator wording that fails bookshop_2 in c-Interact (see Rollout evidence).
  • Parity with the published scores. That needs:
    • the withheld ground truth, which the authors send on request (the server refuses rows without sol_sql with 422);
    • the reference simulator prompts and model;
    • custom test_cases (management tasks);
    • PostgreSQL for Lite and Full. It goes into the same session sandbox, with a different image and runner.

Code provenance

This is an independent implementation. No code or prompts are copied from bird-bench/BIRD-Interact (MIT).

  • grading.py implements the published default comparison: remove DISTINCT and ROUND, round floats to two places, then compare as an ordered list or as a set.
  • The a-Interact action costs and budget formula are the published values.
  • The bookshop database and tasks are synthetic and written for this PR (Apache 2.0).

🤖 Generated with Claude Code

… on it

Add BaseUserSimulationEnvironmentServer to nemo_gym. It owns the agent
session, the turn loop, the turn and interaction deadlines, and the failure
stages for Environment Servers that write every user message. A subclass
implements start_episode, agent_access, opening_request, next_user_turn and
finish_episode.

simple_agent now supports resume_harness_session continuation: it keeps the
session's conversation and gets only the new input on each activation, so
multi-turn episodes can run on it.

Add BIRD-Interact as the first subclass, in both modes. The bird_interact
Resources Server holds each episode's SQLite copy, the two-stage user
simulator, the grader and the BIRD-COIN budget. c-Interact calls its /ask and
/submit routes; a-Interact grants the agent the same actions as tools under
/a_interact/.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: Felipe Vieira Frujeri <[email protected]>
@copy-pr-bot

copy-pr-bot Bot commented Oct 28, 2026

Copy link
Copy Markdown

This pull request requires additional validation before any workflows can run on NVIDIA's runners.

Pull request vetters can view their responsibilities here.

Contributors can view more details about this message here.

@svcnvidia-nemo-ci svcnvidia-nemo-ci added area:environment Individual environments, benchmarks, verifiers, and environment-specific resources servers feature New capabilities, enhancements, or enablement work labels Oct 28, 2026
ffrujeri and others added 3 commits October 29, 2026 01:44
The bird_interact Resources Server now starts a sandbox for each session at
seed and stops it at close, and at shutdown stops any sandbox still open.
The episode database, the agent's SQL (a-Interact execute) and grading run
there through grading.py, which the server uploads with the database source
and runs as `python3 grading.py <setup|execute|grade> <request.json>`.
Requests go in an uploaded file, not on the command line.

A command the sandbox does not run is an infrastructure failure: it runs
again on a fresh sandbox up to inconclusive_verification_retries times,
then the route answers 503. In c-Interact the Environment Server retries
the episode; in a-Interact verify masks the sample with
bird_interact:sandbox_failed. A failed close keeps the session so the next
close retries the stop.

The config binds `sandbox_provider: sandbox` (pick a provider config with
--config); tests use the local provider. The README's run instructions now
show the materialized taskset input that gym eval run needs.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: Felipe Vieira Frujeri <[email protected]>
The Resources Server starts the session sandboxes, so its venv needs the
provider SDKs. Without nemo-gym[sandbox], an OpenSandbox provider fails
every seed with "tenacity is required for OpenSandbox retry handling".
Matches the other sandboxed Resources Servers, such as swebench_pro and
gdpval. The Environment Server does not use sandboxes and is unchanged.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: Felipe Vieira Frujeri <[email protected]>
… check the mode

The c-Interact routes, /ask and /submit, did not check the session's
mode. An a-Interact agent could reach them with a tool name such as
../submit: simple_agent does not check tool names, and the URL resolves
outside the /a_interact/ prefix. /submit then graded the SQL without
charging its BIRD-COIN.

- Move the routes to /c_interact/ask and /c_interact/submit, next to
  /a_interact/.
- Refuse an a-Interact session on them with 409, as the a-Interact tools
  already refuse a c-Interact session.
- Test that both routes refuse an a-Interact session and grade nothing.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: Felipe Vieira Frujeri <[email protected]>
ffrujeri and others added 15 commits October 29, 2026 06:57
The Environment Server read the opening request's context from a route
of its own, /episode_context, because the seed reply had no room for it.
In a-Interact that route also returned the schema, the column meanings
and the knowledge base, which the tools charge BIRD-COIN for.

- The seed reply is now BirdInteractSeedSessionResponse, a subclass of
  ResourcesSeedSessionResponse with the episode's context, and
  /episode_context is gone.
- In a-Interact the context has only the database, the request and the
  coin budget.
- check_resources_session_contract takes a keyword-only
  seed_response_model, for a server whose seed reply adds typed fields.
  The default still forbids extra fields.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: Felipe Vieira Frujeri <[email protected]>
Every Resources Server must ship a task_data.py that describes its
dataset rows, and bird_interact did not, so
tests/unit_tests/test_task_data.py failed.

- Move BirdInteractTask and its parts from schemas.py to task_data.py,
  which may import only the standard library and Pydantic, and export it
  as TaskData. The importers now read it from task_data.
- Declare the published row fields that Gym does not read (category,
  high_level, external_knowledge, clean_up_sqls) as provenance, so the
  example rows validate.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: Felipe Vieira Frujeri <[email protected]>
…reate_params

The hook returns the first turn's request, which is the object Gym calls
responses_create_params everywhere else: a dataset row's field, the
field of BaseVerifyRequest, and what single_agent_turn sends to the
agent. BIRD already passed it to /verify under that name.

Rename the hook, its call in the base class, BIRD's implementation and
episode field, and the base-class test, and say in the docstring that
later turns send only a UserMessage.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: Felipe Vieira Frujeri <[email protected]>
Codex, Pi and Hermes accept only MCP tool grants, so none of them could run
a-Interact.

- The Resources Server serves the nine tools at its root, Gym's convention,
  and over MCP (`expose_tools_over_mcp: true` in the config). MCP
  auto-exposure refuses a tool name with a slash, so the `/a_interact/`
  prefix goes.
- `mcp_tools()` leaves out the `/c_interact/` routes. A session's MCP token
  lists the nine tools in a-Interact and none in c-Interact.
- The tools' descriptions and arguments live in `schemas.A_INTERACT_TOOLS`,
  so the agent sees the same tools over either transport.
- The Environment Server takes `resources_tool_transports`, as
  single_agent_turn does: `direct_http` (the default), `mcp`, or both. Over
  MCP alone the first request declares no tools, because Codex refuses one
  that does. `mcp` without exposure on the Resources Server fails at seed,
  for good.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: Felipe Vieira Frujeri <[email protected]>
…ssage

A harness with its own tools, such as a shell, can take several steps in one
c-Interact turn and write a message at each. `output_text` joined them all,
so SQL drafted in an early step became a submission, and a question carried
the narration of every step. The reply is now the last message, the one
that answers the user. For a one-step turn, as with simple_agent, nothing
changes.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: Felipe Vieira Frujeri <[email protected]>
The Resources Server uploads each sandbox command's request as a JSON file,
and a grade request holds the solution SQL. Nothing deleted the files, so
every graded submission left its solution in the session sandbox. The agent
never gets that sandbox today, so nothing leaked, but the sandbox would
expose the answers if it were ever granted. grading.py now deletes the
request file once it has read it.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: Felipe Vieira Frujeri <[email protected]>
The Environment Server README gets a table of the main harnesses (simple_agent,
Codex, Pi, Hermes, Stirrup, OpenCode, Claude Code, Kilo, OpenClaw) and what
each adapter's session seed accepts in each mode. It says the rows come from
the seed checks, not from runs. The gaps it records are in the adapters:
multi-turn sessions for c-Interact and tool grants for a-Interact. It also
explains why neither mode grants a sandbox, and the reachability an MCP grant
needs from a sandboxed harness.

The Resources Server's verify docstring says it grades from session state and
does not read the request's response.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: Felipe Vieira Frujeri <[email protected]>
The example's request read "For each author, show their name and how many
of their books are bestsellers", but its ground truth lists only the
authors with at least one bestseller, as its unambiguous `query` says. An
agent that listed every author with a count of 0 gave a fair reading and
failed, which tested the wording, not the hidden Bestseller definition.
The request now asks for the authors who have bestsellers. The term
"bestsellers" stays, so the hidden-knowledge ambiguity is unchanged.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: Felipe Vieira Frujeri <[email protected]>
…ones

`gym env test` checks five example rows for a resources server; BIRD had three, each with one
critical ambiguity. Most published BIRD-Interact tasks have two or more, of several types.

- bookshop_4: "earned" (linked to the Revenue entry, hidden here) and "last quarter" (semantic),
  ranked, with a follow-up that depends on phase 1's result.
- bookshop_5: "big markdowns" (semantic) and "how much was knocked off" (intent), with no hidden
  knowledge.

Each solution passes grading.py against itself, and plausible misreadings of each ambiguity fail.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: Felipe Vieira Frujeri <[email protected]>
CI's changed-server step runs the example data check, which needs example_metrics.json and five
example rollouts. BIRD had neither.

- The two example datasets now share the name `example`. They declare one file under two tasksets;
  the metrics sidecar leaves out the taskset but keeps the name, so two names conflicted.
- example_rollouts.jsonl has one c-Interact rollout for each task, with simple_agent. The check
  expects one rollout for each row, so the a-Interact rollouts are left out.
- bookshop_4 asks for the top country first instead of a ranking: in the first run, the agent
  added a RANK() column in both modes, which no ambiguity covers.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: Felipe Vieira Frujeri <[email protected]>
The data check wanted exactly five rows in example_rollouts.jsonl. A benchmark
that runs the same examples under two Environment Servers, such as BIRD-Interact's
two modes, routes each run by its own taskset and so has five rollouts per
taskset. Count the rollouts by the taskset in their task ID; rollouts without
one (and the placeholder rows some servers commit) count as one group, so every
other server's check is unchanged.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: Felipe Vieira Frujeri <[email protected]>
The examples run in both modes, under one taskset each, so the example rollouts
now hold both: the five c-Interact rollouts, then the five a-Interact ones from
the same run (W&B ix06ycxw).

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: Felipe Vieira Frujeri <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: Felipe Vieira Frujeri <[email protected]>
@ffrujeri

Copy link
Copy Markdown
Contributor Author

/ok to test c71b12c

@github-actions

Copy link
Copy Markdown
Contributor

ffrujeri added a commit that referenced this pull request Nov 12, 2026
A user-simulation Environment Server activates the agent once for each
turn of the conversation and sends only the new user message. Simple
Agent now accepts a seed that asks for continuation: each activation
runs the turn loop on the session's conversation plus its new input,
and keeps the first activation's tools and instructions.

- An activation without new input, or one that replaces the session's
  tools or instructions, gets 422.
- A retried activation gets its reply without another model call.
- The close returns the trajectory of every activation.
- A continuation seed is refused when partial-rollout checkpoints are
  on, because a checkpoint exports no conversation history.

Carried over from #5202, which prototyped it.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: Felipe Vieira Frujeri <[email protected]>
ffrujeri added a commit that referenced this pull request Nov 12, 2026
…h no Resources Server

BIRD-Interact moves into one Environment Server for each mode, as
approach A of the BIRD-Interact RFC proposes. The server subclasses
BaseEnvironmentServerWithTools directly: its run_episode starts the
database sandbox, serves the a-Interact tools, seeds the agent session,
runs the turns and grades them. The #5202 prototype splits each episode
between an Environment Server and a Resources Server; here the
Environment Server owns the database sandbox, the user simulator, the
grader, the phase and BIRD-COIN rules and the turns.

- The agent session (agent_session.py) is seeded with the episode's
  grants, resumes across c-Interact turns, and is closed before grading.
  A turn over turn_timeout_seconds fails the episode for a retry, the
  optional interaction deadline stops the turns and still grades, and a
  failure keeps the completed turns, the tool calls and the agent's
  evidence.
- c-Interact: a question or a submission in each agent reply becomes
  an in-process call. No routes between two servers, and no session
  cookie that reaches every route.
- a-Interact: the nine tools are a TypedToolset of the episode, served
  over direct HTTP, MCP or both (tool_transports), with the signed
  episode token, on any of several workers. The first request declares
  them as strict function tools over direct HTTP, and none over MCP
  alone.
- Each episode starts its database sandbox and registers its stop, so
  the sandbox stops on every path, including shutdown. A command that
  fails for infrastructure reasons runs again on a fresh sandbox; then
  c-Interact fails the episode for a retry and a-Interact masks the
  sample, as does a simulator failure in an a-Interact ask.
- A task without sol_sql, with custom test cases or without its
  database fails at seed, for good.
- The example datasets are declared on the agent, one taskset for each
  mode, and validated by the Environment Server's task_data.py (the
  Harbor layout). gym env test's data and catalog checks still cover
  only Resources Servers (GYMINT-643).

grading.py, simulator.py, task_data.py and the example data come from
#5202 unchanged, apart from module paths and wording.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: Felipe Vieira Frujeri <[email protected]>
ffrujeri added a commit that referenced this pull request Nov 12, 2026
A user-simulation Environment Server activates the agent once for each
turn of the conversation and sends only the new user message. Simple
Agent now accepts a seed that asks for continuation: each activation
runs the turn loop on the session's conversation plus its new input,
and keeps the first activation's tools and instructions.

- An activation without new input, or one that replaces the session's
  tools or instructions, gets 422.
- A retried activation gets its reply without another model call.
- The close returns the trajectory of every activation.
- A continuation seed is refused when partial-rollout checkpoints are
  on, because a checkpoint exports no conversation history.

Carried over from #5202, which prototyped it.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: Felipe Vieira Frujeri <[email protected]>
ffrujeri added a commit that referenced this pull request Nov 12, 2026
…h no Resources Server

BIRD-Interact moves into one Environment Server for each mode, as
approach A of the BIRD-Interact RFC proposes. The server subclasses
BaseEnvironmentServerWithTools directly: its run_episode starts the
database sandbox, serves the a-Interact tools, seeds the agent session,
runs the turns and grades them. The #5202 prototype splits each episode
between an Environment Server and a Resources Server; here the
Environment Server owns the database sandbox, the user simulator, the
grader, the phase and BIRD-COIN rules and the turns.

- The agent session (agent_session.py) is seeded with the episode's
  grants, resumes across c-Interact turns, and is closed before grading.
  A turn over turn_timeout_seconds fails the episode for a retry, the
  optional interaction deadline stops the turns and still grades, and a
  failure keeps the completed turns, the tool calls and the agent's
  evidence.
- c-Interact: a question or a submission in each agent reply becomes
  an in-process call. No routes between two servers, and no session
  cookie that reaches every route.
- a-Interact: the nine tools are a TypedToolset of the episode, served
  over direct HTTP, MCP or both (tool_transports), with the signed
  episode token, on any of several workers. The first request declares
  them as strict function tools over direct HTTP, and none over MCP
  alone.
- Each episode starts its database sandbox and registers its stop, so
  the sandbox stops on every path, including shutdown. A command that
  fails for infrastructure reasons runs again on a fresh sandbox; then
  c-Interact fails the episode for a retry and a-Interact masks the
  sample, as does a simulator failure in an a-Interact ask.
- A task without sol_sql, with custom test cases or without its
  database fails at seed, for good.
- The example datasets are declared on the agent, one taskset for each
  mode, and validated by the Environment Server's task_data.py (the
  Harbor layout). gym env test's data and catalog checks still cover
  only Resources Servers (GYMINT-643).

grading.py, simulator.py, task_data.py and the example data come from
#5202 unchanged, apart from module paths and wording.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: Felipe Vieira Frujeri <[email protected]>
ffrujeri added a commit that referenced this pull request Nov 12, 2026
A user-simulation Environment Server activates the agent once for each
turn of the conversation and sends only the new user message. Simple
Agent now accepts a seed that asks for continuation: each activation
runs the turn loop on the session's conversation plus its new input,
and keeps the first activation's tools and instructions.

- An activation without new input, or one that replaces the session's
  tools or instructions, gets 422.
- A retried activation gets its reply without another model call.
- The close returns the trajectory of every activation.
- A continuation seed is refused when partial-rollout checkpoints are
  on, because a checkpoint exports no conversation history.

Carried over from #5202, which prototyped it.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: Felipe Vieira Frujeri <[email protected]>
ffrujeri added a commit that referenced this pull request Nov 12, 2026
…h no Resources Server

BIRD-Interact moves into one Environment Server for each mode, as
approach A of the BIRD-Interact RFC proposes. The server subclasses
BaseEnvironmentServerWithTools directly: its run_episode starts the
database sandbox, serves the a-Interact tools, seeds the agent session,
runs the turns and grades them. The #5202 prototype splits each episode
between an Environment Server and a Resources Server; here the
Environment Server owns the database sandbox, the user simulator, the
grader, the phase and BIRD-COIN rules and the turns.

- The agent session (agent_session.py) is seeded with the episode's
  grants, resumes across c-Interact turns, and is closed before grading.
  A turn over turn_timeout_seconds fails the episode for a retry, the
  optional interaction deadline stops the turns and still grades, and a
  failure keeps the completed turns, the tool calls and the agent's
  evidence.
- c-Interact: a question or a submission in each agent reply becomes
  an in-process call. No routes between two servers, and no session
  cookie that reaches every route.
- a-Interact: the nine tools are a TypedToolset of the episode, served
  over direct HTTP, MCP or both (tool_transports), with the signed
  episode token, on any of several workers. The first request declares
  them as strict function tools over direct HTTP, and none over MCP
  alone.
- Each episode starts its database sandbox and registers its stop, so
  the sandbox stops on every path, including shutdown. A command that
  fails for infrastructure reasons runs again on a fresh sandbox; then
  c-Interact fails the episode for a retry and a-Interact masks the
  sample, as does a simulator failure in an a-Interact ask.
- A task without sol_sql, with custom test cases or without its
  database fails at seed, for good.
- The example datasets are declared on the agent, one taskset for each
  mode, and validated by the Environment Server's task_data.py (the
  Harbor layout). gym env test's data and catalog checks still cover
  only Resources Servers (GYMINT-643).

grading.py, simulator.py, task_data.py and the example data come from
#5202 unchanged, apart from module paths and wording.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: Felipe Vieira Frujeri <[email protected]>
ffrujeri added a commit that referenced this pull request Nov 13, 2026
A user-simulation Environment Server activates the agent once for each
turn of the conversation and sends only the new user message. Simple
Agent now accepts a seed that asks for continuation: each activation
runs the turn loop on the session's conversation plus its new input,
and keeps the first activation's tools and instructions.

- An activation without new input, or one that replaces the session's
  tools or instructions, gets 422.
- A retried activation gets its reply without another model call.
- The close returns the trajectory of every activation.
- A continuation seed is refused when partial-rollout checkpoints are
  on, because a checkpoint exports no conversation history.

Carried over from #5202, which prototyped it.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: Felipe Vieira Frujeri <[email protected]>
ffrujeri added a commit that referenced this pull request Nov 13, 2026
…h no Resources Server

BIRD-Interact moves into one Environment Server for each mode, as
approach A of the BIRD-Interact RFC proposes. The server subclasses
BaseEnvironmentServerWithTools directly: its run_episode starts the
database sandbox, serves the a-Interact tools, seeds the agent session,
runs the turns and grades them. The #5202 prototype splits each episode
between an Environment Server and a Resources Server; here the
Environment Server owns the database sandbox, the user simulator, the
grader, the phase and BIRD-COIN rules and the turns.

- The agent session (agent_session.py) is seeded with the episode's
  grants, resumes across c-Interact turns, and is closed before grading.
  A turn over turn_timeout_seconds fails the episode for a retry, the
  optional interaction deadline stops the turns and still grades, and a
  failure keeps the completed turns, the tool calls and the agent's
  evidence.
- c-Interact: a question or a submission in each agent reply becomes
  an in-process call. No routes between two servers, and no session
  cookie that reaches every route.
- a-Interact: the nine tools are a TypedToolset of the episode, served
  over direct HTTP, MCP or both (tool_transports), with the signed
  episode token, on any of several workers. The first request declares
  them as strict function tools over direct HTTP, and none over MCP
  alone.
- Each episode starts its database sandbox and registers its stop, so
  the sandbox stops on every path, including shutdown. A command that
  fails for infrastructure reasons runs again on a fresh sandbox; then
  c-Interact fails the episode for a retry and a-Interact masks the
  sample, as does a simulator failure in an a-Interact ask.
- A task without sol_sql, with custom test cases or without its
  database fails at seed, for good.
- The example datasets are declared on the agent, one taskset for each
  mode, and validated by the Environment Server's task_data.py (the
  Harbor layout). gym env test's data and catalog checks still cover
  only Resources Servers (GYMINT-643).

grading.py, simulator.py, task_data.py and the example data come from
#5202 unchanged, apart from module paths and wording.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: Felipe Vieira Frujeri <[email protected]>
ffrujeri added a commit that referenced this pull request Nov 16, 2026
A user-simulation Environment Server activates the agent once for each
turn of the conversation and sends only the new user message. Simple
Agent now accepts a seed that asks for continuation: each activation
runs the turn loop on the session's conversation plus its new input,
and keeps the first activation's tools and instructions.

- An activation without new input, or one that replaces the session's
  tools or instructions, gets 422.
- A retried activation gets its reply without another model call.
- The close returns the trajectory of every activation.
- A continuation seed is refused when partial-rollout checkpoints are
  on, because a checkpoint exports no conversation history.

Carried over from #5202, which prototyped it.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: Felipe Vieira Frujeri <[email protected]>
ffrujeri added a commit that referenced this pull request Nov 16, 2026
…h no Resources Server

BIRD-Interact moves into one Environment Server for each mode, as
approach A of the BIRD-Interact RFC proposes. The server subclasses
BaseEnvironmentServerWithTools directly: its run_episode starts the
database sandbox, serves the a-Interact tools, seeds the agent session,
runs the turns and grades them. The #5202 prototype splits each episode
between an Environment Server and a Resources Server; here the
Environment Server owns the database sandbox, the user simulator, the
grader, the phase and BIRD-COIN rules and the turns.

- The agent session (agent_session.py) is seeded with the episode's
  grants, resumes across c-Interact turns, and is closed before grading.
  A turn over turn_timeout_seconds fails the episode for a retry, the
  optional interaction deadline stops the turns and still grades, and a
  failure keeps the completed turns, the tool calls and the agent's
  evidence.
- c-Interact: a question or a submission in each agent reply becomes
  an in-process call. No routes between two servers, and no session
  cookie that reaches every route.
- a-Interact: the nine tools are a TypedToolset of the episode, served
  over direct HTTP, MCP or both (tool_transports), with the signed
  episode token, on any of several workers. The first request declares
  them as strict function tools over direct HTTP, and none over MCP
  alone.
- Each episode starts its database sandbox and registers its stop, so
  the sandbox stops on every path, including shutdown. A command that
  fails for infrastructure reasons runs again on a fresh sandbox; then
  c-Interact fails the episode for a retry and a-Interact masks the
  sample, as does a simulator failure in an a-Interact ask.
- A task without sol_sql, with custom test cases or without its
  database fails at seed, for good.
- The example datasets are declared on the agent, one taskset for each
  mode, and validated by the Environment Server's task_data.py (the
  Harbor layout). gym env test's data and catalog checks still cover
  only Resources Servers (GYMINT-643).

grading.py, simulator.py, task_data.py and the example data come from
#5202 unchanged, apart from module paths and wording.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: Felipe Vieira Frujeri <[email protected]>
ffrujeri added a commit that referenced this pull request Nov 16, 2026
A user-simulation Environment Server activates the agent once for each
turn of the conversation and sends only the new user message. Simple
Agent now accepts a seed that asks for continuation: each activation
runs the turn loop on the session's conversation plus its new input,
and keeps the first activation's tools and instructions.

- An activation without new input, or one that replaces the session's
  tools or instructions, gets 422.
- A retried activation gets its reply without another model call.
- The close returns the trajectory of every activation.
- A continuation seed is refused when partial-rollout checkpoints are
  on, because a checkpoint exports no conversation history.

Carried over from #5202, which prototyped it.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: Felipe Vieira Frujeri <[email protected]>
ffrujeri added a commit that referenced this pull request Nov 16, 2026
…h no Resources Server

BIRD-Interact moves into one Environment Server for each mode, as
approach A of the BIRD-Interact RFC proposes. The server subclasses
BaseEnvironmentServerWithTools directly: its run_episode starts the
database sandbox, serves the a-Interact tools, seeds the agent session,
runs the turns and grades them. The #5202 prototype splits each episode
between an Environment Server and a Resources Server; here the
Environment Server owns the database sandbox, the user simulator, the
grader, the phase and BIRD-COIN rules and the turns.

- The agent session (agent_session.py) is seeded with the episode's
  grants, resumes across c-Interact turns, and is closed before grading.
  A turn over turn_timeout_seconds fails the episode for a retry, the
  optional interaction deadline stops the turns and still grades, and a
  failure keeps the completed turns, the tool calls and the agent's
  evidence.
- c-Interact: a question or a submission in each agent reply becomes
  an in-process call. No routes between two servers, and no session
  cookie that reaches every route.
- a-Interact: the nine tools are a TypedToolset of the episode, served
  over direct HTTP, MCP or both (tool_transports), with the signed
  episode token, on any of several workers. The first request declares
  them as strict function tools over direct HTTP, and none over MCP
  alone.
- Each episode starts its database sandbox and registers its stop, so
  the sandbox stops on every path, including shutdown. A command that
  fails for infrastructure reasons runs again on a fresh sandbox; then
  c-Interact fails the episode for a retry and a-Interact masks the
  sample, as does a simulator failure in an a-Interact ask.
- A task without sol_sql, with custom test cases or without its
  database fails at seed, for good.
- The example datasets are declared on the agent, one taskset for each
  mode, and validated by the Environment Server's task_data.py (the
  Harbor layout). gym env test's data and catalog checks still cover
  only Resources Servers (GYMINT-643).

grading.py, simulator.py, task_data.py and the example data come from
#5202 unchanged, apart from module paths and wording.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: Felipe Vieira Frujeri <[email protected]>
ffrujeri added a commit that referenced this pull request Nov 16, 2026
A user-simulation Environment Server activates the agent once for each
turn of the conversation and sends only the new user message. Simple
Agent now accepts a seed that asks for continuation: each activation
runs the turn loop on the session's conversation plus its new input,
and keeps the first activation's tools and instructions.

- An activation without new input, or one that replaces the session's
  tools or instructions, gets 422.
- A retried activation gets its reply without another model call.
- The close returns the trajectory of every activation.
- A continuation seed is refused when partial-rollout checkpoints are
  on, because a checkpoint exports no conversation history.

Carried over from #5202, which prototyped it.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: Felipe Vieira Frujeri <[email protected]>
ffrujeri added a commit that referenced this pull request Nov 16, 2026
…h no Resources Server

BIRD-Interact moves into one Environment Server for each mode, as
approach A of the BIRD-Interact RFC proposes. The server subclasses
BaseEnvironmentServerWithTools directly: its run_episode starts the
database sandbox, serves the a-Interact tools, seeds the agent session,
runs the turns and grades them. The #5202 prototype splits each episode
between an Environment Server and a Resources Server; here the
Environment Server owns the database sandbox, the user simulator, the
grader, the phase and BIRD-COIN rules and the turns.

- The agent session (agent_session.py) is seeded with the episode's
  grants, resumes across c-Interact turns, and is closed before grading.
  A turn over turn_timeout_seconds fails the episode for a retry, the
  optional interaction deadline stops the turns and still grades, and a
  failure keeps the completed turns, the tool calls and the agent's
  evidence.
- c-Interact: a question or a submission in each agent reply becomes
  an in-process call. No routes between two servers, and no session
  cookie that reaches every route.
- a-Interact: the nine tools are a TypedToolset of the episode, served
  over direct HTTP, MCP or both (tool_transports), with the signed
  episode token, on any of several workers. The first request declares
  them as strict function tools over direct HTTP, and none over MCP
  alone.
- Each episode starts its database sandbox and registers its stop, so
  the sandbox stops on every path, including shutdown. A command that
  fails for infrastructure reasons runs again on a fresh sandbox; then
  c-Interact fails the episode for a retry and a-Interact masks the
  sample, as does a simulator failure in an a-Interact ask.
- A task without sol_sql, with custom test cases or without its
  database fails at seed, for good.
- The example datasets are declared on the agent, one taskset for each
  mode, and validated by the Environment Server's task_data.py (the
  Harbor layout). gym env test's data and catalog checks still cover
  only Resources Servers (GYMINT-643).

grading.py, simulator.py, task_data.py and the example data come from
#5202 unchanged, apart from module paths and wording.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: Felipe Vieira Frujeri <[email protected]>
ffrujeri added a commit that referenced this pull request Nov 16, 2026
…h no Resources Server

BIRD-Interact moves into one Environment Server for each mode, as
approach A of the BIRD-Interact RFC proposes. The server subclasses
BaseEnvironmentServerWithTools directly: its run_episode starts the
database sandbox, serves the a-Interact tools, seeds the agent session,
runs the turns and grades them. The #5202 prototype splits each episode
between an Environment Server and a Resources Server; here the
Environment Server owns the database sandbox, the user simulator, the
grader, the phase and BIRD-COIN rules and the turns.

- The agent session (agent_session.py) is seeded with the episode's
  grants, resumes across c-Interact turns, and is closed before grading.
  A turn over turn_timeout_seconds fails the episode for a retry, the
  optional interaction deadline stops the turns and still grades, and a
  failure keeps the completed turns, the tool calls and the agent's
  evidence.
- c-Interact: a question or a submission in each agent reply becomes
  an in-process call. No routes between two servers, and no session
  cookie that reaches every route.
- a-Interact: the nine tools are a TypedToolset of the episode, served
  over direct HTTP, MCP or both (tool_transports), with the signed
  episode token, on any of several workers. The first request declares
  them as strict function tools over direct HTTP, and none over MCP
  alone.
- Each episode starts its database sandbox and registers its stop, so
  the sandbox stops on every path, including shutdown. A command that
  fails for infrastructure reasons runs again on a fresh sandbox; then
  c-Interact fails the episode for a retry and a-Interact masks the
  sample, as does a simulator failure in an a-Interact ask.
- A task without sol_sql, with custom test cases or without its
  database fails at seed, for good.
- The example datasets are declared on the agent, one taskset for each
  mode, and validated by the Environment Server's task_data.py (the
  Harbor layout). gym env test's data and catalog checks still cover
  only Resources Servers (GYMINT-643).

grading.py, simulator.py, task_data.py and the example data come from
#5202 unchanged, apart from module paths and wording.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: Felipe Vieira Frujeri <[email protected]>
ffrujeri added a commit that referenced this pull request Nov 17, 2026
A user-simulation Environment Server activates the agent once for each
turn of the conversation and sends only the new user message. Simple
Agent now accepts a seed that asks for continuation: each activation
runs the turn loop on the session's conversation plus its new input,
and keeps the first activation's tools and instructions.

- An activation without new input, or one that replaces the session's
  tools or instructions, gets 422.
- A retried activation gets its reply without another model call.
- The close returns the trajectory of every activation.
- A continuation seed is refused when partial-rollout checkpoints are
  on, because a checkpoint exports no conversation history.

Carried over from #5202, which prototyped it.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: Felipe Vieira Frujeri <[email protected]>
ffrujeri added a commit that referenced this pull request Nov 17, 2026
…h no Resources Server

BIRD-Interact moves into one Environment Server for each mode, as
approach A of the BIRD-Interact RFC proposes. The server subclasses
BaseEnvironmentServerWithTools directly: its run_episode starts the
database sandbox, serves the a-Interact tools, seeds the agent session,
runs the turns and grades them. The #5202 prototype splits each episode
between an Environment Server and a Resources Server; here the
Environment Server owns the database sandbox, the user simulator, the
grader, the phase and BIRD-COIN rules and the turns.

- The agent session (agent_session.py) is seeded with the episode's
  grants, resumes across c-Interact turns, and is closed before grading.
  A turn over turn_timeout_seconds fails the episode for a retry, the
  optional interaction deadline stops the turns and still grades, and a
  failure keeps the completed turns, the tool calls and the agent's
  evidence.
- c-Interact: a question or a submission in each agent reply becomes
  an in-process call. No routes between two servers, and no session
  cookie that reaches every route.
- a-Interact: the nine tools are a TypedToolset of the episode, served
  over direct HTTP, MCP or both (tool_transports), with the signed
  episode token, on any of several workers. The first request declares
  them as strict function tools over direct HTTP, and none over MCP
  alone.
- Each episode starts its database sandbox and registers its stop, so
  the sandbox stops on every path, including shutdown. A command that
  fails for infrastructure reasons runs again on a fresh sandbox; then
  c-Interact fails the episode for a retry and a-Interact masks the
  sample, as does a simulator failure in an a-Interact ask.
- A task without sol_sql, with custom test cases or without its
  database fails at seed, for good.
- The example datasets are declared on the agent, one taskset for each
  mode, and validated by the Environment Server's task_data.py (the
  Harbor layout). gym env test's data and catalog checks still cover
  only Resources Servers (GYMINT-643).

grading.py, simulator.py, task_data.py and the example data come from
#5202 unchanged, apart from module paths and wording.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: Felipe Vieira Frujeri <[email protected]>
ffrujeri added a commit that referenced this pull request Nov 18, 2026
A user-simulation Environment Server activates the agent once for each
turn of the conversation and sends only the new user message. Simple
Agent now accepts a seed that asks for continuation: each activation
runs the turn loop on the session's conversation plus its new input,
and keeps the first activation's tools and instructions.

- An activation without new input, or one that replaces the session's
  tools or instructions, gets 422.
- A retried activation gets its reply without another model call.
- The close returns the trajectory of every activation.
- A continuation seed is refused when partial-rollout checkpoints are
  on, because a checkpoint exports no conversation history.

Carried over from #5202, which prototyped it.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: Felipe Vieira Frujeri <[email protected]>
ffrujeri added a commit that referenced this pull request Nov 18, 2026
…h no Resources Server

BIRD-Interact moves into one Environment Server for each mode, as
approach A of the BIRD-Interact RFC proposes. The server subclasses
BaseEnvironmentServerWithTools directly: its run_episode starts the
database sandbox, serves the a-Interact tools, seeds the agent session,
runs the turns and grades them. The #5202 prototype splits each episode
between an Environment Server and a Resources Server; here the
Environment Server owns the database sandbox, the user simulator, the
grader, the phase and BIRD-COIN rules and the turns.

- The agent session (agent_session.py) is seeded with the episode's
  grants, resumes across c-Interact turns, and is closed before grading.
  A turn over turn_timeout_seconds fails the episode for a retry, the
  optional interaction deadline stops the turns and still grades, and a
  failure keeps the completed turns, the tool calls and the agent's
  evidence.
- c-Interact: a question or a submission in each agent reply becomes
  an in-process call. No routes between two servers, and no session
  cookie that reaches every route.
- a-Interact: the nine tools are a TypedToolset of the episode, served
  over direct HTTP, MCP or both (tool_transports), with the signed
  episode token, on any of several workers. The first request declares
  them as strict function tools over direct HTTP, and none over MCP
  alone.
- Each episode starts its database sandbox and registers its stop, so
  the sandbox stops on every path, including shutdown. A command that
  fails for infrastructure reasons runs again on a fresh sandbox; then
  c-Interact fails the episode for a retry and a-Interact masks the
  sample, as does a simulator failure in an a-Interact ask.
- A task without sol_sql, with custom test cases or without its
  database fails at seed, for good.
- The example datasets are declared on the agent, one taskset for each
  mode, and validated by the Environment Server's task_data.py (the
  Harbor layout). gym env test's data and catalog checks still cover
  only Resources Servers (GYMINT-643).

grading.py, simulator.py, task_data.py and the example data come from
#5202 unchanged, apart from module paths and wording.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: Felipe Vieira Frujeri <[email protected]>
ffrujeri added a commit that referenced this pull request Nov 19, 2026
…h no Resources Server

BIRD-Interact moves into one Environment Server for each mode, as
approach A of the BIRD-Interact RFC proposes. The server subclasses
BaseEnvironmentServerWithTools directly: its run_episode starts the
database sandbox, serves the a-Interact tools, seeds the agent session,
runs the turns and grades them. The #5202 prototype splits each episode
between an Environment Server and a Resources Server; here the
Environment Server owns the database sandbox, the user simulator, the
grader, the phase and BIRD-COIN rules and the turns.

- The agent session (agent_session.py) is seeded with the episode's
  grants, resumes across c-Interact turns, and is closed before grading.
  A turn over turn_timeout_seconds fails the episode for a retry, the
  optional interaction deadline stops the turns and still grades, and a
  failure keeps the completed turns, the tool calls and the agent's
  evidence.
- c-Interact: a question or a submission in each agent reply becomes
  an in-process call. No routes between two servers, and no session
  cookie that reaches every route.
- a-Interact: the nine tools are a TypedToolset of the episode, served
  over direct HTTP, MCP or both (tool_transports), with the signed
  episode token, on any of several workers. The first request declares
  them as strict function tools over direct HTTP, and none over MCP
  alone.
- Each episode starts its database sandbox and registers its stop, so
  the sandbox stops on every path, including shutdown. A command that
  fails for infrastructure reasons runs again on a fresh sandbox; then
  c-Interact fails the episode for a retry and a-Interact masks the
  sample, as does a simulator failure in an a-Interact ask.
- A task without sol_sql, with custom test cases or without its
  database fails at seed, for good.
- The example datasets are declared on the agent, one taskset for each
  mode, and validated by the Environment Server's task_data.py (the
  Harbor layout). gym env test's data and catalog checks still cover
  only Resources Servers (GYMINT-643).

grading.py, simulator.py, task_data.py and the example data come from
#5202 unchanged, apart from module paths and wording.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: Felipe Vieira Frujeri <[email protected]>
ffrujeri added a commit that referenced this pull request Nov 19, 2026
A user-simulation Environment Server activates the agent once for each
turn of the conversation and sends only the new user message. Simple
Agent now accepts a seed that asks for continuation: each activation
runs the turn loop on the session's conversation plus its new input,
and keeps the first activation's tools and instructions.

- An activation without new input, or one that replaces the session's
  tools or instructions, gets 422.
- A retried activation gets its reply without another model call.
- The close returns the trajectory of every activation.
- A continuation seed is refused when partial-rollout checkpoints are
  on, because a checkpoint exports no conversation history.

Carried over from #5202, which prototyped it.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: Felipe Vieira Frujeri <[email protected]>
ffrujeri added a commit that referenced this pull request Nov 19, 2026
…h no Resources Server

BIRD-Interact moves into one Environment Server for each mode, as
approach A of the BIRD-Interact RFC proposes. The server subclasses
BaseEnvironmentServerWithTools directly: its run_episode starts the
database sandbox, serves the a-Interact tools, seeds the agent session,
runs the turns and grades them. The #5202 prototype splits each episode
between an Environment Server and a Resources Server; here the
Environment Server owns the database sandbox, the user simulator, the
grader, the phase and BIRD-COIN rules and the turns.

- The agent session (agent_session.py) is seeded with the episode's
  grants, resumes across c-Interact turns, and is closed before grading.
  A turn over turn_timeout_seconds fails the episode for a retry, the
  optional interaction deadline stops the turns and still grades, and a
  failure keeps the completed turns, the tool calls and the agent's
  evidence.
- c-Interact: a question or a submission in each agent reply becomes
  an in-process call. No routes between two servers, and no session
  cookie that reaches every route.
- a-Interact: the nine tools are a TypedToolset of the episode, served
  over direct HTTP, MCP or both (tool_transports), with the signed
  episode token, on any of several workers. The first request declares
  them as strict function tools over direct HTTP, and none over MCP
  alone.
- Each episode starts its database sandbox and registers its stop, so
  the sandbox stops on every path, including shutdown. A command that
  fails for infrastructure reasons runs again on a fresh sandbox; then
  c-Interact fails the episode for a retry and a-Interact masks the
  sample, as does a simulator failure in an a-Interact ask.
- A task without sol_sql, with custom test cases or without its
  database fails at seed, for good.
- The example datasets are declared on the agent, one taskset for each
  mode, and validated by the Environment Server's task_data.py (the
  Harbor layout). gym env test's data and catalog checks still cover
  only Resources Servers (GYMINT-643).

grading.py, simulator.py, task_data.py and the example data come from
#5202 unchanged, apart from module paths and wording.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: Felipe Vieira Frujeri <[email protected]>
ffrujeri added a commit that referenced this pull request Nov 20, 2026
A user-simulation Environment Server activates the agent once for each
turn of the conversation and sends only the new user message. Simple
Agent now accepts a seed that asks for continuation: each activation
runs the turn loop on the session's conversation plus its new input,
and keeps the first activation's tools and instructions.

- An activation without new input, or one that replaces the session's
  tools or instructions, gets 422.
- A retried activation gets its reply without another model call.
- The close returns the trajectory of every activation.
- A continuation seed is refused when partial-rollout checkpoints are
  on, because a checkpoint exports no conversation history.

Carried over from #5202, which prototyped it.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: Felipe Vieira Frujeri <[email protected]>
ffrujeri added a commit that referenced this pull request Nov 20, 2026
…h no Resources Server

BIRD-Interact moves into one Environment Server for each mode, as
approach A of the BIRD-Interact RFC proposes. The server subclasses
BaseEnvironmentServerWithTools directly: its run_episode starts the
database sandbox, serves the a-Interact tools, seeds the agent session,
runs the turns and grades them. The #5202 prototype splits each episode
between an Environment Server and a Resources Server; here the
Environment Server owns the database sandbox, the user simulator, the
grader, the phase and BIRD-COIN rules and the turns.

- The agent session (agent_session.py) is seeded with the episode's
  grants, resumes across c-Interact turns, and is closed before grading.
  A turn over turn_timeout_seconds fails the episode for a retry, the
  optional interaction deadline stops the turns and still grades, and a
  failure keeps the completed turns, the tool calls and the agent's
  evidence.
- c-Interact: a question or a submission in each agent reply becomes
  an in-process call. No routes between two servers, and no session
  cookie that reaches every route.
- a-Interact: the nine tools are a TypedToolset of the episode, served
  over direct HTTP, MCP or both (tool_transports), with the signed
  episode token, on any of several workers. The first request declares
  them as strict function tools over direct HTTP, and none over MCP
  alone.
- Each episode starts its database sandbox and registers its stop, so
  the sandbox stops on every path, including shutdown. A command that
  fails for infrastructure reasons runs again on a fresh sandbox; then
  c-Interact fails the episode for a retry and a-Interact masks the
  sample, as does a simulator failure in an a-Interact ask.
- A task without sol_sql, with custom test cases or without its
  database fails at seed, for good.
- The example datasets are declared on the agent, one taskset for each
  mode, and validated by the Environment Server's task_data.py (the
  Harbor layout). gym env test's data and catalog checks still cover
  only Resources Servers (GYMINT-643).

grading.py, simulator.py, task_data.py and the example data come from
#5202 unchanged, apart from module paths and wording.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: Felipe Vieira Frujeri <[email protected]>
ffrujeri added a commit that referenced this pull request Nov 21, 2026
…h no Resources Server

BIRD-Interact moves into one Environment Server for each mode, as
approach A of the BIRD-Interact RFC proposes. The server subclasses
BaseEnvironmentServerWithTools directly: its run_episode starts the
database sandbox, serves the a-Interact tools, seeds the agent session,
runs the turns and grades them. The #5202 prototype splits each episode
between an Environment Server and a Resources Server; here the
Environment Server owns the database sandbox, the user simulator, the
grader, the phase and BIRD-COIN rules and the turns.

- The agent session (agent_session.py) is seeded with the episode's
  grants, resumes across c-Interact turns, and is closed before grading.
  A turn over turn_timeout_seconds fails the episode for a retry, the
  optional interaction deadline stops the turns and still grades, and a
  failure keeps the completed turns, the tool calls and the agent's
  evidence.
- c-Interact: a question or a submission in each agent reply becomes
  an in-process call. No routes between two servers, and no session
  cookie that reaches every route.
- a-Interact: the nine tools are a TypedToolset of the episode, served
  over direct HTTP, MCP or both (tool_transports), with the signed
  episode token, on any of several workers. The first request declares
  them as strict function tools over direct HTTP, and none over MCP
  alone.
- Each episode starts its database sandbox and registers its stop, so
  the sandbox stops on every path, including shutdown. A command that
  fails for infrastructure reasons runs again on a fresh sandbox; then
  c-Interact fails the episode for a retry and a-Interact masks the
  sample, as does a simulator failure in an a-Interact ask.
- A task without sol_sql, with custom test cases or without its
  database fails at seed, for good.
- The example datasets are declared on the agent, one taskset for each
  mode, and validated by the Environment Server's task_data.py (the
  Harbor layout). gym env test's data and catalog checks still cover
  only Resources Servers (GYMINT-643).

grading.py, simulator.py, task_data.py and the example data come from
#5202 unchanged, apart from module paths and wording.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: Felipe Vieira Frujeri <[email protected]>
ffrujeri added a commit that referenced this pull request Nov 21, 2026
…h no Resources Server

BIRD-Interact moves into one Environment Server for each mode, as
approach A of the BIRD-Interact RFC proposes. The server subclasses
BaseEnvironmentServerWithTools directly: its run_episode starts the
database sandbox, serves the a-Interact tools, seeds the agent session,
runs the turns and grades them. The #5202 prototype splits each episode
between an Environment Server and a Resources Server; here the
Environment Server owns the database sandbox, the user simulator, the
grader, the phase and BIRD-COIN rules and the turns.

- The agent session (agent_session.py) is seeded with the episode's
  grants, resumes across c-Interact turns, and is closed before grading.
  A turn over turn_timeout_seconds fails the episode for a retry, the
  optional interaction deadline stops the turns and still grades, and a
  failure keeps the completed turns, the tool calls and the agent's
  evidence.
- c-Interact: a question or a submission in each agent reply becomes
  an in-process call. No routes between two servers, and no session
  cookie that reaches every route.
- a-Interact: the nine tools are a TypedToolset of the episode, served
  over direct HTTP, MCP or both (tool_transports), with the signed
  episode token, on any of several workers. The first request declares
  them as strict function tools over direct HTTP, and none over MCP
  alone.
- Each episode starts its database sandbox and registers its stop, so
  the sandbox stops on every path, including shutdown. A command that
  fails for infrastructure reasons runs again on a fresh sandbox; then
  c-Interact fails the episode for a retry and a-Interact masks the
  sample, as does a simulator failure in an a-Interact ask.
- A task without sol_sql, with custom test cases or without its
  database fails at seed, for good.
- The example datasets are declared on the agent, one taskset for each
  mode, and validated by the Environment Server's task_data.py (the
  Harbor layout). gym env test's data and catalog checks still cover
  only Resources Servers (GYMINT-643).

grading.py, simulator.py, task_data.py and the example data come from
#5202 unchanged, apart from module paths and wording.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: Felipe Vieira Frujeri <[email protected]>
ffrujeri added a commit that referenced this pull request Nov 23, 2026
A user-simulation Environment Server activates the agent once for each
turn of the conversation and sends only the new user message. Simple
Agent now accepts a seed that asks for continuation: each activation
runs the turn loop on the session's conversation plus its new input,
and keeps the first activation's tools and instructions.

- An activation without new input, or one that replaces the session's
  tools or instructions, gets 422.
- A retried activation gets its reply without another model call.
- The close returns the trajectory of every activation.
- A continuation seed is refused when partial-rollout checkpoints are
  on, because a checkpoint exports no conversation history.

Carried over from #5202, which prototyped it.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: Felipe Vieira Frujeri <[email protected]>
ffrujeri added a commit that referenced this pull request Nov 23, 2026
…h no Resources Server

BIRD-Interact moves into one Environment Server for each mode, as
approach A of the BIRD-Interact RFC proposes. The server subclasses
BaseEnvironmentServerWithTools directly: its run_episode starts the
database sandbox, serves the a-Interact tools, seeds the agent session,
runs the turns and grades them. The #5202 prototype splits each episode
between an Environment Server and a Resources Server; here the
Environment Server owns the database sandbox, the user simulator, the
grader, the phase and BIRD-COIN rules and the turns.

- The agent session (agent_session.py) is seeded with the episode's
  grants, resumes across c-Interact turns, and is closed before grading.
  A turn over turn_timeout_seconds fails the episode for a retry, the
  optional interaction deadline stops the turns and still grades, and a
  failure keeps the completed turns, the tool calls and the agent's
  evidence.
- c-Interact: a question or a submission in each agent reply becomes
  an in-process call. No routes between two servers, and no session
  cookie that reaches every route.
- a-Interact: the nine tools are a TypedToolset of the episode, served
  over direct HTTP, MCP or both (tool_transports), with the signed
  episode token, on any of several workers. The first request declares
  them as strict function tools over direct HTTP, and none over MCP
  alone.
- Each episode starts its database sandbox and registers its stop, so
  the sandbox stops on every path, including shutdown. A command that
  fails for infrastructure reasons runs again on a fresh sandbox; then
  c-Interact fails the episode for a retry and a-Interact masks the
  sample, as does a simulator failure in an a-Interact ask.
- A task without sol_sql, with custom test cases or without its
  database fails at seed, for good.
- The example datasets are declared on the agent, one taskset for each
  mode, and validated by the Environment Server's task_data.py (the
  Harbor layout). gym env test's data and catalog checks still cover
  only Resources Servers (GYMINT-643).

grading.py, simulator.py, task_data.py and the example data come from
#5202 unchanged, apart from module paths and wording.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: Felipe Vieira Frujeri <[email protected]>
MichielMAnalytics pushed a commit to MichielMAnalytics/Gym that referenced this pull request Nov 23, 2026
…DIA-NeMo#5465)

* feat(simple_agent): continue an agent session across activations

A user-simulation Environment Server activates the agent once for each
turn of the conversation and sends only the new user message. Simple
Agent now accepts a seed that asks for continuation: each activation
runs the turn loop on the session's conversation plus its new input,
and keeps the first activation's tools and instructions.

- An activation without new input, or one that replaces the session's
  tools or instructions, gets 422.
- A retried activation gets its reply without another model call.
- The close returns the trajectory of every activation.
- A continuation seed is refused when partial-rollout checkpoints are
  on, because a checkpoint exports no conversation history.

Carried over from NVIDIA-NeMo#5202, which prototyped it.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: Felipe Vieira Frujeri <[email protected]>

* fix(simple_agent): make continuation sessions checkpoint-safe, observable and explicit

Review fixes for simple_agent's continuation sessions:

- Checkpointing: a continuation seed is accepted, and its reply carries
  CHECKPOINT_RESTART_HEADER, because a checkpoint does not export the
  conversation; the episode starts over after a restore. A session
  restored without its conversation refuses its next activation (409).
- Opt-in: only a class that sets continuation_supported in its own body
  supports continuation, so DeepAgentsAgent, which replaces responses(),
  refuses a continuation seed again.
- Settings: a later activation that changes any setting of the first
  (tool_choice, temperature, ...), not only tools or instructions, gets
  422 instead of having it silently dropped.
- Observations: a continuation session always collects the trajectory and
  timing its seed confirms, also without observability_enabled. A failed
  or cancelled activation adds a failed or incomplete invocation and an
  agent_activation_interrupted gap before it re-raises. Turns carry their
  activation_id. Each invocation keeps only its activation's new input
  and output, so the close payload grows linearly.
- Model server: the session keeps the model server's cookies across
  activations, so it stays on one model-server session.
- A test checks that a later activation resends the earlier turns' token
  IDs and log probabilities.

max_steps still bounds each activation, as it bounds one /v1/responses
call; the Environment Server bounds the activations.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: Felipe Vieira Frujeri <[email protected]>

* fix(simple_agent): mark a continuation seed as a restart through the base hook

Main checks that no agent overrides seed_agent_session. Simple Agent now
implements the base agent's _seed_restarts hook instead: under
checkpointing, a checkpoint does not export a continuation session's
conversation, so the seed reply marks the episode as a restart.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: Felipe Vieira Frujeri <[email protected]>

* feat(environment): let a tool reply end the agent's activation

A protocol whose turn ends at a submission, such as the BIRD-Interact ADK's
c-Interact, must end the agent's activation without another model call. The
ADK does it in a before-model callback; a Gym Environment Server sees only
the tool calls, so it signals it on the reply.

ToolResult.ends_activation sets X-NeMo-Gym-End-Activation: true on the direct
HTTP reply. simple_agent runs the rest of the model response's tool calls and
returns the activation without calling the model again. MCP has no field for
it, so an MCP agent calls the model again.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: Felipe Vieira Frujeri <[email protected]>

* fix(simple_agent): raise AgentSessionConflictError when a restored continuation lost its conversation

Main now requires every 409 session refusal in an agent to raise AgentSessionConflictError
(NVIDIA-NeMo#5691, enforced by tests/unit_tests/test_session_contract_repo.py). The continuation session's
refusal after a restore raised a plain HTTPException(409); it keeps the same status and detail.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: Felipe Vieira Frujeri <[email protected]>

* fix(simple_agent): run continuation activations through the session hook, and document continuation

A continuation activation called _create_episode directly, so a subclass whose
task context lives in its session state (_create_session_episode) lost it from
the first activation on. It now goes through the hook, as an activation
without continuation does.

The comment on the trajectory said the close payload grows linearly; each
turn's question still holds the model-visible prefix, as in one activation.
The continuation test now checks each activation's model route and metadata.
integrate-existing-agents.mdx describes simple_agent's continuation, and
multi-step-tasks.mdx says which harness can continue in a lent sandbox.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: Felipe Vieira Frujeri <[email protected]>

* test(agent): run a Simple Agent continuation session from an Environment Server in the core suite

Core coverage measures responses_api_agents/simple_agent/app.py, because core tests import it, but counts only
core tests. The continuation code this PR adds is tested in the server's own suite, so core coverage fell to
94.95%, under the 95% gate. These tests drive a real Simple Agent session from a BaseEnvironmentServerWithTools
episode: a tool that ends the activation ends the turn, the next activation continues the conversation, a failed
activation stays in the trajectory, and an activation the session cannot run gets a 422 before any model call.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: Felipe Vieira Frujeri <[email protected]>

* fix(agent): apply the third review round on Simple Agent continuation

- A tool result that is not JSON becomes a 500 error that no longer ends the activation, so the agent shows the
  model the error.
- The end-activation docstrings and the MCP tutorial say that only simple_agent honors the header.
- With execute_tools on, a function call cut off before its tools ran is not sent to the next activation.
- Comments say what a failed activation keeps and that each turn's question keeps the whole prefix; the docs say
  close returns every activation's trajectory and use "borrowed sandbox".
- Tests: close during an activation (incomplete, CancelledError), an activation without new input, the model
  server's cookie between activations, tool cookies and evidence across activations, the cut-off call.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: Felipe Vieira Frujeri <[email protected]>

---------

Signed-off-by: Felipe Vieira Frujeri <[email protected]>
Co-authored-by: Claude Opus 5.5 <[email protected]>
MichielMAnalytics pushed a commit to MichielMAnalytics/Gym that referenced this pull request Nov 23, 2026
…h no Resources Server (NVIDIA-NeMo#5409)

* feat(bird_interact): run BIRD-Interact in its Environment Server, with no Resources Server

BIRD-Interact moves into one Environment Server for each mode, as
approach A of the BIRD-Interact RFC proposes. The server subclasses
BaseEnvironmentServerWithTools directly: its run_episode starts the
database sandbox, serves the a-Interact tools, seeds the agent session,
runs the turns and grades them. The NVIDIA-NeMo#5202 prototype splits each episode
between an Environment Server and a Resources Server; here the
Environment Server owns the database sandbox, the user simulator, the
grader, the phase and BIRD-COIN rules and the turns.

- The agent session (agent_session.py) is seeded with the episode's
  grants, resumes across c-Interact turns, and is closed before grading.
  A turn over turn_timeout_seconds fails the episode for a retry, the
  optional interaction deadline stops the turns and still grades, and a
  failure keeps the completed turns, the tool calls and the agent's
  evidence.
- c-Interact: a question or a submission in each agent reply becomes
  an in-process call. No routes between two servers, and no session
  cookie that reaches every route.
- a-Interact: the nine tools are a TypedToolset of the episode, served
  over direct HTTP, MCP or both (tool_transports), with the signed
  episode token, on any of several workers. The first request declares
  them as strict function tools over direct HTTP, and none over MCP
  alone.
- Each episode starts its database sandbox and registers its stop, so
  the sandbox stops on every path, including shutdown. A command that
  fails for infrastructure reasons runs again on a fresh sandbox; then
  c-Interact fails the episode for a retry and a-Interact masks the
  sample, as does a simulator failure in an a-Interact ask.
- A task without sol_sql, with custom test cases or without its
  database fails at seed, for good.
- The example datasets are declared on the agent, one taskset for each
  mode, and validated by the Environment Server's task_data.py (the
  Harbor layout). gym env test's data and catalog checks still cover
  only Resources Servers (GYMINT-643).

grading.py, simulator.py, task_data.py and the example data come from
NVIDIA-NeMo#5202 unchanged, apart from module paths and wording.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: Felipe Vieira Frujeri <[email protected]>

* refactor(bird_interact): start the database sandbox with start_episode_sandbox

BaseEnvironmentServerWithTools now requires sandbox_provider and starts
an episode's sandboxes with start_episode_sandbox, so BIRD-Interact
inherits the field and uses the helper. Each sandbox, including a fresh
one for a retried command, has its stop registered in the episode's
cleanup before it starts. Before, the one cleanup was registered after
the first sandbox started, and a stale sandbox whose stop failed was
left to the provider's ttl_s.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: Felipe Vieira Frujeri <[email protected]>

* fix(bird_interact): honor the token-capture opt-out and keep the follow-up after a budget-spending pass

- A request with skip_token_capture keeps its agent turns off the training
  capture route, as the episode request contract says.
- In a-Interact, a passing submission that spends the last coin no longer
  ends the task: only a submission that did not pass does, so the follow-up
  stays reachable.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: Felipe Vieira Frujeri <[email protected]>

* fix(bird_interact): fail the episode at the agent stage when a turn's call times out

A TimeoutError before the turn's deadline was re-raised as it was, on the
premise that an outer deadline also raises one there. An outer deadline
reaches the await as a cancellation, so that error is the call's own, such as
aiohttp's socket or connection timeout. Unmapped, it became a terminal
unhandled failure that lost the turns and the agent's evidence. It is now the
agent's failure, which the episode retries.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: Felipe Vieira Frujeri <[email protected]>

* fix(bird_interact): start no sandbox once the episode ends; name the turn bound activation_timeout_seconds

- `run` marks the episode as ending before the base class runs its cleanup, and `_replace_sandbox` then refuses. A
  replacement started during the cleanup would never be stopped, because the cleanup runs its entries in reverse.
- `turn_timeout_seconds` becomes `activation_timeout_seconds`, the name `swe_together` uses for the same bound.
- The c-Interact example config sets `interaction_timeout_seconds: 3000`, so a slow agent's turns stop and are graded
  before the episode deadline fails the episode.
- The agent timeout goes in `AGENT_TIMEOUT_METADATA_KEY` from `nemo_gym.agents`, not a copy of its string.
- Tests: no sandbox is left after a replacement; an ending episode starts no replacement; the two-episode test waits
  on a barrier, not a fixed sleep.
- README: OpenCode, Kilo and OpenClaw accept required MCP grants in their own sandbox; `grading.py` needs Python 3.10;
  a client error from the user model fails the episode for good; the MCP rule is stated for any harness; no internal
  tracker key.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: Felipe Vieira Frujeri <[email protected]>

* build(bird_interact): relock after the rebase onto main

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: Felipe Vieira Frujeri <[email protected]>

---------

Signed-off-by: Felipe Vieira Frujeri <[email protected]>
Co-authored-by: Claude Opus 5.5 <[email protected]>

This branch was previously deployed

1 inactive deployment
public — c71b12c4 Deployed Oct 30, 2026 by copy-pr-bot[bot] via release / finalize / notify #8578
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area:environment Individual environments, benchmarks, verifiers, and environment-specific resources servers feature New capabilities, enhancements, or enablement work

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants