Repository navigation
feat(observability): agent-side url_path/base-URL helpers + wire remaining url_path-style agents - #1994
Merged
Glorf merged 1 commit intoJul 11, 2026
Conversation
Contributor
|
🌿 Preview your docs: https://nvidia-preview-ffrujeri-feat-model-server-observability.docs.buildwithfern.com/nemo/gym Here are the markdown pages you've updated: |
Signed-off-by: Felipe Vieira Frujeri <[email protected]> Signed-off-by: Michal Bien <[email protected]>
Glorf
force-pushed
the
ffrujeri/feat/model-server-observability
branch
from
July 11, 2026 13:08
05ba504 to
45647da
Compare
Glorf
pushed a commit
that referenced
this pull request
Jul 14, 2026
…ining url_path-style agents (#1994) Gives every agent a one-call way to correlate its model calls with a rollout for model-call capture, and wires the remaining url_path-style agent harnesses with it. Also addresses the PR #1715 review ask to collapse `apply_rollout_prefix(base_url, self.rollout_id_from_run(body))` into a single function. Correlation is now gated on `observability_enabled`: when capture is off, no agent emits `/ng-rollout/<id>` prefixes anywhere — URLs stay clean instead of carrying a prefix the model server strips and ignores. - **`url_path_for_run(url_path, body)`** — returns `/ng-rollout/<id><url_path>` when observability is enabled and the run body carries task/rollout indices; otherwise `url_path` unchanged. Used for downstream calls made while handling `/run` (direct model calls or self-calls to `/v1/responses`). - **`base_url_for_run(base_url, body)`** — the base-URL counterpart with identical gating, for SDK-style harnesses that configure a client once instead of prefixing each call. This is the one-function collapse requested in the #1715 review. - **`url_path_for_request(url_path, request)`** — for agents whose model calls happen inside `responses()`: carries an inbound prefixed self-call's rollout id (from the request's path params) onto the outgoing model call. - **`rollout_id_from_run(body)`** now applies the observability gate itself (fail-closed: no usable global config → uncorrelated, never an error). This is the single gate point, so the base-URL agents already wired on the parent branch (claude_code, anyterminal, mini_swe_agent_2) became gated with no changes to their code. It remains public because some flows need the bare id: claude_code and anyterminal thread it through layers that have no run body, and hermes' `responses()` derives it from path params. - The prefixed self-call route `/ng-rollout/{rollout_id}/v1/responses` is registered on every agent by the base `setup_webserver()`, so agents no longer hand-register it (hermes' override removed). Model calls in these harnesses are now correlated (and therefore captured when observability is on): - **New:** `simple_agent`, `non_executing_simple_agent`, `tool_simulation_agent` (its `responses()` gained a `Request` parameter), `proof_refinement_agent`, `critpt_agent`, `cvdp_agent`, `speed_bench_agent`, `browsecomp_agent`, and `aviary_agent` (its `responses()` receives the full run request in-process, so it uses `url_path_for_run` directly on the model call). - **Refactored to the helpers:** `hermes_agent` and `gymnasium_agent` (previously hand-rolled `rollout_path_prefix` f-strings, applied unconditionally — they now gate on observability like everyone else), and `mini_swe_agent_2` (the #1715-flagged line is now `self.base_url_for_run(base_url, body)`). The wiring pattern for the common shape (model calls inside `responses()`, `run()` self-calls `/v1/responses`): `run()` prefixes the self-call via `url_path_for_run`, the base-registered prefixed route carries the id in, and `responses()` re-applies it to the model call via `url_path_for_request`. Not wired here (bespoke model plumbing, each needs individual treatment): `harbor_agent`, `finance_agent`, `langgraph_agent`, `tau2`, `scicode_agent`, `stirrup_agent`, `verifiers_agent`, `swe_agents`, `mini_swe_agent`. Hermes and gymnasium previously applied the correlation prefix unconditionally. Harmless in practice (the model-server middleware strips it either way), but now the prefix appears only when `observability_enabled: true`, consistent across all harness styles. - New unit tests for the helpers: gate on/off, missing indices, fail-closed on unusable config, inbound-prefix propagation (including non-Starlette request objects), and default prefixed-route registration. - `gym dev test`: 1178 passed, 97.27% coverage (gate ≥96%); the only 2 failures are the pre-existing `test_opensandbox_provider.py` ones. - All touched agent suites pass: simple (6), non_executing_simple (4), tool_simulation (2), proof_refinement (2), critpt (15), cvdp (3), aviary (7), gymnasium (8, incl. a new gate-off test), mini_swe_agent_2 (22), claude_code (43), anyterminal (66). - Pre-existing failures verified unrelated by stashing: browsecomp's 3 `responses()` tests (Hydra parsing in `app.py:197`) and speed_bench's collection error (needs its per-server venv). hermes' suite requires `model_tools` locally; its correlation test exercises the responses-side path, which is behaviorally unchanged. - Docs: the correlation section of `model-call-capture.mdx` documents the helpers and the gating. Signed-off-by: Felipe Vieira Frujeri <[email protected]> Signed-off-by: Michal Bien <[email protected]>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Gives every agent a one-call way to correlate its model calls with a rollout for model-call capture, and wires the remaining url_path-style agent harnesses with it. Also addresses the PR #1715 review ask to collapse
apply_rollout_prefix(base_url, self.rollout_id_from_run(body))into a single function.Correlation is now gated on
observability_enabled: when capture is off, no agent emits/ng-rollout/<id>prefixes anywhere — URLs stay clean instead of carrying a prefix the model server strips and ignores.New helpers on
SimpleResponsesAPIAgenturl_path_for_run(url_path, body)— returns/ng-rollout/<id><url_path>when observability is enabled and the run body carries task/rollout indices; otherwiseurl_pathunchanged. Used for downstream calls made while handling/run(direct model calls or self-calls to/v1/responses).base_url_for_run(base_url, body)— the base-URL counterpart with identical gating, for SDK-style harnesses that configure a client once instead of prefixing each call. This is the one-function collapse requested in the feat(observability): add per-rollout model-call capture #1715 review.url_path_for_request(url_path, request)— for agents whose model calls happen insideresponses(): carries an inbound prefixed self-call's rollout id (from the request's path params) onto the outgoing model call.rollout_id_from_run(body)now applies the observability gate itself (fail-closed: no usable global config → uncorrelated, never an error). This is the single gate point, so the base-URL agents already wired on the parent branch (claude_code, anyterminal, mini_swe_agent_2) became gated with no changes to their code. It remains public because some flows need the bare id: claude_code and anyterminal thread it through layers that have no run body, and hermes'responses()derives it from path params./ng-rollout/{rollout_id}/v1/responsesis registered on every agent by the basesetup_webserver(), so agents no longer hand-register it (hermes' override removed).Agents wired
Model calls in these harnesses are now correlated (and therefore captured when observability is on):
simple_agent,non_executing_simple_agent,tool_simulation_agent(itsresponses()gained aRequestparameter),proof_refinement_agent,critpt_agent,cvdp_agent,speed_bench_agent,browsecomp_agent, andaviary_agent(itsresponses()receives the full run request in-process, so it usesurl_path_for_rundirectly on the model call).hermes_agentandgymnasium_agent(previously hand-rolledrollout_path_prefixf-strings, applied unconditionally — they now gate on observability like everyone else), andmini_swe_agent_2(the feat(observability): add per-rollout model-call capture #1715-flagged line is nowself.base_url_for_run(base_url, body)).The wiring pattern for the common shape (model calls inside
responses(),run()self-calls/v1/responses):run()prefixes the self-call viaurl_path_for_run, the base-registered prefixed route carries the id in, andresponses()re-applies it to the model call viaurl_path_for_request.Not wired here (bespoke model plumbing, each needs individual treatment):
harbor_agent,finance_agent,langgraph_agent,tau2,scicode_agent,stirrup_agent,verifiers_agent,swe_agents,mini_swe_agent.Behavior change
Hermes and gymnasium previously applied the correlation prefix unconditionally. Harmless in practice (the model-server middleware strips it either way), but now the prefix appears only when
observability_enabled: true, consistent across all harness styles.Testing
gym dev test: 1178 passed, 97.27% coverage (gate ≥96%); the only 2 failures are the pre-existingtest_opensandbox_provider.pyones.responses()tests (Hydra parsing inapp.py:197) and speed_bench's collection error (needs its per-server venv). hermes' suite requiresmodel_toolslocally; its correlation test exercises the responses-side path, which is behaviorally unchanged.model-call-capture.mdxdocuments the helpers and the gating.