Skip to content

feat(bird_sql): serve Auto Ontology's catalog tools, one sandbox per episode - #6285

Closed
ffrujeri wants to merge 3 commits into
ffrujeri/birdbench-single-agent-turnfrom
ffrujeri/birdbench-catalog-tools
Closed

ffrujeri wants to merge 3 commits into
ffrujeri/birdbench-single-agent-turnfrom
ffrujeri/birdbench-catalog-tools

Conversation

@ffrujeri

@ffrujeri ffrujeri commented Nov 17, 2026 •

Copy link
Copy Markdown
Contributor

What

A second bird_sql entrypoint, catalog_app.py, that serves three of Auto Ontology's tools over its catalog of the BIRD databases, as direct_http routes:

Tool What it does
retrieve Searches the catalog: tables, columns, business terms, definitions, saved analyses
run_sql Checks a query against the catalog, then runs it read-only
submit Checks and runs the final query; an accepted submission ends the episode's tools

benchmarks/birdbench/catalog_tools.yaml runs BIRD dev this way: the agent gets the question and the tools, no schema.

Why

Auto Ontology's ReAct agent answers with these three tools, and none of them calls a model. Serving them from the environment makes them usable by any harness (simple_agent, Codex, Hermes, ...), keeps the trajectories ordinary Gym trajectories for training, and keeps the catalog with the environment rather than inside one agent.

How

  • One sandbox per episode, from a catalog image (Auto Ontology, the BIRD databases and their catalog). At the seed the server starts it, the catalog's Postgres and the episode's tool runner, catalog_tool_runner.py, delivered through SandboxSpec.files. The runner listens only on a Unix socket in the sandbox; each route call reaches it through one sandbox exec. It keeps one Auto Ontology ToolContext per episode and calls Auto Ontology's own retrieve, run_sql and submit. verify, close and server shutdown stop the sandbox.
  • Budget: 24 tool calls, as Auto Ontology's loop allows; past it only submit is served. An accepted submission ends the tools.
  • Grading: verify grades the SQL of the last submit answered Accepted., with bird_sql's rules, from the rollout alone, so saved rollouts can be graded again without a sandbox. bird_sql gains a one-method hook, answer_sql; its behavior is unchanged.
  • Data: prepare.py --catalog-tools writes birdbench_sqlite_dev_catalog_tools.jsonl, whose rows offer the tools in responses_create_params.tools and carry no sql_context. Prompt: prompts/catalog_tools_sqlite.yaml.
  • The tool descriptions and the prompt are Gym's own; only the argument names mirror Auto Ontology's functions.
  • Embedding key. retrieve embeds each search, so a run passes the key of the catalog's embedding endpoint as ++bird_catalog_api_key=<key>. catalog_tools.yaml reads it with oc.select, so the benchmark listing resolves the config without it; the server refuses to start while a catalog_environment setting has no value.

The catalog image is built outside Gym: auto-ontology-eval's scripts/build_agent_image.sh ingests and compiles BIRD dev with Auto Ontology's pipeline. The image contract is in resources_servers/bird_sql/README.md, "Catalog tools".

Stacked on #6274.

Validation

  • pytest resources_servers/bird_sql/tests benchmarks/birdbench/tests: 162 passed, 18 skipped. New tests cover the tool definitions, the seed (sandbox spec, delivered files, catalog and tool-process start), seed failure, release, each route's reply, tool errors, a tool call without a session, the in-sandbox budget, accepted-submission handling and the socket protocol, and verify grading only the last accepted submission.
  • pre-commit run --files <changed files>: passed.
  • tests/unit_tests/environment/test_benchmarks.py::TestDiscoverBenchmarksInDir::test_every_repo_benchmark_appears_in_listing: passes (it failed while the key was a mandatory ???).
  • gym env validate --config benchmarks/birdbench/catalog_tools.yaml (with the inference_provider model config): valid.

Rollout evidence

