fix: do not propagate skipSummarization to parent EventActions in AgentTool#301
Open
nuthalapativarun wants to merge 3 commits into
Open
Conversation
…ntTool Setting toolContext.actions.skipSummarization in AgentTool.runAsync leaked the flag onto the tool-response event returned to the parent agent. Because isFinalResponse() treats skipSummarization as a terminal signal, the parent LlmAgent's run loop broke immediately after receiving the sub-agent's functionResponse, preventing any further generation pass (e.g. outputSchema JSON production). The sub-agent output is already returned verbatim from runAsync(), which is the intended effect of skipSummarization. Not propagating the flag to the parent's EventActions preserves correct parent loop behavior. Fixes google#288
9 tasks
Contributor
Author
|
Hi team, gentle ping on this one — happy to address any feedback or make adjustments if needed. Thanks for reviewing! |
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.
Please ensure you have read the contribution guide before creating a pull request.
Link to Issue or Description of Change
AgentTool({ skipSummarization: true })terminates the parentLlmAgentbeforeoutputSchemaoutput is produced #288Testing Plan
Unit Tests:
Manual End-to-End (E2E) Tests:
The bug is reproducible with the minimal repro from the issue: an
LlmAgentwith anAgentTool({ skipSummarization: true })and anoutputSchema. With the fix applied, the parent agent correctly continues its run loop after receiving the sub-agent'sfunctionResponseand produces the schema-constrained JSON output.Without the fix: the parent's last event is
fresp:<sub-agent>withskipSummarization: true, no further generation pass occurs, andoutputSchemaoutput is never produced.With the fix: the parent continues after
fresp, makes one more generation pass, and emits the structured JSON.Checklist
Additional context
Root cause:
AgentTool.runAsyncwas settingtoolContext.actions.skipSummarization = truewhenskipSummarizationconfig is set. BecausetoolContext.actionsis the parent agent's sharedEventActions, this flag leaked onto the tool-response event returned to the parent.isFinalResponse()treatsskipSummarizationas an unconditional terminal signal, so the parentLlmAgent's run loop broke immediately on seeing thefunctionResponseevent — before it could make any further generation pass.Fix: Remove the
toolContext.actions.skipSummarization = trueassignment fromAgentTool.runAsync. The sub-agent's output is already returned verbatim fromrunAsync()(themergedText/ parsed JSON path), which is the intended effect ofskipSummarization. The flag does not need to propagate to the parent'sEventActions.ExitLoopToolis unaffected: it sets bothescalateandskipSummarizationontoolContext.actions.LoopAgentusesescalateto exit its loop;isFinalResponse+skipSummarizationcauses the innerLlmAgentto break early without an extra model round-trip. That semantics is correct and intentional forExitLoopTool, and is not changed by this fix.