Skip to content

feat(auto_ontology_agent): run Auto Ontology's interactive pipeline in BIRD-Interact's c-Interact and a-Interact - #6450

Open
ffrujeri wants to merge 7 commits into
ffrujeri/auto-ontology-agent-c-interactfrom
ffrujeri/auto-ontology-agent-interactive
Open

ffrujeri wants to merge 7 commits into
ffrujeri/auto-ontology-agent-c-interactfrom
ffrujeri/auto-ontology-agent-interactive

Conversation

@ffrujeri

@ffrujeri ffrujeri commented Nov 19, 2026 •

Copy link
Copy Markdown
Contributor

What

auto_ontology_agent gets a second pipeline for BIRD-Interact: with pipeline: interactive, it runs Auto Ontology's interactive pipeline (auto_ontology.retrieval.interactive) in place of its ReAct agent, in both c-Interact and a-Interact. This is the pipeline that auto-ontology-eval runs on BIRD-Interact. The default (pipeline: react) and the BIRD dev path do not change.

  • Around the pipeline, the agent does what auto-ontology-eval's adapter does (ontology_sql_eval/bird_interact/server.py at e727e4d6):
    • It creates the session with the schema, the visible knowledge, the question budget and the adapter's settings.
    • A question (AskUserAction) goes to the server's ask tool, and a query (SubmitSQLAction) goes to its submit tool.
    • With knowledge_dir, the pipeline also gets each visible knowledge entry's children_knowledge links.
  • Two models. Auto Ontology's reasoning role runs on the policy. Its non-reasoning role runs on non_reasoning_model_server when that is set. Both are Gym Model Servers, so Gym captures every call on the rollout's route.
  • c-Interact. Each turn steps the pipeline until it submits. The session is saved in the sandbox after each turn and loaded at the next.
  • a-Interact runs as one activation, as auto-ontology-eval runs it (a_interact.py, run_a_interact in episode_runner.py):
    • The agent buys the schema, the column meanings and the knowledge base through the server's tools.
    • Phase 1, its retries and the follow-up then run in the sandbox, by auto-ontology-eval's budget rules (budget.py): phase 1 must leave 4 coins; a submission is never refused; a repeated failed query ends the phase; the follow-up gets auto-ontology-eval's instructions.
    • Each query that Auto Ontology runs is charged through the server's execute tool, which refuses it once the budget is spent. The result is then read from the sandbox's own copy of the database, because execute shows at most 20 rows and Auto Ontology needs the whole result.
    • The agent's account charges BIRD-Interact's reference prices, the server's default action_costs, which the pairing requires. A reply whose coins_left departs from the account, or a charged call with no reply, ends the task.
  • The Auto Ontology pin stays as feat(birdbench): build the Auto Ontology catalog image in Gym, pinned once #6288 sets it: Auto Ontology's main, which has the interactive coordinator. auto-ontology-eval runs release 1.3.0, which this PR pinned until Let a ReAct episode ask the user NVIDIA/auto-ontology#559 merged (4d7b623b: 1.3.0 + docs: remove trl docs #543 + the first version of docs: version switcher is leading to "Page Not Found" #559). The results below were measured on that earlier pin; main is newer than 1.3.0, so they need a rerun to carry over.

Why

The goal is parity with auto-ontology-eval's BIRD-Interact submission (e727e4d6: Auto Ontology 1.3.0, the interactive pipeline, a catalog with the column meanings, Claude Opus 5.5 reasoning and Claude Sonnet 5.5 non-reasoning), with Gym's split of the work: the Environment Server runs the episode and grades it, and the agent runs in its own sandbox. Tracking: GYMINT-753 (the agent) and GYMINT-754 (the comparison with auto-ontology-eval), in Linear.

Stacked on #6323. The BIRD-Interact pairing (the catalog image with the column meanings, and the *_auto_ontology_* configs) is #6489, stacked on this PR. The BIRD-Interact stack (#5465 → #5534) has merged.