Smoke on the first 5 BIRD dev tasks, simple_agent with Claude Opus 5.5 on a local Docker sandbox from the auto-ontology-eval catalog image: 5/5 correct. Each episode called retrieve, sometimes run_sql, then submit, which returned Accepted.; each sandbox was stopped afterwards.

Compatibility

Plain bird_sql and benchmarks/birdbench/config.yaml are unchanged. Known limit: until the end-of-turn signal lands (in the BIRD-Interact stack), simple_agent makes one more model call after an accepted submit, which adds tokens but does not change the grade.

@copy-pr-bot

copy-pr-bot Bot commented Nov 17, 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 #6286 November 17, 2026 06:09
@ffrujeri ffrujeri added area:environment Individual environments, benchmarks, verifiers, and environment-specific resources servers feature New capabilities, enhancements, or enablement work labels Nov 17, 2026
@ffrujeri

Copy link
Copy Markdown
Contributor Author

/ok to test 1404c62

@ffrujeri

Copy link
Copy Markdown
Contributor Author

/ok to test 60f79a5

ffrujeri and others added 3 commits November 17, 2026 19:18
…episode

Add a second bird_sql entrypoint, catalog_app.py, that gives the agent three
of Auto Ontology's tools over its catalog of the BIRD databases, as direct_http
routes: retrieve searches the catalog, run_sql checks a query against it and
runs it read-only, and submit checks and runs the final query. The agent sees
no schema. Any harness can call the tools; the tools and the catalog belong to
the environment.

- Each episode gets a sandbox from a catalog image (Auto Ontology, the BIRD
  databases and their catalog). At the seed the server starts it, the
  catalog's Postgres and the episode's tool process (catalog_tool_server.py,
  delivered through SandboxSpec.files), which keeps one Auto Ontology
  ToolContext for the episode. verify, close and shutdown stop the sandbox.
- The tools call Auto Ontology's own functions with its 24-call budget; past
  it only submit is served, and an accepted submission ends the tools.
- verify grades the SQL of the last submit answered "Accepted.", with
  bird_sql's rules, from the rollout alone (bird_sql gains an answer_sql hook).
- benchmarks/birdbench/catalog_tools.yaml runs BIRD dev this way;
  prepare.py --catalog-tools writes rows that offer the tools and carry no
  sql_context.

Plain bird_sql is unchanged.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: Felipe Vieira Frujeri <[email protected]>
catalog_tool_server.py is the program the catalog Resources Server uploads into each episode's sandbox. It
listens only on a Unix socket and serves no HTTP, so name it catalog_tool_runner.py, as Gym names in-sandbox
programs (partner_if's tool_runner.py, the agents' sandbox runners).

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: Felipe Vieira Frujeri <[email protected]>
… refuse to start without it

The benchmark listing resolves every benchmark config, and catalog_tools.yaml declared the embedding key
as a mandatory value (`???`), so the listing skipped it and test_every_repo_benchmark_appears_in_listing
failed. The config now reads the key with oc.select, and the catalog server refuses a catalog setting with
no value, naming ++bird_catalog_api_key, before any episode starts.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: Felipe Vieira Frujeri <[email protected]>
@ffrujeri
ffrujeri force-pushed the ffrujeri/birdbench-catalog-tools branch from 60f79a5 to 6b5566f Compare November 17, 2026 19:27
@ffrujeri

Copy link
Copy Markdown
Contributor Author

/ok to test 6b5566f

@ffrujeri
ffrujeri removed this pull request from stack #6286 November 17, 2026 22:48
@ffrujeri

Copy link
Copy Markdown
Contributor Author

Closing this direction for now: the Auto Ontology catalog stays inside the agent harness's sandbox, in the Auto Ontology Agent Server (#6289), rather than behind the bird_sql Resources Server's tools.

The parts the agent needs moved up the stack, without the catalog server: #6288 now holds only the catalog image (on #6274, with the Auto Ontology pin in its build_image.sh), and #6289 writes its own BIRD dev rows with prepare.py's agent_context option. The branch ffrujeri/birdbench-catalog-tools stays, so this can be reopened if we want to compare the two approaches again.

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.

1 participant