Skip to content

feat(bird_interact): match the BIRD-Interact ADK's c-Interact, simulator and grading - #5478

Merged
ffrujeri merged 5 commits into
ffrujeri/bird-interact-benchmarkfrom
ffrujeri/bird-interact-adk-parity
Nov 23, 2026
Merged

ffrujeri merged 5 commits into
ffrujeri/bird-interact-benchmarkfrom
ffrujeri/bird-interact-adk-parity

Conversation

@ffrujeri

@ffrujeri ffrujeri commented Nov 3, 2026 •

Copy link
Copy Markdown
Contributor

Merges only together with #5534. #5534 fixes the five risks from the earlier automated review on this code (a failed phase-1 apply, a destructive submission breaking the solution, the command deadline, an unmasked tool timeout, the SQLite dialect swap). Once #5534 is approved, the stack merges from the top, so this branch holds #5534's server before it reaches main.

Stacked on #5475 (the Lite and Full recipe), in the BIRD-Interact stack: #5465 → #5409 → #5473 → #5475 → this PR. The diff against #5475 is the bird_interact Environment Server, the recipe's prepare.py and README, and ATTRIBUTIONS.md.

What changed

auto-ontology-eval runs BIRD-Interact's Lite and Full query tasks in c-Interact on the BIRD-Interact ADK: its orchestrator, its user simulator and its grader. This PR brings the bird_interact Environment Server to parity with what it uses, at ADK revision 451fe2c3518ee1cf908d8139e2913483bd519381.

ADK Gym, after this PR
orchestrator/cinteract.py: max_turn, the phase-1, debug and follow-up messages, two runs for each phase app.py: _first_request, _next_message
system_agent/agent.py, tools.py, callbacks_cinteract.py: the instruction, ask_user and submit_sql, one submission for each run app.py: CInteractTools
db_environment/server.py: the grader's messages, rewards by submission count, the phase-1 snapshot, the knowledge the agent sees app.py: submit; grading.py
shared/db_utils.py: test_case_default and its rewrites grading.py
user_simulator/: the two stages, the v2 prompts, the clause split (sqlglot) simulator.py
  • c-Interact is the ADK's protocol. The agent gets the two tools, served over direct_http or mcp. The server sends the ADK's instruction and phase-1 message, then opens each later turn as the orchestrator does: the debug message after a failed phase (with the SQL error when the submission did not run), the follow-up question after phase 1 passes. A turn ends at its submission, with no further model call, as the ADK's before_model_callback ends its run: submit_sql's reply ends the agent's activation (ToolResult.ends_activation, from feat(simple_agent): continue an agent session across activations #5465), and another call in the same model response is not run: it gets the text the ADK's callback puts in place of the model's next reply. The ADK runs every call of a response, so this is a second deliberate difference, listed in the README. Rewards follow the phase's submissions, as in the ADK. This replaces feat(bird_interact): run BIRD-Interact in its Environment Server, with no Resources Server #5409's conversational c-Interact, where the agent's reply text was parsed for SQL. max_turns is gone: the protocol fixes the turns.
  • The user simulator is the ADK's. Its v2 prompts, the action parser and the response generator at temperature 0 with its output limits, the ambiguity JSON as the row writes it, the solution split into clauses with sqlglot, and phase 2's prompts. The one deliberate difference: the ADK fills its placeholders one after another, so an agent's question containing [[GT_SQL]] would get the solution SQL written into the simulator's prompt; Gym fills them in one pass.
  • Grading is the ADK's default test case. The submission as written (its executability), then the submission and the solution with the ADK's comment, DISTINCT and ROUND rewrites, in that order on one database state, rolled back; each query keeps its last statement's rows, at most 10,000. Edge cases are kept for parity, such as an array of decimals failing because it cannot be written as JSON. A PostgreSQL query is sent whole, so dollar-quoted bodies work. Phase 1's passing SQL is applied for phase 2, and replayed when a sandbox is replaced. sql_timeout_seconds defaults to the ADK's 60.
  • The category rule. A query phase is graded by its result even when it has test cases; only a phase of another category with test cases (the management tasks) is refused at seed, and prepare.py leaves it out. Every query task's follow-up is a query, so all 195 Lite and 410 Full query tasks run.
  • Simulator model. Still user_model (user_model_name in env.yaml). The READMEs say that the ADK default, which auto-ontology-eval uses, is anthropic/claude-haiku-4-5-20251001.

Why

auto-ontology-eval's BIRD-Interact results come from the ADK. With the same protocol, simulator and grading, its runs can move to Gym without a change in what is measured. No public issue: the PRs of the BIRD-Interact stack track the work.

Code provenance

environment_servers/bird_interact/adk_prompts.py holds texts copied verbatim from the BIRD-Interact ADK, revision 451fe2c3518ee1cf908d8139e2913483bd519381, under the MIT license (Copyright (c) 2025 BIRD-Interact Authors), whose notice the file's header reproduces:

Upstream file Copied into adk_prompts.py
BIRD-Interact-ADK/user_simulator/prompts.py v2_action_parser, v2_response_generator
BIRD-Interact-ADK/user_simulator/server.py the fallback reply
BIRD-Interact-ADK/system_agent/agent.py CINTERACT_INSTRUCTION
BIRD-Interact-ADK/system_agent/tools.py the ask_user and submit_sql docstrings, the submission reply's lines
BIRD-Interact-ADK/system_agent/callbacks_cinteract.py the clarification note, the replies after a submission
BIRD-Interact-ADK/orchestrator/cinteract.py the phase-1, debug and follow-up messages
BIRD-Interact-ADK/db_environment/server.py the grader's messages, the visible knowledge fields

The texts are byte-for-byte; the ADK's f-strings are str.format templates. ATTRIBUTIONS.md records the component. The code that uses them (protocol, simulator pipeline, grading) is an independent implementation.

Validation

Check Result
pytest environment_servers/bird_interact/tests (server venv) 64 passed, 4 skipped: the real-PostgreSQL class, which needs initdb on the host (run in the image instead, below)
pytest tests/unit_tests/benchmarks/test_bird_interact_prepare.py Passed, including the category rule
Grading parity: the ADK's own test_case_default and submit flow against grading.py, in the Lite image 863 of 863 submissions got the same verdict, on six Lite databases (544 passed, 247 not correct, 72 execution errors): DISTINCT and ROUND rewrites, comments, ordering, decimals, dates, JSON, numeric and date arrays, multi-statement and writing submissions
grading.py in the Lite image setup with replayed SQL, dollar-quoted bodies, apply on pass, timeouts and a broken solution, on real PostgreSQL
Mutation check Dropping the replay of phase 1's SQL on a fresh sandbox fails test_phase_2_sees_what_phase_1_changed_even_on_a_fresh_sandbox
tests/unit_tests (benchmark, manifest, import, sandbox and Environment Server selections) 21 failures in test_opensandbox_compose.py, test_sandbox_transfer.py, test_sandbox_stop_retry.py, test_harbor_validation.py and test_benchmarks.py, the same with and without this PR's changes on this machine
pytest environment_servers/bird_interact/tests (after ending the turn at the submission) 64 passed, 4 skipped; submit_sql's replies carry X-NeMo-Gym-End-Activation: true and a question's does not. It fails without the change
pre-commit run --files on the changed files Passed

