Repository navigation
Simple agent stop criteria requires no tool calls AND output message item to be present - #19
Merged
Merged
Conversation
Signed-off-by: Brian Yu <bxyu@nvidia.com>
Signed-off-by: Brian Yu <bxyu@nvidia.com>
abhibha-nvidia
pushed a commit
that referenced
this pull request
Sep 28, 2025
…item to be present (#19) Signed-off-by: Brian Yu <bxyu@nvidia.com> Signed-off-by: Abhibha Gupta <abhibhag@nvidia.com>
abhibha-nvidia
pushed a commit
that referenced
this pull request
Sep 29, 2025
…item to be present (#19) Signed-off-by: Brian Yu <bxyu@nvidia.com> Signed-off-by: Abhibha Gupta <abhibhag@nvidia.com>
abubakaria56
pushed a commit
to abubakaria56/Gym
that referenced
this pull request
Mar 2, 2026
…item to be present (NVIDIA-NeMo#19) Signed-off-by: Brian Yu <bxyu@nvidia.com>
abubakaria56
pushed a commit
to abubakaria56/Gym
that referenced
this pull request
Mar 2, 2026
…item to be present (NVIDIA-NeMo#19) Signed-off-by: Brian Yu <bxyu@nvidia.com>
7 tasks done
bxyu-nvidia
pushed a commit
that referenced
this pull request
Sep 18, 2026
## What does this PR do? Stop SimpleAgent and SimpleAgentWithCompaction when the latest model response has no tool calls, including reasoning-only and empty responses. Previously, an untruncated reasoning-only response triggered another assistant turn without any intervening user message or tool result. This could repeat until the context was exhausted. The agents now warn explicitly, mark the returned response and captured invocation incomplete, and preserve the model output and usage. Saved response metadata contains `ng_termination_reason` (`incomplete_reasoning` or `empty_output`) and `ng_termination_message` with the diagnosis. Existing metadata is preserved. Length truncation and content filtering retain their earlier `incomplete_details` handling; tool-call continuation and verifier-controlled rewards are unchanged. Revisits the continuation behavior introduced in #19. No separate issue is needed for this focused bug fix. ## Validation Rebased onto main at `64bf158da`. - Both agent suites: **68 passed**, including empty/reasoning-only termination, tool continuation, usage accumulation, and metadata persistence through `/run` with verification enabled or skipped and trajectory capture disabled. - `pre-commit run --all-files`: passed. - `git diff --check`: passed. - All commits have DCO sign-off. Tests used the existing Gym virtual environment with namespace imports explicitly bound to this worktree to avoid testing its original editable checkout: ```python import pathlib import responses_api_agents responses_api_agents.__path__ = [str(pathlib.Path.cwd() / "responses_api_agents")] import responses_api_agents.simple_agent.app import responses_api_agents.simple_agent_with_compaction.app import pytest raise SystemExit(pytest.main([ "responses_api_agents/simple_agent/tests", "responses_api_agents/simple_agent_with_compaction/tests", "-q", ])) ``` ## Rollouts A captured GPQA no-tools episode made 11 model calls and accumulated 284,835 output tokens. Its first response contained 6,218 output tokens, reasoning only, and no `incomplete_details`. Replaying that captured response through both patched agents stopped after one call, preserved the reasoning and usage, and marked the invocation incomplete. A fresh end-to-end GPQA smoke test completed successfully using this PR. - **8/8 rollouts complete**, no failed, missing, duplicate, or unscored rows. This is one GPQA question with eight repeats, not a full benchmark score. - Disabled the current GPQA one-step guard with `max_steps=0`, retained uncapped output/full 262,144-token context and the recipe's temperature 1 / top-p 0.95. - Provider response statistics: **8 `stop`, 0 `length`**. - **4 incomplete-reasoning responses**: each stopped after one model call, saved `status=incomplete` and `ng_termination_reason=incomplete_reasoning`, and received reward 0 from the normal MCQA verifier. - **4 normal answers**: each received reward 1. All eight trajectories had exactly one unique policy-model call; saved outputs and usage exactly matched their captured model response. - Directly reviewed five selected generations, including three flagged responses and two normal answers. Mean output tokens: 1,223. The 4/8 correctness result is only a smoke-test observation. ## Compatibility and benchmark impact No configuration migration. Intentional behavior change: reasoning-only or empty responses no longer receive extra assistant turns to recover. Scores and token totals can therefore differ from previous runs. Consumers can identify these terminations via `response.status` and `response.metadata`; they are not mislabeled as `max_output_tokens`. Rewards remain determined by the existing verifier. ## Checklist - [x] I have read the contributing guidelines. - [x] The change is focused; no unrelated edits. - [x] Tests added or updated and pass locally. - [x] Documentation N/A: no configuration changes; output contract and benchmark impact documented above. - [x] Pre-commit checks pass locally (`pre-commit run --all-files`). - [x] No new source files; existing SPDX headers preserved. - [x] All commits have DCO sign-off (`git commit -s`). --------- Signed-off-by: Igor Gitman <igitman@nvidia.com>
This branch was previously deployed
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.
No description provided.