Extend the compaction summarizer section to Kotlin - #2161
Open
happyhuman wants to merge 3 commits into
Open
Conversation
The Define a Summarizer group showed Python, Java and TypeScript but not Kotlin, and two lines of surrounding prose understated Kotlin as a result: one attributed LlmEventSummarizer to Python and Java only, the other said only Python and Java can customize the prompt template. Kotlin has had LlmEventSummarizer since v0.3.0 and exposes promptTemplate as a constructor parameter. This is partial coverage rather than an untouched page - the page is already Kotlin-badged and has a Kotlin tab for the token-threshold config. That tab is inline, as are all four siblings in this group, so the new tab is inline too rather than the new .kt file the backlog suggested; mixing forms between two Kotlin tabs on one page would be worse than either choice on its own.
✅ Deploy Preview for adk-docs-preview ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
wikaaaaa
approved these changes
Aug 24, 2026
|
|
||
| You can further refine the compactor by modifying its summarizer. In Python, Java | ||
| and Kotlin, customize the prompt template on `LlmEventSummarizer` — the property is | ||
| `prompt_template` in Python and Java, and `promptTemplate` in Kotlin. In TypeScript, |
Collaborator
There was a problem hiding this comment.
Its actually promptTemplate in Java as well - https://github.com/google/adk-java/blob/c1bda9c14dd16a46849dbd6e74773e5595c050b8/core/src/main/java/com/google/adk/summarizer/LlmEventSummarizer.java#L53
adk-java's LlmEventSummarizer exposes promptTemplate, not prompt_template; only Python uses the snake_case name.
Collaborator
Author
|
Good catch — fixed. Java uses |
joefernandez
approved these changes
Aug 28, 2026
joefernandez
left a comment
Collaborator
There was a problem hiding this comment.
Thanks for the updates!
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
docs/context/compaction.md.Why
The group showed Python, Java and TypeScript only, and the prose around it repeated the omission:
LlmEventSummarizer(Python/Java) orLlmSummarizer(TypeScript)"LlmEventSummarizerprompt_template"promptTemplateas a constructor parameterKotlin has had
LlmEventSummarizersince v0.3.0. This complements the earlier work that covered only the token-threshold config.Inline, not a new .kt file
The backlog row suggested creating
CompactionSummarizer.kt. I did not, deliberately:A reader switching between the two Kotlin tabs on one page should not see one transcluded and one inline. Both snippets also reference an undefined
rootAgent, exactly as their siblings do, so neither could compile standalone anyway.The cost is that this tab gets L0 rather than the compiler. L0 does validate every import and named argument against real v0.8.0 signatures — which is the failure mode that matters here — but it cannot see type mismatches.
LlmEventSummarizer(model: Model, promptTemplate: String)andEventsCompactionConfig(compactionInterval, overlapSize, summarizer, ...)were both read directly from the v0.8.0 tag.Verification
Ladder: L0, L3, L5, L6 PASS; L1/L2 PASS across the snippet tree; L4
runSnippetsSKIP (no such Gradle task in this repo).Tracked as KT-28.