Not validated in this PR alone: runs with the real ground truth, the Full image and a Full run. They ran at the top of the stack, with the Auto Ontology agent (#6489).

Rollout evidence

All on Docker sandboxes, with simple_agent; policy azure/openai/eccn-gpt-6.1-sol, simulator openai/openai/eccn-gpt-6-luna:

  • The server's five example tasks (SQLite), both modes: 10 of 10 completed, mean reward 0.82. c-Interact took each path but phase 2's debug turn: questions with the clarification note, a failed submission and its debug turn passing for 0.5, the follow-up as phase 2.
  • Ending the turn at the submission, the same five tasks before and after (rebased onto main): before, every c-Interact turn made one model call after submit_sql, 8 over 8 turns, which the ADK does not make. After, none: model calls per turn went from [3], [7, 2], [4, 2], [6, 2], [5] to [2], [5], [3, 1], [5, 1], [4]. 10 of 10 completed; c-Interact mean 0.82 and a-Interact 0.68, a-Interact being unaffected by the change (5 tasks, run-to-run variation). This run replaces data/example_rollouts.jsonl.
  • Lite through the recipe (PostgreSQL, the image from feat(benchmarks): add the BIRD-Interact Lite and Full benchmark recipe #5475), three tasks with a stand-in ground truth written from their clear questions and the real schema, because the real one is not in hand. This checks the image, the protocol and the grading on Lite; its rewards are not results. c-Interact: solar_10 passed both phases (1.0); solar_3 passed phase 1, failed phase 2 and its debug turn (0.7); crypto_2 failed phase 1 and its debug turn (0.0). A second submit_sql in one turn got the ADK's "SQL submitted. Awaiting result." a-Interact: 3 of 3 completed, mean 0.9.

One simulator reply in the example run was the action itself (unlabeled("JOIN")): the simulator model continued the ADK's prompt, which ends in an open <s>, with the action. The ADK reads it the same way.

Compatibility

Within the unmerged stack: c-Interact's protocol, stop reasons and grading change, so c-Interact scores from #5409's server are not comparable with these. max_turns is removed from the server's config. c-Interact now needs a harness that resumes its session and takes tool grants: simple_agent does, and OpenCode can over mcp, in its own sandbox. a-Interact keeps its tools and budget, but its grading changes too: the submission runs as written first, results are capped at 10,000 rows, a passing phase 1 is applied before phase 2, and submit replies with the grader's messages. So a-Interact scores from #5409's server are not comparable with these either. New dependency for the server: sqlglot==30.20.0.

Team review fixes (2026-11-19)

From a team review: 485e642bf8 adds tests/test_grading.py, whose tests fail when grade drops one of the ADK's rules (running the submission as written first, the ROUND and DISTINCT rewrites, the 10,000-row cap); b6713a9 says, in the README and CInteractTools, that a call after submit_sql in the same response is not run, unlike in the ADK. The review recommends landing this PR with #5534, which fixes the Codex risks on this code.

Review fixes (2026-11-20)

From the second review, in c68cc29:

  • The ADK parity section lists every difference a comparison with the ADK's scores should know: a failed simulator or grader masks the sample, the agent's request (the ADK's identity line, the tools' descriptions and strict), tool results as text, the history after a submission, an empty submission's message.
  • For scores comparable with the ADK's, the READMEs say to run the policy at temperature 0 with at most 4096 output tokens, set on the policy's Model Server (sampling_overrides), since the server writes the agent's requests.
  • auto-ontology-eval is public, and the READMEs link it; the episode's budget fields say which mode owns each.
  • The interaction-deadline test's first turn is a text reply, so no grade runs inside its 0.5-second deadline (20 of 20 runs passed).

Fixed where the code is final, in #5534 (ecf859f): a submit_sql that cannot be graded ends the activation; execute reports a capped result as 10000+ rows; tests for the rules that had none. pytest environment_servers/bird_interact/tests at this PR's fix commit: 73 passed, 4 skipped.

@ffrujeri ffrujeri added feature New capabilities, enhancements, or enablement work area:environment Individual environments, benchmarks, verifiers, and environment-specific resources servers labels Nov 3, 2026
@copy-pr-bot

copy-pr-bot Bot commented Nov 3, 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.

@ffrujeri
ffrujeri added this pull request to stack #5470 November 3, 2026 03:58
@ffrujeri

ffrujeri commented Nov 3, 2026

Copy link
Copy Markdown
Contributor Author

/ok to test cb77043

@ffrujeri

ffrujeri commented Nov 4, 2026

Copy link
Copy Markdown
Contributor Author

/ok to test 478d3bc

@ffrujeri

ffrujeri commented Nov 6, 2026

Copy link
Copy Markdown
Contributor Author

/ok to test 33211b2

@ffrujeri

Copy link
Copy Markdown
Contributor Author

/ok to test 3cec9bf

@ffrujeri

Copy link
Copy Markdown
Contributor Author

/ok to test 91c3b35

@svcnvidia-nemo-ci svcnvidia-nemo-ci left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

SHIP WITH CARE

I found five correctness and reliability risks, plus a validation gap. The inline findings cover phase-state application, failure attribution, timeout handling and prompt preservation.

RISK: Provide the benchmark reward-profile comparison required for this verifier change. The recipe is a fixed evaluation benchmark, but its results section still has no Lite or Full results. The reported 863-submission ADK comparison checks grading parity, and the synthetic rollouts provide smoke evidence. Neither shows how the combined grading and simulator changes affect the benchmark's reward distribution relative to the base implementation. Could you provide before/after reward profiles on the same official query tasks, with the policy and simulator settings recorded, including mean reward, reward distribution and explanations for intentional shifts? Keep the existing grading-parity and real smoke evidence. Acceptance is a reproducible comparison that accounts for changed rewards, not unchanged scores where the protocol deliberately changed. I have not run that comparison.

I inspected every changed file and traced the affected tool/session and grading/retry contracts. This was a static review; I did not execute tests or independently reproduce the reported parity run. The file reader truncated long rollout lines, so I could inspect their visible inputs and rewards but not every trajectory item. I inspected grading and simulator/data integration directly because two delegated reports were unavailable.


Inline comments (escaped v1):

  • environment_servers/bird_interact/grading.py line 342: RISK: Check that phase 1 was applied before reporting a pass.

    If comparison succeeds but the subsequent commit=True call returns a failed QueryResult, this branch discards the failure and returns passed=True. For example, inject QueryResult(rows=None, error="database is locked") for that application call after successful comparison. The caller then awards phase 1 and opens phase 2 even though the live database lacks its changes. Sandbox replacement may later replay those changes, so grading can also depend on whether a retry occurred.

    Could you make failed application a command failure, so the existing fresh-sandbox retry and masking paths handle the inconclusive state? Replace this call with:

    (applied,) = database.run([predicted_sql], timeout_seconds=timeout_seconds, commit=True)
    if not applied.ok:
        raise RuntimeError(f"Applying phase 1 SQL failed: {applied.error}")

    The invariant is that a returned phase-1 pass with a follow-up means its SQL was successfully applied. Keep ordinary comparison failures as agent outcomes, and keep grading without apply_if_passed non-persistent.

    Proposed acceptance: inject an application error after a passing comparison and assert that no passing grade is returned; through the server, expect fresh-sandbox retry or SANDBOX_FAILED masking after retries are exhausted. Retain the persistence test's assertions that ordinary grading creates no note table and successful application does. Retain the phase-2 replay test's total reward of 1.0. These checks are proposed, not executed.

  • environment_servers/bird_interact/grading.py line 330: RISK: Distinguish a broken solution from a submission that broke its database state.

    The solution now runs after both versions of the submission on the same state. On the example SQLite database, submit DROP TABLE IF EXISTS authors; SELECT 1 against CORRECT_1. Both submission executions succeed, then the solution fails because authors was dropped. This branch reports broken ground truth, and the episode permanently fails verification, instead of grading the destructive submission as wrong and allowing its debug turn. The base implementation ran the solution on an independent copy, so this attribution error is introduced by the shared-state change.

    Could you confirm the solution fails on clean episode state before classifying it as bad task data? At this branch, the first database.run has already rolled back or discarded its scratch copy, so a small correction is:

    if not results[-1].ok:
        baseline = database.run(solution, timeout_seconds=timeout_seconds)
        if not baseline[-1].ok:
            raise SolutionFailedError(f"The ground-truth SQL failed: {baseline[-1].error}")
        return Grade(passed=False)

    Keep the intended raw-submission, normalized-submission and solution order for normal grading. Do not move every solution execution onto separate state, which would undo the stated parity behavior.

    Proposed acceptance: the destructive submission above returns a failed grade without SolutionFailedError, leaves the original database intact, and gets a c-Interact debug turn. A genuinely invalid solution such as SELECT missing_column FROM sales must still produce the terminal verification failure asserted by the existing regression. Keep the existing once-only versus idempotent-write comparison cases. This patch is source reasoning, not an executed result.

  • environment_servers/bird_interact/app.py line 967: RISK: The sandbox deadline still budgets only two query executions.

    Grading now runs the raw submission, normalized submission and solution, then runs the submission again when applying a passing phase 1. This unchanged deadline is still 2 * sql_timeout_seconds + 60. With the default 60-second SQL limit, a phase-1 submission and matching solution consisting of SELECT pg_sleep(50), 1 need about 200 seconds across those four executions, although each statement is within its allowed limit. The command is killed at 180 seconds, retried, then masked as a sandbox failure instead of completing grading.

    Could you align the command deadline with the work the grader permits? Account for the application execution and multiple solution scripts as well as the comparison stages. Multiplying by four alone is insufficient because a PostgreSQL script can contain several separately timed statements. The exact implementation needs an explicit total-grading budget or a reliable bound derived from the permitted work; whichever approach you choose, valid per-statement execution must not unexpectedly become an infrastructure failure.

    Proposed acceptance: use a controlled database/command fixture where all four stages finish below their individual SQL limits but exceed the old aggregate deadline, and assert grading completes without sandbox replacement or masking. Cover multiple solution scripts too. Keep the real-PostgreSQL assertion that a statement exceeding sql_timeout_seconds is reported as timed_out, and retain bounded command-failure retries. I did not execute these timing checks.

  • environment_servers/bird_interact/app.py line 408: RISK: A per-tool timeout can become an unmasked c-Interact failure.

    Set tool_call_timeout_seconds below the duration of ask_user or submit_sql. The shared runner cancels this await and returns HTTP 504. Cancellation bypasses this toolset's except Exception and except SandboxCommandError handlers, so failure_kind stays unset. If the agent returns normally after the 504, _next_message opens a debug turn and can finish with an unmasked zero reward even though simulation or verification never completed. For submission, submitted_this_turn also stays true, so another call gets SQL submitted. Awaiting result. despite grading being interrupted.

    Could you propagate the per-tool deadline outcome into the episode's failure state before it becomes a 504? An interrupted simulator call should reach USER_SIMULATOR_FAILED; interrupted grading should reach SANDBOX_FAILED, so the existing stop/mask path applies. The timeout owner is in the shared runner, so the implementation must distinguish its deadline from caller or episode cancellation. Do not blanket-swallow cancellation or change the outer turn-timeout policy.

    Proposed acceptance: configure a short per-tool timeout, delay simulate, and have the scripted agent return normally after the 504. Expect mask_sample=true, stop_reason=USER_SIMULATOR_FAILED and no debug activation. Repeat with delayed grading and expect SANDBOX_FAILED. Retain ordinary wrong-SQL debug behavior, successful submission's X-NeMo-Gym-End-Activation: true, and the retryable agent-stage failure for exceeding turn_timeout_seconds. These are proposed tests, not executed results.

  • environment_servers/bird_interact/app.py line 744: RISK: Translate the fixed instructions before inserting task data.

    in_dialect replaces every PostgreSQL occurrence, but here it receives the fully rendered instruction and question. A valid SQLite task asking to find rows whose stored value is 'PostgreSQL' is shown to the agent as asking for 'SQLite', while its solution still filters for 'PostgreSQL'. Schema identifiers and knowledge definitions containing that text are changed too. The follow-up branch has the same problem.

    Could you apply dialect substitution only to the fixed templates? In _first_request, format self.in_dialect(C_INTERACT_INSTRUCTION) and self.in_dialect(PHASE_1_MESSAGE), then remove the post-format substitution at this line. In _next_message, use:

    return self.in_dialect(FOLLOW_UP_MESSAGE).format(follow_up_query=episode.task.follow_up.query)

    This keeps the intended SQLite wording in the instructions and tool descriptions without rewriting the task, schema or knowledge. PostgreSQL mode must remain unchanged.

    Proposed acceptance: create a SQLite table containing distinct 'PostgreSQL' and 'SQLite' values, with both phase questions explicitly requesting 'PostgreSQL'. Assert both rendered questions retain that literal and their correct submissions pass; include a schema identifier or knowledge definition containing PostgreSQL and assert it stays intact. Retain the existing first-request assertions for great SQLite writing ability and final SQLite query, plus PostgreSQL-mode wording. I have not executed these checks.

Review generated by codex. This was a full review. Request a full review with /review reset=true.

@ffrujeri

Copy link
Copy Markdown
Contributor Author

/ok to test ce77ac7

@ffrujeri

Copy link
Copy Markdown
Contributor Author

Answers to the review's findings. grade(), the runner and the c-Interact tools change again in #5534, so the fixes are in 42448ce5.

  • Check that phase 1 was applied. Fixed: a failed application raises, so the command fails and runs again on a fresh sandbox, as you suggest (the same SQL just ran on the same state). The test-case path returns a failed grade instead, since its test cases ran on a copy under another name.
  • A submission that broke its database state. Fixed, keeping the shared-state order: when the solution fails after the submission, it runs again on the episode's database; only if it fails there too is it bad task data. Your DROP TABLE ...; SELECT 1 example is now graded wrong, as the ADK grades it, with a debug turn.
  • The sandbox deadline. Fixed: the command now has time for every script the grader may run: the submission twice, each solution script (twice, for the recheck) and the application of phase 1; for test cases, the submission, two queries for each test case and the application. Each script also has one deadline now, however many statements it holds.
  • A per-tool timeout leaves the sample unmasked. Fixed: a simulator or sandbox call cut off by its deadline marks the episode user_simulator_failed or sandbox_failed, in both modes, so the sample is masked and no debug turn opens. Tests stall each one past tool_call_timeout_seconds.
  • The dialect rewrites task text. Fixed: only the ADK's templates are rewritten, before the task, schema and knowledge go in. A test asks about 'PostgreSQL' and checks that it reaches the agent unchanged.
  • Reward profile before and after. Not possible yet: the official query tasks need the ground truth, which the authors send on request (GYMINT-592). The comparison with the ADK on real ground truth is GYMINT-682. Current runs on the example tasks and on Lite with a stand-in ground truth are in feat(bird_interact): run BIRD-Interact in its Environment Server, with no Resources Server #5409's and feat(benchmarks): add the BIRD-Interact Lite and Full benchmark recipe #5475's comments.

@ffrujeri

Copy link
Copy Markdown
Contributor Author

/ok to test de55777

@ffrujeri

Copy link
Copy Markdown
Contributor Author

/ok to test 0fe108b

@ffrujeri

Copy link
Copy Markdown
Contributor Author

/ok to test 26c5042

@ffrujeri

Copy link
Copy Markdown
Contributor Author

/ok to test b6713a9

@ffrujeri

Copy link
Copy Markdown
Contributor Author

/ok to test 01cdd59

@ffrujeri

Copy link
Copy Markdown
Contributor Author

/ok to test 3706899

@ananthsub

Copy link
Copy Markdown
Contributor

This PR should land together with #5534. At this head, the five risks from the earlier automated review still apply:

  • a failed phase-1 apply still counts as a pass;
  • a solution that fails after a destructive submission is treated as broken task data;
  • the sandbox command deadline is shorter than the grades this PR runs;
  • a tool timeout leaves the sample unmasked;
  • the SQLite dialect swap rewrites task text.

Their fixes are in #5534 (63b6bb3), so merging this PR on its own ships all five. The flaky interaction-deadline test in the inline comments is not fixed there.

Two corrections to the description:

  • The Validation table names benchmarks/bird_interact/tests, which does not exist. The recipe's tests are in tests/unit_tests/benchmarks/test_bird_interact_prepare.py.
  • The Compatibility section says a-Interact keeps its tools and budget. The grading rewrite applies to a-Interact too: the submission runs as written first, results are capped at 10,000 rows, and a passing phase 1 is applied before phase 2. So a-Interact scores from feat(bird_interact): run BIRD-Interact in its Environment Server, with no Resources Server #5409's server are not comparable with these either.

@ffrujeri

Copy link
Copy Markdown
Contributor Author

/ok to test c68cc29

@ffrujeri

Copy link
Copy Markdown
Contributor Author

Agreed: this PR lands together with #5534. The stack merges from the top, so this branch holds #5534's server, with the five fixes, before it reaches main. The description now says so at the top.

The flaky interaction-deadline test is fixed here, in c68cc29f, with your suggestion. The other inline points are answered in their threads.

Description corrections:

ananthsub
ananthsub previously approved these changes Nov 20, 2026
@ffrujeri

Copy link
Copy Markdown
Contributor Author

/ok to test 683f1ce

@ffrujeri

Copy link
Copy Markdown
Contributor Author

/ok to test 05d3c87

ffrujeri and others added 5 commits November 23, 2026 03:28
…tor and grading

auto-ontology-eval runs BIRD-Interact Lite and Full query tasks on the ADK's
orchestrator, user simulator and grader. Bring the Environment Server to parity
with what it uses, at ADK revision 451fe2c3518ee1cf908d8139e2913483bd519381:

- c-Interact is the ADK's protocol: the agent gets ask_user and submit_sql,
  the ADK's instruction and tool descriptions, and each turn is opened with the
  orchestrator's phase-1, debug or follow-up message. A turn ends at its
  submission; each phase has two turns; rewards follow the phase's submissions.
- The user simulator is the ADK's two-stage pipeline with its v2 prompts,
  sampled at temperature 0, and its clause split of the solution (sqlglot).
  Its placeholders are filled in one pass, so a question cannot pull the
  solution SQL into the prompt as the ADK's sequential fill would.
- Grading is the ADK's default test case, edge cases included, run in its
  order on one database state; PostgreSQL scripts are sent whole; phase 1's
  passing SQL is applied for phase 2, and replayed on a fresh sandbox.
- Query phases are graded by their result even when they have test cases;
  only a non-query phase with test cases is refused (server) or left out
  (prepare.py), as the ADK decides by category.

The ADK's texts are copied verbatim into adk_prompts.py, with its MIT notice
and revision, and recorded in ATTRIBUTIONS.md.

Validation: server tests 64 passed, 4 skipped (real PostgreSQL, run in the
Lite image instead); prepare tests 7 passed; the ADK's own grading against
grading.py on six Lite databases agreed on 863 of 863 submissions; the example
tasks with real models on Docker, 10 of 10 (mean reward 0.82); Lite on
PostgreSQL through the recipe, with a stand-in ground truth for three tasks,
in both modes on Docker.

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

The ADK's before-model callback ends the agent's run after submit_sql, so its
turn makes no model call after the submission. Gym's agent made one more,
which the ADK does not: token counts and trajectories differed from the
ADK's, though rewards did not.

submit_sql's reply, and the ADK's replies after a submission, now end the
agent's activation (ToolResult.ends_activation).

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: Felipe Vieira Frujeri <[email protected]>
The grading tests checked the helper functions apart, so removing a rule from
grade itself passed the suite: running the submission as written first, the
ROUND and DISTINCT rewrites, or the 10,000-row cap. Each new test fails when
grade drops one of them.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: Felipe Vieira Frujeri <[email protected]>
… not run, unlike in the ADK

The README and CInteractTools said a call after submit_sql in the same model
response gets the ADK agent's reply. The ADK runs every call of a response
(its c-Interact callback stops only the next model call), so a second
submit_sql is graded there too. Gym runs none after the submission. The README
now lists this as a second deliberate difference.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: Felipe Vieira Frujeri <[email protected]>
…to sample the policy for comparable scores

- The ADK parity section lists what differs, beyond the two deliberate choices: a failed simulator or grader masks
  the sample; the agent's request (the ADK's identity line, the tools' descriptions and `strict`); tool results as
  text; the history after a submission; an empty submission's message.
- For scores comparable with the ADK's, run the policy at temperature 0 with at most 4096 output tokens, set on the
  policy's Model Server (`sampling_overrides`), since the server writes the agent's requests.
- auto-ontology-eval is linked where the READMEs first name it.
- The episode's budget fields say which mode owns each.
- The interaction-deadline test's first turn is a text reply, so no grade runs inside its 0.5-second deadline.

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 99fba90

@github-actions

Copy link
Copy Markdown
Contributor

🔄 Merge queue validation started! You can track the progress here: https://github.com/NVIDIA-NeMo/Gym/actions/runs/45125297479

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 needs-review PR is ready for code review and waiting on a reviewer risk:high Autobot PR risk: high sla:review-overdue Review response is over the one-business-day SLA

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants