Skip to content

fix(agent): keep observations from every SimpleAgent session activation - #4114

Merged
ananthsub merged 1 commit into
NVIDIA-NeMo:mainfrom
ananthsub:simple-agent-session-observations
Oct 6, 2026
Merged

ananthsub merged 1 commit into
NVIDIA-NeMo:mainfrom
ananthsub:simple-agent-session-observations

Conversation

@ananthsub

Copy link
Copy Markdown
Contributor

What does this PR do?

Makes a SimpleAgent agent session return the observations of every activation at close, not only the last one.

During a session, each /v1/responses call replaced state.observations with that call's invocation. An environment server that drives several activations through one session, such as the user simulation stack (#3800, #4080), would receive only the final activation's invocation at close, and ng_agent_observations would show one model call where there were several. single_agent_turn makes one call per session, so it was unaffected.

The fix:

  • Records and gaps now accumulate across a session's activations. The bundle is rebuilt each time, so its unique-ID and parent-graph checks still run.
  • Every activation used the invocation ID "root", so accumulating them would fail the bundle's unique-ID check. Later activations in a session now use activation-<n>. The first keeps "root", so single-activation sessions report exactly what they did before.

No issue is linked; this is a follow-up to #3784, found while reviewing the SimpleAgent changes in the user simulation stack.

Validation

  • New test test_agent_session_returns_observations_from_every_activation: two activations in one session return two invocations, root and activation-2, each linked to its own model response. It fails without the fix.
  • pytest responses_api_agents/simple_agent/tests environment_servers/single_agent_turn/tests environment_servers/single_agent_turn_legacy/tests: all pass.
  • pytest tests/unit_tests/test_rollout_collection.py tests/unit_tests/test_base_responses_api_agent.py tests/unit_tests/test_rollout_observability.py: all pass.
  • pre-commit run on the changed files: all pass.

Rollouts

N/A. Single-activation sessions, which every current configuration uses, produce the same observations as before. The change affects only sessions with several activations, which the user simulation environment server introduces; that stack carries its own rollout evidence.

Compatibility

No configuration change. For sessions with more than one activation, ng_agent_observations now contains one invocation per activation instead of only the last.

A SimpleAgent session replaced its stored observations on every /v1/responses
call, so closing the session returned only the last activation's invocation.
Environment servers that drive several activations through one session, such
as user simulation, lost the record of every earlier activation.

Accumulate records and gaps across activations. Every activation used the
invocation ID "root", which the bundle requires to be unique, so later
activations in a session use "activation-<n>". The first keeps "root", so
single-activation sessions report what they did before.

Signed-off-by: Ananth Subramaniam <[email protected]>
@nemo-automation-bot
nemo-automation-bot Bot requested review from a team October 6, 2026 17:18
@ananthsub
ananthsub requested a review from ffrujeri October 6, 2026 17:19
@ananthsub ananthsub added the r0.7.0 Auto-cherrypick to release branch. Apply before merge; cherrypick happens after merge. label Oct 6, 2026
@ananthsub
ananthsub added this pull request to the merge queue Oct 6, 2026
@github-actions

github-actions Bot commented Oct 6, 2026

Copy link
Copy Markdown
Contributor

🔄 Merge queue validation started! You can track the progress here: https://github.com/NVIDIA-NeMo/Gym/actions/runs/37514055561

Merged via the queue into NVIDIA-NeMo:main with commit a2dd5ba Oct 6, 2026
45 checks passed
@ananthsub
ananthsub deleted the simple-agent-session-observations branch October 6, 2026 18:59
ananthsub added a commit that referenced this pull request Oct 6, 2026
…ivation (4114)` into `r0.7.0` (#4123)

beep boop [🤖]: Hi @ananthsub 👋,

    we've cherry picked #4114 into  for you! 🚀

    Please review and approve this cherry pick by your convenience!

Signed-off-by: Ananth Subramaniam <[email protected]>
Signed-off-by: NeMo Bot <[email protected]>
Co-authored-by: Ananth Subramaniam <[email protected]>

This branch was previously deployed

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

Labels

r0.7.0 Auto-cherrypick to release branch. Apply before merge; cherrypick happens after merge.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants