[rollout] fix: prompt2text decoding for SingleTurnAgentLoop#5277
Open
jnash10 wants to merge 1 commit intoverl-project:mainfrom
Open
[rollout] fix: prompt2text decoding for SingleTurnAgentLoop#5277jnash10 wants to merge 1 commit intoverl-project:mainfrom
SingleTurnAgentLoop#5277jnash10 wants to merge 1 commit intoverl-project:mainfrom
Conversation
Fixes prompt IDs not being decoded in a single turn agent. Issue was the single agent loop lacked the `rollout_trace_op` decorator.
Contributor
There was a problem hiding this comment.
Code Review
This pull request correctly enables Weave tracing for SingleTurnAgentLoop by adding the @rollout_trace_op decorator to its run method. This change aligns its behavior with ToolAgentLoop and fixes the issue where prompt and response text were not being decoded in traces when token2text=True. The implementation is straightforward and correct. I have reviewed the changes and have not identified any issues.
4 tasks
Collaborator
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.
Fixes #5276
What does this PR do?
Fixes prompt IDs not being decoded for
SingleTurnAgentLoop. Issue was the single agent loop lacked therollout_trace_opdecorator.Patch: Add Weave Tracing to SingleTurnAgentLoop
Summary
Add
@rollout_trace_opdecorator toSingleTurnAgentLoop.run()to enable Weave tracing withtoken2textsupport.Problem
When using
SingleTurnAgentLoop(the default agent), Weave traces only showAsyncLLMServerManager.generatecalls. Thetoken2text=Trueoption doesn't addprompt_textandresponse_textfields to the trace output.This happens because
SingleTurnAgentLoop.run()lacks the@rollout_trace_opdecorator thatToolAgentLoop.run()has.@rollout_trace_op?ToolAgentLoop.runSingleTurnAgentLoop.runAsyncLLMServerManager.generateSolution
Add the
@rollout_trace_opdecorator toSingleTurnAgentLoop.run().File Changed
verl/experimental/agent_loop/single_turn_agent_loop.pyDiff
Why This Works
SingleTurnAgentLoop.run()already returnsAgentLoopOutputwith the required fields:prompt_ids(line 71)response_ids(line 72)The
add_token2textfunction inrollout_trace.pychecks for these exact fields. Once the method is decorated and traced,token2text=Truecorrectly addsprompt_textandresponse_textto the output.Result
After this patch:
SingleTurnAgentLoop.runappears as parent traces in Weave (matchingToolAgentLoopbehavior)token2text=Trueaddsprompt_textandresponse_textfieldsAsyncLLMServerManager.generateappears as nested child traces