Add Kotlin tabs for grounding with Agent Search - #2160
Conversation
Both tab groups on the page showed Python and Java only, though VertexAiSearchTool has existed in adk-kotlin since v0.1.0. Kotlin uses the constructor directly rather than the builder the Java tab reaches for, since dataStoreId is a named parameter. The citation snippet collects from the event Flow instead of iterating a list, and reads isFinalResponse as a property. Both tabs are inline, matching their siblings: the snippets elide surrounding setup and carry placeholder datastore ids, so there is nothing here that could compile standalone.
✅ Deploy Preview for adk-docs-preview ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
The badge said Kotlin v0.8.0, the version adk-docs compiles against, rather than the introducing release. VertexAiSearchTool has been present since v0.1.0, matching the Python v0.1.0 and Java v0.1.0 badges already on this page.
|
|
||
| Before creating a grounded agent, you must have an existing Agent Search Data Store. If you don't have one, follow the instructions in [Get started with custom search](https://cloud.google.com/generative-ai-app-builder/docs/try-enterprise-search#unstructured-data) to create one. You will need your `Data store ID` (e.g., `projects/YOUR_PROJECT_ID/locations/global/collections/default_collection/dataStores/YOUR_DATASTORE_ID`) to configure the agent. | ||
|
|
||
| ## Authentication Setup |
There was a problem hiding this comment.
Lets maybe add Kotlin guidance here as well?
I think its the same as for Java.
It needs the GOOGLE_APPLICATION_CREDENTIALS and the environment variables that Python sets (GOOGLE_GENAI_USE_ENTERPRISE, GOOGLE_CLOUD_PROJECT, GOOGLE_CLOUD_LOCATION) just not in .env file but in the application environment (same as GOOGLE_APPLICATION_CREDENTIALS)
There was a problem hiding this comment.
looks like this is resolved for this page
REQUEST: Please add this Java / Kotlin tip to the Connect to Google Cloud page: https://adk.dev/get-started/google-cloud/
Kotlin reads the same Google Cloud credentials and env vars as Java from the application environment, so the auth bullet now names both. Also corrects the Kotlin support tag: VertexAiSearchTool landed in v0.2.0, not v0.1.0.
|
Added — Kotlin now shares the Java auth bullet. Also fixed the support tag: VertexAiSearchTool landed in v0.2.0. |
joefernandez
left a comment
There was a problem hiding this comment.
The two Kotlin tabs are clean additions. One flag on the prerequisites bullet, which changes existing Java guidance.
joefernandez
left a comment
There was a problem hiding this comment.
Approved.
Please see open comment for a follow-up PR for https://adk.dev/get-started/google-cloud/
What
Adds Kotlin to both tab groups on
docs/grounding/grounding_with_search.md— creating the grounded agent, and the optional citation display — plus theKotlin v0.1.0badge.Why
Both groups showed Python and Java only.
VertexAiSearchToolhas been in adk-kotlin since v0.1.0; this was missed because earlier coverage audits diffed release tags against each other and never checked the v0.1.0 baseline.Translation notes
VertexAiSearchTool.builder().dataStoreId(...).build(). Kotlin has named parameters, so the tab uses the constructor directly. The builder does exist at v0.8.0, but it is marked@AdkJavaInteropApiand exists for Java callers.collect, not a for-loop. Events arrive as aFlow<Event>in Kotlin, andisFinalResponseis a property rather than a method.groundingChunksis nullable, so the count is guarded withisNullOrEmpty()rather than Java'sisPresent().Verification
Both tabs are inline, matching their siblings — the snippets elide surrounding setup and carry placeholder datastore ids, so there is nothing that could compile standalone. They are covered by L0, which validates every import and named argument against the real v0.8.0 signatures, and not by the compiler. That is the same level of assurance the Python and Java tabs on this page have.
Ladder: L0, L3, L5, L6 PASS; L1/L2 PASS across the unchanged snippet tree; L4
runSnippetsSKIP (no such Gradle task in this repo).Tracked as KT-27.
Update: the badge originally read
Kotlin v0.8.0, which is the version adk-docs compiles against, not the release the feature shipped in. Corrected to the introducing version, matching the sibling badges and the rest of the site.