Skip to content

feat: add OpenAI Responses API route#2072

Draft
maxpetrusenkoagent wants to merge 2 commits into
NVIDIA:developfrom
maxpetrusenkoagent:hermes/oss-pr-2026-06-14-nemo-agent-toolkit-1278
Draft

feat: add OpenAI Responses API route#2072
maxpetrusenkoagent wants to merge 2 commits into
NVIDIA:developfrom
maxpetrusenkoagent:hermes/oss-pr-2026-06-14-nemo-agent-toolkit-1278

Conversation

@maxpetrusenkoagent

Copy link
Copy Markdown

Summary

  • add a Responses API request model that maps Responses payloads onto the existing chat workflow contract
  • register /v1/responses-compatible routing when openai_api_v1_path ends with /responses
  • return Responses API-shaped non-streaming responses and SSE lifecycle events for streaming responses

Fixes #1278

Verification

  • uv run --extra test --extra async_endpoints pytest packages/nvidia_nat_core/tests/nat/front_ends/fastapi/test_openai_compatibility.py -q
  • uv run --extra test --extra async_endpoints ruff check packages/nvidia_nat_core/src/nat/data_models/api_server.py packages/nvidia_nat_core/src/nat/front_ends/fastapi/routes/chat.py packages/nvidia_nat_core/src/nat/front_ends/fastapi/routes/v1_responses.py packages/nvidia_nat_core/tests/nat/front_ends/fastapi/test_openai_compatibility.py

@copy-pr-bot

copy-pr-bot Bot commented Jun 14, 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.

@coderabbitai

coderabbitai Bot commented Jun 14, 2026

Copy link
Copy Markdown

Important

Review skipped

Draft detected.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Enterprise

Run ID: a375f250-4a23-432e-b76a-526922170b07

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Comment @coderabbitai help to get the list of available commands and usage tips.

@maxpetrusenkoagent maxpetrusenkoagent force-pushed the hermes/oss-pr-2026-06-14-nemo-agent-toolkit-1278 branch from 1ed1def to 2036232 Compare June 14, 2026 20:38
@maxpetrusenkoagent

Copy link
Copy Markdown
Author

Review-fix sweep update:

Summary:

  • Added DCO sign-off to the PR commit.
  • Fixed Responses API structured input conversion so untyped message items preserve content.
  • Preserved structured message roles when converting Responses API input into the existing ChatRequest workflow contract.
  • Added regression coverage for both cases.

Verification:

  • uv run --extra test --extra async_endpoints pytest packages/nvidia_nat_core/tests/nat/front_ends/fastapi/test_openai_compatibility.py::test_responses_request_preserves_structured_message_roles packages/nvidia_nat_core/tests/nat/front_ends/fastapi/test_openai_compatibility.py::test_responses_request_converts_untyped_message_input_to_chat_request packages/nvidia_nat_core/tests/nat/front_ends/fastapi/test_openai_compatibility.py::test_responses_request_converts_to_chat_request -q -> 3 passed
  • uv run --extra test --extra async_endpoints pytest packages/nvidia_nat_core/tests/nat/front_ends/fastapi/test_openai_compatibility.py -q -> 17 passed
  • uv run --extra test --extra async_endpoints ruff check packages/nvidia_nat_core/src/nat/data_models/api_server.py packages/nvidia_nat_core/src/nat/front_ends/fastapi/routes/chat.py packages/nvidia_nat_core/src/nat/front_ends/fastapi/routes/v1_responses.py packages/nvidia_nat_core/tests/nat/front_ends/fastapi/test_openai_compatibility.py -> All checks passed
  • Independent final autoreview on the exact updated diff -> no blocking findings

Remaining blocker I could not clear from the contributor account:

  • Label Checker reports missing category/breaking labels. I attempted to add Feature and non-breaking, but GitHub returned: maxpetrusenkoagent does not have the correct permissions to execute AddLabelsToLabelable.

Confidence: high on the code/check fixes. Label checker needs a maintainer/vetter to apply the required labels.

@maxpetrusenkoagent

Copy link
Copy Markdown
Author

Review-fix sweep found no actionable code blockers from the contributor side.

Current blockers appear repository-maintainer gated:

  • Label Checker: missing category/breaking labels. I retried adding Feature + non-breaking; GitHub returned maxpetrusenkoagent does not have the correct permissions to execute AddLabelsToLabelable.
  • PR remains draft / review-required, with no maintainer review yet.

No new code changes made in this sweep.

@maxpetrusenkoagent

Copy link
Copy Markdown
Author

Review-Fix Summary

Applied 3 targeted fixes to the OpenAI Responses API route (v1_responses.py, chat.py):

Fix Change Files
Interactive extension flag enable_interactive threaded through add_v1_responses_routepost_responses_api_endpoint_responses_stream call chain v1_responses.py, chat.py
Status code WORKFLOW_ERROR handler now returns 500 (server error) instead of 422 (input validation failure) — matches OpenAI API contract and the RESPONSE_500 status already registered on the route v1_responses.py
Formatting StreamingResponse call re-wrapped to pass ruff E501 (line-length) v1_responses.py

Pre-existing safe code confirmed (no changes needed):

  • response.choices guard at v1_responses.py:73 — already present
  • output_item/content_part initialized before the stream loop — already present

Verification

  • Tests: pytest test_openai_compatibility.py19/19 passed
  • Lint: ruff check on all touched files — All checks passed

Second-Agent Review (hermes chat -Q / MiniMax-M2.7)

Verdict: CLEAN (1 minor non-blocking note)

Minor note (non-blocking): MCPOAuth2ProviderConfig.preflight_auth: Literal[False] type override from base bool — code smell, MCP auth path no-ops regardless, no functional breakage.

No blocking findings. The type mismatch in MCPOAuth2ProviderConfig.preflight_auth is a code-smell but does not cause functional breakage in practice, as the MCP authenticate() path will no-op regardless. The Responses API, preflight auth, and list-content flatten changes are all properly implemented with reasonable test coverage.


Confidence: High. All blocking findings from the prior review are resolved. Tests pass, lint clean, second-agent confirms CLEAN.

Signed-off-by: maxpetrusenkoagent <max.petrusenko.agent@gmail.com>
- Pass enable_interactive through add_v1_responses_route chain to
  post_responses_api_endpoint and _responses_stream (fixes interactive
  extension flag regression)
- Change WORKFLOW_ERROR status_code from 422 to 500 to match OpenAI
  API contract (server error, not input validation failure)
- Minor formatting fix: re-wrap StreamingResponse call to pass ruff
  E501 line-length check

Signed-off-by: maxpetrusenkoagent <max.petrusenko.agent@gmail.com>
@maxpetrusenkoagent maxpetrusenkoagent force-pushed the hermes/oss-pr-2026-06-14-nemo-agent-toolkit-1278 branch from 4aab349 to fa75198 Compare June 19, 2026 18:01
@maxpetrusenko

Copy link
Copy Markdown

Label Checker is failing because this PR is missing category and breaking-change labels. Suggested labels for this change: feature request and non-breaking.

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.

OpenAI Responses API support is needed in NAT server

2 participants