Code provenance. The a-Interact budget rules, the balance text and the follow-up instructions follow auto-ontology-eval (https://github.com/NVIDIA/auto-ontology-eval, ontology_sql_eval/bird_interact/budget.py and server.py at e727e4d6e1e198355099de4803590bb3681793a4, Apache-2.0). episode_runner.py and a_interact.py record the source.

Validation

  • pytest responses_api_agents/auto_ontology_agent/tests (the agent's venv): 85 passed, 1 skipped. New tests: test_interactive.py (session creation, questions, submissions, the knowledge links, the non-reasoning Model Server) and test_a_interact.py (request parsing, purchases, budget accounting, BudgetExhausted, the repeated-SQL stop, follow-up text).

  • pytest benchmarks/birdbench/tests: 80 passed, 3 skipped.

  • pre-commit run --files on the changed files: passed.

  • BIRD dev on the new pin: build_image.sh built the catalog at 4d7b623 (Auto Ontology 1.3.0) as nemo-gym/bird-catalog:dev-1.3.0: all 11 databases compiled, with one rate-limit retry. On the first 20 BIRD dev tasks with AWS Claude Opus 5.5: 17/20 correct, against 15/20 for the same tasks on the earlier image (a630ebd + docs: remove trl docs #543) in feat(auto_ontology_agent): run Auto Ontology's ReAct agent in Gym, one sandbox per episode #6289's 200-task run; 18 of the 20 got the same reward. No failures, nothing masked, every sandbox stopped.

  • After the rebase onto main (4954b38, 2026-11-23), with the BIRD-Interact stack merged: the agent's tests 86 passed, 1 skipped; pytest benchmarks/birdbench/tests 84 passed, 5 skipped; pre-commit passed.

  • Review fix (55a17b0): the non-reasoning Model Server resolves with trained=False, so it keeps its own sampling; a-Interact's activation honors the server's tools. Agent tests: 95 passed, 1 skipped. a-Interact smoke at the stack's top (34e9855): rewards 1.0, 1.0, 1.0, 0.0; rollout health 4 unobserved, 0 unhealthy.

  • Third review round, rebased onto main (6f6f4c7, 2026-11-24), 1986394:

    • A query whose execute reply is lost, or that the server charged at another price, fails the task as soon as the pipeline's step returns, before it asks or submits. A question or submission charged at another price fails it too.
    • The a-Interact invocation starts before the purchases, so a failed purchase fails it.
    • The new tests fail with the previous code. Core (tests/unit_tests/benchmarks/, environment/, config/, CLI) at the stack's top: 2834 passed, 13 skipped; agent tests: 108 passed, 1 skipped; pre-commit run --all-files: passed.
    • Smoke at the stack's top (43784ab), Claude Opus 5.5: 5 of 5 BIRD dev tasks correct; BIRD-Interact Full on the interactive pipeline and the full-meanings image, c-Interact rewards 1.0, 1.0, 1.0, 0.0 and a-Interact 1.0, 1.0, 1.0, 0.0 (16 to 19 BIRD-COIN; the 0.0 is the agent's own repeated_sql stop). No failures, nothing masked, rollout health unobserved only, every sandbox stopped. In a-Interact, every charged reply's coins_left matched the agent's account.
  • Rebased onto main (5398501, 2026-11-30), 18d441e: no conflicts in this PR. Core suite (tests/unit_tests) at the stack's top: 27647 passed, 39 skipped; one failure under xdist, test_indic_in22.py::test_manifest_is_discoverable_under_its_catalog_path, passes alone and is outside this stack; agent tests: 108 passed, 1 skipped; component locks: 342 checked, 0 failed; pre-commit on the stack's files: passed. Smoke at the stack's top: 5 of 5 BIRD dev tasks correct with the agent on the catalog image at this stack's pin (nemo-gym/bird-catalog:dev-1.3.0), 3 model calls each, all captured, no failures, every sandbox stopped; BIRD-Interact Full c-Interact on the interactive pipeline and the full-meanings image, 4 query tasks: rewards 1.0, 1.0, 0.8, 0.0, as on 2026-11-24 except a debug-turn 0.8 for crypto_exchange_1 (the 0.0 is archeology_scan_1, which failed on 2026-11-24 too), no failures, nothing masked; a-Interact: rewards 1.0, 1.0, 1.0, 0.0 (16 to 18 BIRD-COIN), the same as on 2026-11-24, no failures, nothing masked, every sandbox stopped.

  • Pinned Auto Ontology's main (a00a3906, the merge of Let a ReAct episode ask the user NVIDIA/auto-ontology#559) and rebased onto main (bc5383b), 2026-11-30, 1d978fc: this PR no longer moves the pin (see above); the README says which Auto Ontology the interactive pipeline runs. Core suite (tests/unit_tests) at the stack's top: 27674 passed, 39 skipped; one failure under xdist in test_openshell_provider.py, which passes alone and is outside this stack; agent tests: 110 passed, 1 skipped; benchmarks/birdbench/tests: 82 passed, 5 skipped; component locks: 343 checked, 0 failed; pre-commit on the stack's files: passed. Smoke on the rebuilt images: 5 of 5 BIRD dev tasks correct with Claude Opus 5.5, 3 model calls each, no failures, every sandbox stopped; the interactive pipeline in c-Interact: 1.0, 1.0, 1.0, 0.0; in a-Interact: 1.0, 1.0, 1.0, 0.7 (17 to 18 BIRD-COIN); no failures, nothing masked, every sandbox stopped (the 0.0 and 0.7 are archeology_scan_1, which scored 0.0 at the earlier pin too).

  • Rebased onto main (dd09637), 2026-12-01, 3a48aa1: no conflicts; no change in this PR. tests/unit_tests/benchmarks, config, cli and tooling pass, as do the test files that failed locally with a partial environment (the rest fail on main too, on this machine); benchmarks/birdbench/tests: 82 passed; agent tests: 110 passed, 1 skipped; component locks: 343 checked, 0 failed; pre-commit on the stack's files: passed.

  • Fourth review round, rebased onto main (0b7bcdc), 2026-12-02, b904d81. Review fix (b904d81): the runner watches the interactive pipeline's ReAct model calls, so an empty submission after a model call it gave up on ends with model_error and its model_failure for the outcome policy, in a-Interact and in c-Interact's interactive turns, instead of a scored empty answer. The budget stop after a passing submission stays, for parity with auto-ontology-eval. Core suite (tests/unit_tests) at the stack's top: 27972 passed; the 8 that fail (tool and sandbox-transfer telemetry, two OpenSandbox script-help tests) fail on main on this machine too. benchmarks/birdbench/tests: 121 passed; agent tests: 124 passed, 1 skipped; component locks: 345 checked, 0 failed; pre-commit on the stack's files: passed. Smoke: BIRD dev, 5 tasks, ReAct agent: 1, 1, 1, 1, 1; c-Interact, interactive pipeline: 1, 1, 1, 0; a-Interact: 1, 1, 1, 0. The zeros are archeology_scan_1, graded wrong as at the earlier pins; no masked rollouts, empty failure sidecars.

  • Docs, 2026-12-02, 154db08: the published harness page gets a "Auto Ontology's interactive pipeline" subsection under Sandboxed harnesses, in the form of the Kilo and Pi/OpenCode ones: what pipeline: interactive does (the default react path is unchanged), what it needs (the catalog image at the pinned Auto Ontology, the Environment Server's tools over direct HTTP, the embedding key, the optional non-reasoning Model Server), the agent override, and a link to the README. The harness table keeps its one row. fern check: 0 errors; tests/unit_tests/test_fern_docs_links.py: passed; pre-commit on the page: passed.

  • Rebased onto main (0cfc8d1), 2026-12-04, ef5d168, on feat(auto_ontology_agent): run Auto Ontology's ReAct agent in Gym, one sandbox per episode #6289's lent-sandbox change: non_reasoning_model_server sits beside the now optional sandbox_provider, and the interactive pipeline's parse_agent_context no longer refuses a lent sandbox. No other change in this PR. Agent tests at the stack's top: 118 passed, 1 skipped. Core (tests/unit_tests/benchmarks, environment, config, agents, server_runtime) at the stack's top: 6353 passed, 14 skipped; the one failure, test_resolve_config_servers_logs_unresolvable_configs[recursive_alias-ConfigError], fails on main on this machine too. Component locks: 350 checked, 0 failed; pre-commit on the stack's files: passed. Smoke at the stack's top: BIRD-Interact Full on the interactive pipeline, where the agent still starts its own sandbox: c-Interact 1.0, 1.0, 1.0, 0.0 and a-Interact 1.0, 1.0, 1.0, 0.7 (archeology_scan_1, its first phase in a-Interact). No failures, nothing masked, every sandbox stopped.

Rollout evidence

BIRD-Interact Full, the 410 query tasks, one repeat, on the pushed branch ffrujeri/bird-interact-auto-ontology (d4491c9): #5534's head 82023bb merged with this PR, plus the pairing's configs. Settings: Claude Opus 5.5 policy (reasoning role) and user simulator, Claude Sonnet 5.5 non-reasoning role, the catalog image with the column meanings, the Full database image rebuilt from #5534 (agent SQL as the bird_agent role), local Docker sandboxes, 48 tasks at a time. Rewards are the bird_interact Environment Server's grades.

Mode Tasks Reward P1 P1 + debug FU FU + debug
c-Interact 410 38.98 37.32% 46.10% 26.10% 29.27%
a-Interact 410 35.34 37.80% 40.24% 23.41% 23.90%

Reward is the final score; the other columns are pass rates of all 410 tasks. No rollout was masked, the failures files are empty, every sandbox stopped, and the model endpoints returned no 429s. a-Interact spent 17.4 BIRD-COIN per task on average. A solution SQL failed at grading in 3 c-Interact and 2 a-Interact rollouts (the broken ground truths in #5534's README).

An earlier run with this agent code and the BIRD-Interact server from before #5534's review fixes, 8 tasks at a time, scored 39.54 (c-Interact) and 35.15 (a-Interact). 80% of c-Interact tasks and 86% of a-Interact tasks got the same reward in both runs.

After the rebase, #6489 reran the smoke on the merged BIRD-Interact server; see its rollout evidence.

@ffrujeri ffrujeri added feature New capabilities, enhancements, or enablement work area:agent Agent harnesses and Responses API agent behavior labels Nov 19, 2026
@copy-pr-bot

copy-pr-bot Bot commented Nov 19, 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 #6319 November 19, 2026 05:56
@ffrujeri

Copy link
Copy Markdown
Contributor Author

/ok to test c3b0486

@ffrujeri

Copy link
Copy Markdown
Contributor Author

/ok to test acf86e1

ffrujeri added a commit that referenced this pull request Nov 19, 2026
ffrujeri added a commit that referenced this pull request Nov 20, 2026
ffrujeri added a commit that referenced this pull request Nov 20, 2026
ffrujeri added a commit that referenced this pull request Nov 21, 2026
ffrujeri added a commit that referenced this pull request Nov 21, 2026
ffrujeri added a commit that referenced this pull request Nov 23, 2026
@ffrujeri
ffrujeri force-pushed the ffrujeri/auto-ontology-agent-interactive branch from acf86e1 to 104a8ca Compare November 23, 2026 17:54
@ffrujeri

Copy link
Copy Markdown
Contributor Author

/ok to test 104a8ca

@ffrujeri
ffrujeri force-pushed the ffrujeri/auto-ontology-agent-interactive branch from 104a8ca to 0568b77 Compare November 23, 2026 18:06
@ffrujeri

Copy link
Copy Markdown
Contributor Author

/ok to test 0568b77

@ffrujeri
ffrujeri marked this pull request as ready for review November 23, 2026 18:29
@ffrujeri ffrujeri added the needs-review PR is ready for code review and waiting on a reviewer label Nov 23, 2026
@ffrujeri

Copy link
Copy Markdown
Contributor Author

/ok to test 0568b77

@nemo-automation-bot
nemo-automation-bot Bot requested review from a team November 23, 2026 18:54
@ffrujeri
ffrujeri requested a review from yaoyu-33 November 23, 2026 18:56

@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 two RISK issues: a passing submission can lose its follow-up, and the dedicated auxiliary model inherits policy sampling overrides.

I reviewed all nine changed files and traced their callers, tool contracts and session lifecycle. Three delegated reviews covered integration, the runner, and tests/docs/image compatibility.

Validation: I relied on this head's successful Lint check, Unit tests / Test, Unit tests / Server suite and Nemo_CICD_Test. Changed-server tests and session-routing end-to-end tests were skipped, not passed. The non-blocking compliance aggregate failed on both base and head; this agent's compliance check succeeded.

CPU probes ran in 766267172432.dkr.ecr.us-east-1.amazonaws.com/gym:main-offline. Replay, disconnect, failed-purchase, cookie propagation and prompt-parsing probes passed. Budget and sampling probes reproduced the inline findings. The initial server import lacked sqlglot; adding it in scratch enabled the production-server probe. I did not rerun green CI suites or model-backed rollouts. Real Auto Ontology coordinator behavior and session serialization were not independently validated because its runtime was unavailable; I read the PR's supplied rollout evidence.

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

break
else:
turn_type, debug_error = TurnType.DEBUG, a_interact_execution_error(reply)
if budget.exhausted:

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.

RISK: Preserve the follow-up after a passing submission exhausts the budget.

Could this exhaustion stop apply only after a failed submission? With at most 3 coins before submission, Budget.charge("submit") marks the balance exhausted. A successful phase-1 reply opens phase 2 above, but this check immediately exits, discarding a valid follow-up attempt.

The server's _charge deliberately permits another submission at zero or negative balance. Its existing regression test covers that contract.

python /workspace/review-probes/leader/probe_budget_followup.py returned budget_exhausted after only phase 1 with 2 or 3 coins; the 4-coin control reached phase 2. A separate probe of the imported production _charge accepted phase 2 at −3 coins.

Allow a submit-only follow-up after a successful phase transition while keeping paid exploration/questions disabled. Preserve the failed-submission exhaustion stop, update the README's terminal-budget description, and add runner coverage for passing submissions with 3 and fewer than 3 coins.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Not changing this: the stop is deliberate parity with auto-ontology-eval, which this pairing has to match. At e727e4d6 (ontology_sql_eval/bird_interact/server.py, the submission loop), a passing phase-1 submission opens phase 2, and the loop then breaks on if budget.exhausted: stop_reason = "budget_exhausted". Its Budget.charge("submit_sql") (budget.py) marks the balance exhausted when a submission spends it to zero or below. Our runner follows the same steps in the same order. The server's _charge would accept another submission at a negative balance, but auto-ontology-eval's agent never makes one, so allowing it here would score a different agent than the one we compare against. The agent's README states the rule ("a submission is never refused, and one that spends the budget ends the task"), and the stop is in the runner's run_a_interact.

@ffrujeri
ffrujeri force-pushed the ffrujeri/auto-ontology-agent-interactive branch from 18d441e to 1d978fc Compare November 30, 2026 23:19
@ffrujeri

Copy link
Copy Markdown
Contributor Author

/ok to test 1d978fc

@ffrujeri
ffrujeri force-pushed the ffrujeri/auto-ontology-agent-interactive branch from 1d978fc to 3a48aa1 Compare December 1, 2026 00:54
@ffrujeri

ffrujeri commented Dec 1, 2026

Copy link
Copy Markdown
Contributor Author

/ok to test 3a48aa1

@github-actions github-actions Bot added the sla:review-overdue Review response is over the one-business-day SLA label Dec 1, 2026
@adil-a

adil-a commented Dec 1, 2026

Copy link
Copy Markdown
Contributor

/review reset=true 3a48aa1

Copy link
Copy Markdown
Contributor

Invalid /review command: arguments must use key=value syntax. Usage: /review [<sha>] [approve=<true|false>] [mode=<light|strict>] [model=<codex|claude>] [prompt="<value>"] [reset=<true|false>] [role=<automation|engineer>].

@adil-a

adil-a commented Dec 1, 2026

Copy link
Copy Markdown
Contributor

/review 3a48aa1 reset=true

@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

The prior budget-exhaustion RISK still reproduces: a successful phase-1 submission can lose its follow-up. The auxiliary-model sampling finding is fixed at both seed and staging. The prior documentation NOTE is partially addressed by the updated integration table, but a usable setup example is still missing.

I reviewed all nine changed files and their connected callers, tool contracts and tests, with three delegated reviews covering adapter integration, the runner, and tests/docs. The previous review commit 0568b7734da32d56b1aeddb2d7117acea76f763d was unavailable, so I verified its published findings against the admitted head without a baseline diff.

CI evidence: I relied on the checks attached to this head: Lint check, Unit tests / Test, Unit tests / Changed server tests, Unit tests / Server suite and Nemo_CICD_Test succeeded. The changed-server log shows the agent suite ran in CI's merge checkout: 110 passed, 1 skipped. The skipped test was SQL-qualifier conversion. Full server-suite shards and session-routing end-to-end were skipped, not passed.

Local evidence: CPU probes ran in 766267172432.dkr.ecr.us-east-1.amazonaws.com/gym:c2974f7bd962fd921ae90176f19d983bccbdebff, a successful default-branch CI image because the head's container build was skipped. Source-bound runner probes reproduced the budget finding, including from the normal post-purchase balance. The imported production server accepted the follow-up at zero and negative balance. Sampling, replay/disconnect, request parsing, cookie/header propagation, charged-call failure handling and mocked-session resume probes passed. I installed sqlglot in a scratch environment and supplied the image's existing core packages to resolve initial import failures; the SQL-conversion probe then passed.

I did not rerun green CI suites or model-backed rollouts. I read the PR's supplied smoke evidence. Real Auto Ontology coordinator compatibility, real-session serialization and live database execution were not independently validated.

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

break
else:
turn_type, debug_error = TurnType.DEBUG, a_interact_execution_error(reply)
if budget.exhausted:

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.

RISK: Preserve the follow-up after a passing submission exhausts the budget.

Could this exhaustion stop distinguish a failed submission from a successful phase transition? Budget.charge("submit") marks the account exhausted with at most 3 coins before submission. A passing reply opens phase 2 above, but this unconditional stop immediately exits without attempting the follow-up.

The owning server's _charge deliberately permits another submission at zero or negative balance. Its existing regression test covers that contract.

My source-bound probe_runner.py run returned budget_exhausted after one passing submission with 2 or 3 coins; the 4-coin control submitted both phases. This is also reachable from the normal 15 coins after purchases: four failed submissions leave 3 coins, then a passing fifth submission opens phase 2 but produces zero follow-up steps. That discards an opportunity to earn the remaining a-Interact reward.

Allow the submit-only follow-up after a successful transition while keeping paid exploration/questions disabled and exhausted failed submissions terminal. Update the terminal-budget wording in the runner and README. Acceptance: add passing phase-1 cases at 3 and fewer than 3 coins, assert the follow-up reaches submit, retain the failed-submission and 4-coin controls, and cover a path starting at the normal post-purchase balance. This is the still-reproducible issue from comment 4670663027.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Keeping the stop, for the reason in my earlier reply: it matches auto-ontology-eval, which this pairing must match. Its submission loop (ontology_sql_eval/bird_interact/server.py at e727e4d6) opens phase 2 after a passing submission and then breaks on budget.exhausted, and its Budget.charge("submit_sql") marks a balance spent to zero or below as exhausted. The server accepting a further submission is the server's rule; auto-ontology-eval's agent never makes one, so allowing it here would score a different agent from the one we compare against. The README states the rule.

| CrewAI (`crewai_agent`) | Chat Completions | MCP only | Token capture untested; training not qualified | Not declared | Not declared (development only) | Not validated |
| Kimi Code (`kimi_code_agent`) | Chat Completions | None | Not validated; evaluation only | Not declared | Not declared | Not validated |
| Auto Ontology ([`auto_ontology_agent`](https://github.com/NVIDIA-NeMo/Gym/tree/main/responses_api_agents/auto_ontology_agent)) | Chat Completions | Direct HTTP, BIRD-Interact's `ask_user` and `submit_sql` only; its own catalog tools, in an agent-owned sandbox from its catalog image | Not wired up; evaluation only | Not declared | Not declared | No; BIRD dev and BIRD-Interact c-Interact only |
| Auto Ontology ([`auto_ontology_agent`](https://github.com/NVIDIA-NeMo/Gym/tree/main/responses_api_agents/auto_ontology_agent)) | Chat Completions | Direct HTTP, BIRD-Interact's tools only; its own catalog tools, in an agent-owned sandbox from its catalog image | Not wired up; evaluation only | Not declared | Not declared | No; BIRD dev, and BIRD-Interact c-Interact and a-Interact (a-Interact with `pipeline: interactive`) only |

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.

NOTE, documentation suggestion: Add a usable interactive-pipeline setup example.

The updated listing improves discoverability, but it is still the only Auto Ontology entry under the published user docs. It names pipeline: interactive and links to the README without showing how to wire the mode up.

Could you add a short linked subsection with minimal configuration, the catalog image/version prerequisite, the direct-HTTP tool grant and the optional non-reasoning Model Server? Keep the detailed harness rules in the README rather than duplicating them. Acceptance is a reachable published example that includes those prerequisites and makes clear that the default ReAct/BIRD dev path is unchanged. This is the partially addressed suggestion from comment 4670663046, not a blocker.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Leaving the published docs as the table row that links the agent's README. The README is where the setup lives (configuration, the catalog image and its version, the direct HTTP grant, the optional non-reasoning Model Server), and the BIRD-Interact README has the full commands; a second copy in the published docs would drift from both.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Reconsidered, and added in 154db08: a "### Auto Ontology's interactive pipeline" subsection under Sandboxed harnesses on the published page, in the same form as the Kilo and Pi/OpenCode ones. It says what pipeline: interactive does and that the default react path (BIRD dev, the ReAct c-Interact pairing) is unchanged, lists what the pipeline needs (the catalog image at the pinned Auto Ontology, the bird_interact Environment Server's tools over direct HTTP, the embedding key, and the optional non_reasoning_model_server), gives the agent override, and links the README for knowledge_dir and the rest. The table keeps its one row. #6489, where BIRD-Interact's configs land, adds a sentence naming them and the image's recipe, with a link to the commands. fern check reports no errors and tests/unit_tests/test_fern_docs_links.py passes.

@yaoyu-33 yaoyu-33 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.

I traced an exhausted model request through the interactive runner and BIRD scoring.

if not action.sql.strip():
recovered = str((getattr(session, "path_state", None) or {}).get("sql_code") or "").strip()
if not recovered:
reason = "empty_sql"

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.

On the first a-Interact SQL generation, exhausted model retries can produce an empty SubmitSQLAction with session.path_state["react_end_reason"] set to model_error. With no prior SQL, this branch returns empty_sql without model_failure, so BIRD can count a service outage as a scored zero. Could the runner propagate the recorded model failure to the outcome policy while preserving the normal empty-answer behavior?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Fixed in b904d81. The runner now watches the ReAct loop's model calls in the interactive pipeline, as it does for the ReAct agent. When the pipeline returns an empty submission and its react_end_reason is model_error with a captured failure, a-Interact ends with model_error and the call's model_failure, without paying for a submission, so the outcome policy decides it by the call's status. c-Interact's interactive turns had the same gap (they submitted the empty query) and get the same handling. An empty answer with no failed call is still empty_sql and scored. Tests: test_a_first_generation_whose_model_call_failed_reports_it_rather_than_score_nothing, test_an_empty_answer_with_no_model_failure_is_still_scored, and the c-Interact test_a_turn_whose_model_call_failed_reports_it_rather_than_submit_nothing.

@github-actions github-actions Bot removed the sla:review-overdue Review response is over the one-business-day SLA label Dec 2, 2026
@ffrujeri
ffrujeri force-pushed the ffrujeri/auto-ontology-agent-interactive branch from 3a48aa1 to b904d81 Compare December 2, 2026 02:43
@ffrujeri

ffrujeri commented Dec 2, 2026

Copy link
Copy Markdown
Contributor Author

/ok to test b904d81

@nemo-pr-automation
nemo-pr-automation Bot requested a review from a team December 2, 2026 02:44
@ffrujeri
ffrujeri force-pushed the ffrujeri/auto-ontology-agent-interactive branch from b904d81 to 154db08 Compare December 2, 2026 03:07
@ffrujeri

ffrujeri commented Dec 2, 2026

Copy link
Copy Markdown
Contributor Author

/ok to test 154db08

@adil-a adil-a 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.

Notes from a pass over the stack at this head. Each inline comment says how it was established, and anything not confirmed from the code is put as a question.

# interactive pipeline calls for extraction and merging; None runs that
# role on the policy too. auto-ontology-eval runs it on a second model.
non_reasoning_model_server: Optional[ModelServerRef] = None
non_reasoning_model: str = Field(default="openai/non-reasoning", pattern=r"^(openai|azure|aws)/")

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.

RISK: The model aliases may keep Auto Ontology off its Claude path.
The runner hands Auto Ontology the names openai/policy and openai/non-reasoning. From the pinned Auto Ontology source, not run: _structured_output_kwargs in utils/llm_invoke.py picks the structured-output method by model name. Only a name containing claude or anthropic gets function_calling with no tool_choice; any other name gets the default JSON-schema response_format, which that function's docstring says Claude behind an OpenAI-compatible gateway rejects. The interactive pipeline's entity extraction goes through this call (entity_coverage/agents/question_extraction.py). Auto Ontology's default model names are Claude names, so a run that keeps them, as the reference's Claude runs appear to, takes the other path. Could you check whether the Claude runs here had these calls rejected or answered differently? If so, the parity configs could set model and non_reasoning_model to names that carry the model family.



def test_the_database_qualifier_is_dropped_and_sql_that_does_not_parse_is_kept() -> None:
pytest.importorskip("sqlglot")

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.

NOTE: This test is skipped wherever the agent's tests run.
sqlglot is not in the agent's uv.lock (nor the root one), so importorskip skips this test in the agent's own venv, which matches the "1 skipped" in the test runs. As a result nothing checks without_database_qualifier: a change that stops stripping the <database>. qualifier (for example dropping table.set("catalog", None)) leaves the suite green, and every submission would then fail on the grader's per-task database. Could you add sqlglot to the agent's dev dependencies so this test runs, or test the function in a way that does not need it to be skipped?

root = Path(self.config.knowledge_dir)
path = (root if root.is_absolute() else PARENT_DIR / root) / database / f"{database}_kb.jsonl"
children: dict[int, list[int]] = {}
for line in path.read_text().splitlines():

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.

NOTE: Check knowledge_dir at startup.
A knowledge_dir that is missing or wrong shows up only here, at the first activation for each database. In a-Interact that comes after _run_a_interact has already bought the schema, the column meanings and the knowledge base (3 BIRD-COIN), with the sandbox running, so every task fails with a FileNotFoundError after spending its purchases. Reproduced with the agent's test fakes: an agent built with a folder that does not exist starts without error, and the first a-Interact activation fails after the three purchases. Could the config validate at startup that the folder exists (and maybe that it has <db>/<db>_kb.jsonl entries), so the mistake shows once rather than per task?

def interactive_knowledge(
entries: list[dict[str, Any]], children: dict[int, list[int]]
) -> tuple[str, dict[str, list[str]]]:
"""The visible knowledge as Auto Ontology's interactive pipeline takes it, as auto-ontology-eval writes it.

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.

NOTE: Record where the adapted code comes from.
interactive_knowledge follows auto-ontology-eval's _format_external_kb (ontology_sql_eval/bird_interact/server.py) almost line for line, _knowledge_children in app.py follows its _load_kb_children, and without_database_qualifier in episode_runner.py follows _strip_catalog_qualifier in bird_interact_http.py. The "Code provenance" section of AGENTS.md asks for the source URL, the exact commit and the license in the header of every file holding adapted code, and in the PR description. Only a_interact.py (and a comment inside episode_runner.py) names the source, and a_interact.py gives only the short e727e4d6. Could you add the full SHA, URL and Apache-2.0 to the headers of c_interact.py, app.py and episode_runner.py?

with urllib.request.urlopen(request, timeout=TOOL_TIMEOUT_SECONDS) as response:
reply = json.loads(response.read().decode(errors="replace"))
except urllib.error.HTTPError as error:
body = error.read().decode(errors="replace")

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.

NOTE: Share one HTTP client with call_tool.
call_charged_tool repeats the first half of call_tool but not its recent error handling. Here error.read() is not guarded, so an error body that is cut short raises IncompleteRead and the HTTP status is lost from the task's error. A refused connection or timeout also escapes as a raw URLError/OSError rather than one typed error. The task still fails in every case, so only the diagnosis is affected, but the two clients can now drift further apart. Could call_charged_tool reuse call_tool's request and error handling (one helper that returns the raw reply), and add only the observation check on top?

model_urls.append(
# Not a trained role: it keeps its own sampling, not the rollout's policy sampling.
self.resolve_model_base_url(
self.config.non_reasoning_model_server.name, body.episode_id.capture_key, trained=False

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.

NOTE: A few new rules have no test that fails without them.
The resolution check in test_an_a_interact_activation_buys_the_task_s_context_then_runs_the_task_in_the_sandbox keeps one entry per server name, so the payload's later trained=False overwrites this one: dropping trained=False here still passes. Each of these changes also leaves the agent's tests green: a budget regex in a_interact.py that drops a fractional budget, MAX_KNOWLEDGE_CHILDREN raised from 5 to 50, removing the same-host check under a restricted network_access, and call_charged_tool accepting a reply with no observation. Could you add a small test for each, for example by recording each resolution as a list?

ffrujeri and others added 7 commits December 4, 2026 00:24
…n BIRD-Interact's c-Interact and a-Interact

With `pipeline: interactive`, the agent runs Auto Ontology's interactive pipeline, the one auto-ontology-eval runs on
BIRD-Interact, in place of its ReAct agent, and does what auto-ontology-eval's adapter (e727e4d6) does around it:
the session, questions through the server's ask tool, submissions through its submit tool, the knowledge links, and
a second Model Server for Auto Ontology's non-reasoning role.

a-Interact runs as one activation: the agent buys the schema, the column meanings and the knowledge base through the
server's tools, then runs phase 1, its retries and the follow-up in the sandbox by auto-ontology-eval's budget rules.
Each query Auto Ontology runs is charged through the server's execute tool and read from the sandbox's copy of the
database.

The Auto Ontology pin moves to release 1.3.0 with the same two patches, since the interactive coordinator needs it.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: Felipe Vieira Frujeri <[email protected]>
…_gym.agents' public API

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: Felipe Vieira Frujeri <[email protected]>
…, and honor a-Interact's tools

The non-reasoning Model Server's URL took the rollout's policy sampling (resolve_model_base_url's default,
trained=True), so a training run's temperature, top_p and token cap overrode the role's own settings. It is not a
trained role: it now resolves with trained=False, as the base class provides for such roles.

a-Interact's one activation carries the server's tools, which the interactive pipeline calls, so that activation
honors its tools as a c-Interact turn does.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: Felipe Vieira Frujeri <[email protected]>
…er did not answer or priced otherwise, and time its purchases

A query whose execute reply was lost had been charged on the agent's account but never recorded, and Auto Ontology's SQL
tool turned the exception into feedback, so the task could go on to a scored submission. The connector now records the
failure, and the runner raises it as soon as the pipeline's step returns, before the task submits.

The agent's account charges BIRD-Interact's reference prices, the bird_interact server's default action_costs. A server
with other prices would let the agent spend the coins it keeps for a submission or the follow-up. Each charged reply's
coins_left is now checked against the account, and a difference fails the task. The README says the pairing needs the
default prices.

The a-Interact invocation now starts before the three purchases: a purchase that fails fails the invocation, and a task
that runs is timed from its first purchase.

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

The pipeline now runs the Auto Ontology main that build_image.sh pins, newer than the 1.3.0 that auto-ontology-eval
runs; of the flags the BIRD-Interact configs copy from auto-ontology-eval, that version still reads only INTERACTIVE.

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

When the pipeline's ReAct loop gave up on a model call, the pipeline returned an empty submission with
react_end_reason "model_error". With no earlier query, a-Interact ended as empty_sql, and c-Interact
submitted an empty query: an outage was scored as the model's empty answer. The runner now watches the
loop's model calls in both, as it does for the ReAct agent, and ends such a turn with model_failure, so
the outcome policy decides it by the call's status. An empty answer with no failed call is scored as before.

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

The published harness page listed the Auto Ontology agent in its table and linked the README, but did not
show how to run the interactive pipeline. A subsection under the sandboxed harnesses, like the Kilo and
Pi/OpenCode ones, now says what pipeline: interactive does and that react is unchanged, lists what it needs
(the catalog image at the pinned Auto Ontology, the Environment Server's tools over direct HTTP, the
embedding key, and the optional non-reasoning Model Server), gives the agent override, and links the
README for the rest. The table keeps its one row.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: Felipe Vieira Frujeri <[email protected]>
@ffrujeri
ffrujeri force-pushed the ffrujeri/auto-ontology-agent-interactive branch from 154db08 to ef5d168 Compare December 4, 2026 00:35
@ffrujeri

ffrujeri commented Dec 4, 2026

Copy link
Copy Markdown
Contributor Author

/ok to test ef5d168

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area:agent Agent harnesses and Responses API agent behavior 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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants