Skip to content

docs(context): add Go examples to the compaction page - #2202

Open
baptmont wants to merge 1 commit into
google:mainfrom
baptmont:baptmont/compaction-go-examples
Open

docs(context): add Go examples to the compaction page#2202
baptmont wants to merge 1 commit into
google:mainfrom
baptmont:baptmont/compaction-go-examples

Conversation

@baptmont

@baptmont baptmont commented Sep 4, 2026

Copy link
Copy Markdown
Collaborator

The two tabbed sections on Context compactionConfigure context compaction and Define a Summarizer — offer Python, Java, TypeScript and Kotlin but no Go, so a Go reader has nothing to copy.

Both new tabs are translations of the existing examples, kept to the same length rather than expanded.

One structural difference is worth the inline comment in the sample: Go has no App object, so compaction is configured on the runner via runner.Config.Compaction.

Two things a reviewer may want to check deliberately:

  • Both snippets were compiled against google.golang.org/adk/v2 v2.3.0 before being pasted in, so the field names and the NewLLMSummarizer signature are real rather than reconstructed.
  • The import path is the v2 one. Compaction only exists in ADK Go v2, so google.golang.org/adk/v2/... is required for the example to work. Every other Go example on the site still uses the v1 path (google.golang.org/adk/...), so this is intentionally inconsistent with its neighbours. Worth knowing in case the site's Go examples are due a v2 pass more broadly.

The prose named the languages explicitly in three places, so each now mentions Go too — including the Go spelling of the prompt-template setting (PromptTemplate on LLMSummarizerConfig) and the fact that it must contain the {conversation_history} placeholder, which is easy to miss and silently drops the whole conversation from the prompt if omitted.

Rendering was checked with the site's own pymdownx.tabbed / pymdownx.superfences extensions: all five tabs render in both sections.

The two tabbed sections on the context compaction page offered Python, Java,
TypeScript and Kotlin but no Go, so a Go reader had nothing to copy.

Both examples are translations of the existing ones rather than new material,
kept to the same length. The one structural difference worth a comment in the
sample: Go has no App object, so compaction is configured on the runner.

Both snippets were compiled against google.golang.org/adk/v2 v2.3.0 before being
pasted in. The import path is the v2 one because compaction exists only in v2;
the Go examples elsewhere on the site still use the v1 path.

The surrounding prose named the languages explicitly in three places, so each
now mentions Go as well, including the Go spelling of the prompt-template
setting and its placeholder requirement.
@netlify

netlify Bot commented Sep 4, 2026

Copy link
Copy Markdown

Deploy Preview for adk-docs-preview ready!

Name Link
🔨 Latest commit f83053d
🔍 Latest deploy log https://app.netlify.com/projects/adk-docs-preview/deploys/6a9a87ef4003a100086e2519
😎 Deploy Preview https://deploy-preview-2202--adk-docs-preview.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.
🤖 Make changes Run an agent on this branch

To edit notification comments on pull requests, go to your Netlify project configuration.

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.

1 participant