Skip to content

perf(simple-agent): avoid duplicate verify conversion - #3048

Merged
ananthsub merged 2 commits into
NVIDIA-NeMo:mainfrom
ananthsub:ananthsub/perf-simple-agent-verify-payload
Sep 29, 2026
Merged

ananthsub merged 2 commits into
NVIDIA-NeMo:mainfrom
ananthsub:ananthsub/perf-simple-agent-verify-payload

Conversation

@ananthsub

@ananthsub ananthsub commented Sep 3, 2026 •

Copy link
Copy Markdown
Contributor

Summary

  • build the resources-server verification payload once from the validated run request and model response
  • remove a redundant agent-side validation and second full model dump before the resources-server trust boundary validates the request
  • prove that, for plain responses, the new payload matches the previous typed conversion, including rollout identity, metadata, extra fields, token data, and trajectory handling

Compatibility

The model server response now reaches /verify with its original JSON field names. The previous path re-dumped the response with Python field names, which turned a structured-output text.format.schema into schema_, and the verify endpoint rejected that with HTTP 422. Structured-output (json_schema) rollouts now verify correctly. A new test covers this case and checks that the verify request model accepts the payload.

Performance

An in-process benchmark alternated the previous dump -> validate -> dump path with the new dump -> merge path over nine repeats. Payload construction fell from 58.775 to 2.740 microseconds for a small response and from 6.985 milliseconds to 2.767 microseconds for a synthetic response containing 256 output messages. These numbers isolate verify-payload construction; HTTP encoding, transport, and resources-server validation remain unchanged.

Test plan

  • uv run --extra dev pytest -q responses_api_agents/simple_agent/tests/test_app.py
  • scoped pre-commit checks for changed files

Closes #3011.
Parent roadmap: #2998.

Send the already validated rollout and model response directly to the resources-server validation boundary.

Signed-off-by: Ananth Subramaniam <[email protected]>
@ananthsub
ananthsub force-pushed the ananthsub/perf-simple-agent-verify-payload branch from 78be99f to ee015fe Compare September 28, 2026 22:40
@nemo-automation-bot
nemo-automation-bot Bot requested a review from a team September 28, 2026 22:40
@ananthsub
ananthsub requested a review from HuiyingLi September 28, 2026 22:55
@github-actions github-actions Bot removed the sla:triage-overdue Review assignment is over the one-business-day SLA label Sep 28, 2026
Structured-output responses carry text.format.schema, which the previous
validate-then-dump path rewrote to schema_ and the verify endpoint rejected.

Signed-off-by: Ananth Subramaniam <[email protected]>

@yuhezhang-ai yuhezhang-ai 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.

The new alias-preservation regression test addresses my previous comment. No blocking findings in the reviewed commit, a2551fd.

Validated locally: all 20 simple-agent tests passed; Ruff lint and formatting checks passed. I also confirmed the new regression test fails against the original implementation. All required GitHub checks pass.

@ananthsub
ananthsub added this pull request to the merge queue Sep 29, 2026
@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/36616448497

Merged via the queue into NVIDIA-NeMo:main with commit e8d6d85 Sep 29, 2026
40 checks passed
@ananthsub
ananthsub deleted the ananthsub/perf-simple-agent-verify-payload branch September 29, 2026 19:15

This branch was previously deployed

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Build simple_agent verification payloads without duplicate dump and validation passes

2 participants