Skip to content

fix: do not propagate skipSummarization to parent EventActions in AgentTool#301

Open
nuthalapativarun wants to merge 3 commits into
google:mainfrom
nuthalapativarun:fix/agent-tool-skip-summarization-terminates-parent
Open

fix: do not propagate skipSummarization to parent EventActions in AgentTool#301
nuthalapativarun wants to merge 3 commits into
google:mainfrom
nuthalapativarun:fix/agent-tool-skip-summarization-terminates-parent

Conversation

@nuthalapativarun
Copy link
Copy Markdown
Contributor

Please ensure you have read the contribution guide before creating a pull request.

Link to Issue or Description of Change

Testing Plan

Unit Tests:

  • I have added or updated unit tests for my change.
  • All unit tests pass locally.
Test Files  99 passed (99)
Tests  1082 passed (1082)

Manual End-to-End (E2E) Tests:

The bug is reproducible with the minimal repro from the issue: an LlmAgent with an AgentTool({ skipSummarization: true }) and an outputSchema. With the fix applied, the parent agent correctly continues its run loop after receiving the sub-agent's functionResponse and produces the schema-constrained JSON output.

Without the fix: the parent's last event is fresp:<sub-agent> with skipSummarization: true, no further generation pass occurs, and outputSchema output is never produced.

With the fix: the parent continues after fresp, makes one more generation pass, and emits the structured JSON.

Checklist

  • I have read the CONTRIBUTING.md document.
  • I have performed a self-review of my own code.
  • I have commented my code, particularly in hard-to-understand areas.
  • I have added tests that prove my fix is effective or that my feature works.
  • New and existing unit tests pass locally with my changes.
  • I have manually tested my changes end-to-end.
  • Any dependent changes have been merged and published in downstream modules.

Additional context

Root cause: AgentTool.runAsync was setting toolContext.actions.skipSummarization = true when skipSummarization config is set. Because toolContext.actions is the parent agent's shared EventActions, this flag leaked onto the tool-response event returned to the parent. isFinalResponse() treats skipSummarization as an unconditional terminal signal, so the parent LlmAgent's run loop broke immediately on seeing the functionResponse event — before it could make any further generation pass.

Fix: Remove the toolContext.actions.skipSummarization = true assignment from AgentTool.runAsync. The sub-agent's output is already returned verbatim from runAsync() (the mergedText / parsed JSON path), which is the intended effect of skipSummarization. The flag does not need to propagate to the parent's EventActions.

ExitLoopTool is unaffected: it sets both escalate and skipSummarization on toolContext.actions. LoopAgent uses escalate to exit its loop; isFinalResponse + skipSummarization causes the inner LlmAgent to break early without an extra model round-trip. That semantics is correct and intentional for ExitLoopTool, and is not changed by this fix.

…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
@nuthalapativarun
Copy link
Copy Markdown
Contributor Author

Hi team, gentle ping on this one — happy to address any feedback or make adjustments if needed. Thanks for reviewing!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

AgentTool({ skipSummarization: true }) terminates the parent LlmAgent before outputSchema output is produced

1 participant