Repository navigation
Conversation
Contributor
Author
|
/ok to test be98a71 |
This was referenced Nov 3, 2026
ffrujeri
force-pushed
the
ffrujeri/simple-agent-session-continuation
branch
from
November 4, 2026 21:33
be98a71 to
371e2bd
Compare
Contributor
Author
|
/ok to test 371e2bd |
Contributor
Author
|
/ok to test 456ad61 |
ffrujeri
force-pushed
the
ffrujeri/simple-agent-session-continuation
branch
from
November 11, 2026 04:05
456ad61 to
5af47df
Compare
Contributor
Author
|
/ok to test 5af47df |
Contributor
Author
|
/ok to test 9b88bd4 |
Contributor
Author
|
/ok to test 1e90e61 |
Contributor
Author
|
/ok to test b253632 |
Contributor
Author
|
/ok to test 8f00ca7 |
Contributor
Author
|
/ok to test e44aa46 |
Contributor
Author
|
/ok to test 6e8da1d |
Contributor
Author
|
/ok to test d9fdc6b |
Contributor
Author
|
/ok to test d9679b7 |
Contributor
|
🌿 Preview your docs: https://nvidia-preview-pr-5465-c3167e7029da.docs.buildwithfern.com/nemo/gym |
Contributor
Author
|
/ok to test e90cdbe |
Contributor
Author
|
/ok to test c725911 |
A user-simulation Environment Server activates the agent once for each turn of the conversation and sends only the new user message. Simple Agent now accepts a seed that asks for continuation: each activation runs the turn loop on the session's conversation plus its new input, and keeps the first activation's tools and instructions. - An activation without new input, or one that replaces the session's tools or instructions, gets 422. - A retried activation gets its reply without another model call. - The close returns the trajectory of every activation. - A continuation seed is refused when partial-rollout checkpoints are on, because a checkpoint exports no conversation history. Carried over from #5202, which prototyped it. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Signed-off-by: Felipe Vieira Frujeri <ffrujeri@nvidia.com>
…able and explicit Review fixes for simple_agent's continuation sessions: - Checkpointing: a continuation seed is accepted, and its reply carries CHECKPOINT_RESTART_HEADER, because a checkpoint does not export the conversation; the episode starts over after a restore. A session restored without its conversation refuses its next activation (409). - Opt-in: only a class that sets continuation_supported in its own body supports continuation, so DeepAgentsAgent, which replaces responses(), refuses a continuation seed again. - Settings: a later activation that changes any setting of the first (tool_choice, temperature, ...), not only tools or instructions, gets 422 instead of having it silently dropped. - Observations: a continuation session always collects the trajectory and timing its seed confirms, also without observability_enabled. A failed or cancelled activation adds a failed or incomplete invocation and an agent_activation_interrupted gap before it re-raises. Turns carry their activation_id. Each invocation keeps only its activation's new input and output, so the close payload grows linearly. - Model server: the session keeps the model server's cookies across activations, so it stays on one model-server session. - A test checks that a later activation resends the earlier turns' token IDs and log probabilities. max_steps still bounds each activation, as it bounds one /v1/responses call; the Environment Server bounds the activations. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Signed-off-by: Felipe Vieira Frujeri <ffrujeri@nvidia.com>
…base hook Main checks that no agent overrides seed_agent_session. Simple Agent now implements the base agent's _seed_restarts hook instead: under checkpointing, a checkpoint does not export a continuation session's conversation, so the seed reply marks the episode as a restart. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Signed-off-by: Felipe Vieira Frujeri <ffrujeri@nvidia.com>
A protocol whose turn ends at a submission, such as the BIRD-Interact ADK's c-Interact, must end the agent's activation without another model call. The ADK does it in a before-model callback; a Gym Environment Server sees only the tool calls, so it signals it on the reply. ToolResult.ends_activation sets X-NeMo-Gym-End-Activation: true on the direct HTTP reply. simple_agent runs the rest of the model response's tool calls and returns the activation without calling the model again. MCP has no field for it, so an MCP agent calls the model again. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Signed-off-by: Felipe Vieira Frujeri <ffrujeri@nvidia.com>
…ntinuation lost its conversation Main now requires every 409 session refusal in an agent to raise AgentSessionConflictError (#5691, enforced by tests/unit_tests/test_session_contract_repo.py). The continuation session's refusal after a restore raised a plain HTTPException(409); it keeps the same status and detail. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Signed-off-by: Felipe Vieira Frujeri <ffrujeri@nvidia.com>
Contributor
Author
|
/ok to test 94ff125 |
…ook, and document continuation A continuation activation called _create_episode directly, so a subclass whose task context lives in its session state (_create_session_episode) lost it from the first activation on. It now goes through the hook, as an activation without continuation does. The comment on the trajectory said the close payload grows linearly; each turn's question still holds the model-visible prefix, as in one activation. The continuation test now checks each activation's model route and metadata. integrate-existing-agents.mdx describes simple_agent's continuation, and multi-step-tasks.mdx says which harness can continue in a lent sandbox. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Signed-off-by: Felipe Vieira Frujeri <ffrujeri@nvidia.com>
Contributor
Author
|
/ok to test c3167e7 |
This branch had an error being 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.
On
main(theBaseEnvironmentServerWithToolsstack, #5346 → #5917, has merged). This is the first PR of the BIRD-Interact stack: this PR → #5409 (BIRD-Interact). Its diff issimple_agent, plus a smallnemo_gym/server_runtimechange that lets a tool reply end the agent's activation (second section below).What changed
simple_agentaccepts a seed that asks for continuation (AgentSeedSessionRequest.continuation). Each activation of the session then runs the turn loop on the session's conversation plus its new input, and keeps the first activation's tools and instructions.tools,instructions,tool_choice,temperature, ...), gets 422; onlyinputandmetadatachange per activation.observability_enabled, because the seed confirms it. Turns and invocations carry theiractivation_id. Each invocation keeps only its activation's new input and output; each turn's question still holds the model-visible prefix, as in one activation. A failed or cancelled activation adds afailedorincompleteinvocation and anagent_activation_interruptedgap.continuation_supportedin its own body supports continuation, so a subclass that replaces the turn loop, such asDeepAgentsAgent, refuses a continuation seed.max_stepsbounds each activation; the Environment Server bounds the activations.CHECKPOINT_RESTART_HEADER(now exported fromnemo_gym.server_runtime): a checkpoint exports no conversation, so the episode starts over after a restore. A session restored without its conversation refuses its next activation withAgentSessionConflictError(409), as main's session contract requires since refactor(sessions): raise the session conflict errors for every 409 refusal #5691.A tool reply can end the activation
ToolResult.ends_activation(nemo_gym/server_runtime/episode_tools.py): aBaseEnvironmentServerWithToolstool marks its reply as the end of the agent's activation. Over direct HTTP the reply carriesX-NeMo-Gym-End-Activation: true(END_ACTIVATION_HEADER, next toTOOL_ERROR_HEADER). MCP has no field for it, so an MCP agent calls the model again; the Fern MCP guide says so.simple_agentruns the rest of the model response's tool calls and returns the activation without calling the model again.Why
An Environment Server that simulates the user activates the agent once for each turn and sends only the new user message. BIRD-Interact's c-Interact (#5409) needs it: each user reply is a new activation of the same session. #5202 prototyped it. Tracking: GYMINT-646 (Linear).
The BIRD-Interact ADK ends the agent's run right after
submit_sql: itsbefore_model_callbackanswers the next model call itself. An Environment Server sees only tool calls, so without a signalsimple_agentmade one more model call per turn, which the ADK does not. Rewards were the same, but token counts and trajectories were not, and both are compared with auto-ontology-eval and used for training. #5478 uses the signal.Validation
pytest responses_api_agents/simple_agent/tests/test_app.py tests/unit_tests/test_agent_sessions.pypytest responses_api_agents/simple_agent/tests(review fixes)prompt_token_ids,generation_token_idsandgeneration_log_probsagentic_turn_simulation_agentandlabbench2_vlm_agenttests (SimpleAgentsubclasses)pytest tests/unit_tests/server_runtime(after addingends_activation)ends_activationcarries the header, a call that never ran does notpytest responses_api_agents/simple_agent/tests(after addingends_activation)pre-commit run --fileson the changed filesRollout evidence
The c-Interact smoke run in #5409 uses this continuation: 10 rollouts with
simple_agent, none failed. That run is from before the rebase onto main atdda609f86and the split into two stacks, which changed no behavior here.For
ends_activation: the BIRD-Interact server's five example tasks in c-Interact (SQLite, Docker sandboxes, with #5478's use of the signal), before and after. Before, every turn made one model call aftersubmit_sql: 8 extra calls over 8 turns. After, none: each turn made exactly one model call fewer, and all 5 episodes completed. Details in #5478.Compatibility
Opt-in through the seed. An agent seeded without
continuationbehaves as before.ends_activationdefaults toFalse, so other tools' replies do not change; an agent that ignores the header calls the model again, as before.SimpleAgentsubclasses no longer accept continuation seeds unless they setcontinuation_supported.Team review fixes (2026-11-19)
A team review (the repository's
review-pr-teamskill) found notes only. Fixed in c3167e7:_create_session_episode, as an activation without continuation does, so a subclass's task context applies on every activation (new test).integrate-existing-agents.mdxdescribessimple_agent's continuation;multi-step-tasks.mdxsays which harness can continue in a lent sandbox.Not changed: #6162 adds the same
model_server_cookiesfield with another type; whichever lands second reconciles them.