Repository navigation
Conversation
With model-call capture on, a simple_agent episode run through an Environment Server (single_agent_turn, single_agent_turn_legacy) lost its executed tool records: the session kept only the trajectory's invocations and gaps, so the collected ng_trajectory had no tool_calls and ng_perf.num_tool_calls was 0, while /run reported them. The session now adds a ToolCallObservation for each executed tool call to the agent observations it returns at close. Rollout collection already merges these into ng_trajectory.tool_calls and rejoins each call's output from the invocation conversation. Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: yaoyu-33 <[email protected]>
Contributor
Author
|
/ok to test 2ef4896 |
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.
What changed and why
With model-call capture on, a
simple_agentepisode run through an Environment Server (environment_servers/single_agent_turn,single_agent_turn_legacy) lost its executed tool records. The same episode under/runreports them with status and timing.Why: a session caller sends the activation index, so the turn reply carries no trajectory. The session kept only
trajectory.invocationsandtrajectory.gapsinstate.observations. Close then returnedagent_observationswith no tool records. So the collectedng_trajectory.tool_callscame back empty andng_perf.num_tool_callswas 0.Fix (
responses_api_agents/simple_agent/app.py): each activation now also adds aToolCallObservationfor every executed tool call to the session'sAgentObservationBundle. This uses the existing observation contract._build_trajectory_recordinnemo_gym/rollout_collection.pyalready mergesToolCallObservationrecords intong_trajectory.tool_callsand rejoins each call's output from the invocation conversation, so the records dropoutput. Checkpoint export already carries the session's observations, so a restored session keeps its tool records too.This affects every config that #4953 moves from the
legacy_agentrelay tosingle_agent_turn_legacy. The data loss is opt-in, since capture is off by default, but it happens silently. This PR is independent of that stack and is based onmain.Issue: none filed. This was found while reviewing #4953.
Validation
test_a_session_reports_the_tools_the_agent_executed_as_run_does(environment_servers/single_agent_turn/tests/test_app.py). It runs the same tool-callingsimple_agentepisode, with capture on, through/runand throughSingleAgentTurnEnvironmentServerplus the legacy flat adapter, using a real agent app over ASGI. It then collects both results with_attach_trajectory_record/_build_ng_perf. It asserts that both give the tool record("root", "lookup", "completed", "42")andnum_tool_calls == 1. With the fix reverted, the session path gives([], 0).test_agent_session_uses_seeded_direct_http_tool_access[True]inresponses_api_agents/simple_agent/tests/test_app.py. It used to assert the session close carried only the invocation, which was the bug. It now also expects thetool_callobservation (name, status, no output).pytest environment_servers/single_agent_turn/tests: 106 passedpytest environment_servers/single_agent_turn_legacy/tests: 18 passedpytest responses_api_agents/simple_agent/tests: 77 passedpytest tests/unit_tests/test_rollout_collection.py tests/unit_tests/test_checkpoint_agent.py tests/unit_tests/test_harness_conformance_ci.py: 91 passed, 1 skippedpre-commit run --files <changed files>: passedRollout evidence
N/A. This changes observability metadata only: which agent observation records a session returns at close. It does not change agent, tool, or verifier behavior or the reward. The end-to-end test above exercises the real
simple_agentapp through the Environment Server.Compatibility
When capture is on,
ng_agent_observations.recordsfrom asimple_agentsession now includestool_callrecords. When capture is off, nothing changes.🤖 Generated with Claude Code