Skip to content

Add Kotlin safety settings and includeContents to the agent docs - #2158

Open
happyhuman wants to merge 2 commits into
mainfrom
docs-kotlin-safety-settings
Open

Add Kotlin safety settings and includeContents to the agent docs#2158
happyhuman wants to merge 2 commits into
mainfrom
docs-kotlin-safety-settings

Conversation

@happyhuman

Copy link
Copy Markdown
Collaborator

What

Three related Kotlin parity gaps, all resting on the same three types (SafetySetting, HarmCategory, HarmBlockThreshold), so they are fixed together:

Page Gap
docs/safety/index.md No Kotlin tab in the built-in Gemini safety section, and no Kotlin in the badge div
docs/agents/llm-agents.md (gen_config) Kotlin tab existed but set only temperature and maxOutputTokens; the Python sibling also sets safety settings
docs/agents/llm-agents.md (include_contents) No Kotlin tab

None of this is new API — safety settings landed in adk-kotlin 0.5.0, includeContents has been on LlmAgent since 0.1.0.

The gap class worth noting

The gen_config case is a Kotlin tab that exists but under-shows the feature. A "missing Kotlin tab" scan cannot see it, and neither can a symbol diff, since every symbol the tab names is present. Only comparing a tab's contents against its siblings surfaces it.

Review notes

  • The safety page tab is inline, not a transclusion. Its siblings are inline, and like them the snippet elides the required name and model arguments, so there is nothing there that could compile standalone. It is covered by L0 (imports and named arguments checked against real v0.8.0 signatures) but not by the compiler — the same level of assurance the Python and Go tabs on that page get.
  • gen_config now shows more than the TypeScript and Java tabs do. Those two also omit safety settings. This PR brings Kotlin to parity with Python, the semantic source for the group, and deliberately does not touch sibling-language tabs. The TS/Java gap is left as-is.
  • The safety page badge div carries no version numbers for any language, so the Kotlin span follows suit and reads just Kotlin.

⚠️ Conflicts with #2151

Both branches modify examples/kotlin/snippets/agents/llm-agent/CapitalAgent.kt, and #2151 inserts its schema_example region at the same anchor this one inserts include_contents — immediately after [end:gen_config]. The import blocks also overlap. Both sides are pure additions, so the resolution is mechanical, but please land #2151 first and let me rebase, rather than merging this one on top blind.

Verification

Grounded against the v0.8.0 git tag. Full ladder green (L0, L1 compile with KSP, L2 ktlint, L3, L5, L6). L4 runSnippets reports SKIP — no such Gradle task exists in this repo.

Tracked as KT-25, KT-32 and KT-36.

Three related parity gaps, all on the same two types.

docs/safety/index.md had no Kotlin tab at all in the built-in Gemini
safety section. docs/agents/llm-agents.md had a Kotlin tab for
generateContentConfig that set only temperature and maxOutputTokens
while its Python sibling also set safety settings, and no Kotlin tab at
all for includeContents. None of these are new API: safety settings
landed in adk-kotlin 0.5.0 and includeContents has been on LlmAgent
since 0.1.0.

The under-showing tab is the interesting case. A missing-tab scan cannot
see it and neither can a symbol diff, because the tab exists and every
symbol it names is present - only comparing a tab's contents against its
siblings reveals it.

The safety page tab is inline because its siblings are, and because the
snippet elides the required name and model parameters the same way they
do, so there is nothing there that could compile on its own.
@netlify

netlify Bot commented Aug 20, 2026

Copy link
Copy Markdown

Deploy Preview for adk-docs-preview ready!

Name Link
🔨 Latest commit 13ed489
🔍 Latest deploy log https://app.netlify.com/projects/adk-docs-preview/deploys/6a874637fb4ed100082ada5a
😎 Deploy Preview https://deploy-preview-2158--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.

@happyhuman happyhuman assigned happyhuman and unassigned happyhuman Aug 20, 2026
Adding the Kotlin tab accidentally reindented a line inside the Go
sample, which mixes tabs and spaces. The Go tab is a sibling and should
not appear in this diff at all; the page's only non-additive change is
now the badge line.
@happyhuman

Copy link
Copy Markdown
Collaborator Author

Update: pushed a follow-up commit restoring the Go tab's indentation on docs/safety/index.md. Adding the Kotlin tab had accidentally reindented one line inside the Go sample (that file mixes tabs and spaces). The Go tab is a sibling and should not appear in this diff at all — the page's only non-additive change is now the badge line.

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