diff --git a/docs/grounding/grounding_with_search.md b/docs/grounding/grounding_with_search.md
index cea516bc33..552aa6b9a9 100644
--- a/docs/grounding/grounding_with_search.md
+++ b/docs/grounding/grounding_with_search.md
@@ -1,7 +1,7 @@
# Grounding with Search for agents
- Supported in ADKPython v0.1.0Java v0.1.0
+ Supported in ADKPython v0.1.0Java v0.1.0Kotlin v0.1.0
[Agent Search](/integrations/agent-search/) is a powerful tool for the Agent Development Kit (ADK) that enables AI agents to access information from your private enterprise documents and data repositories. By connecting your agents to indexed enterprise content, you can provide users with answers grounded in your organization's knowledge base.
@@ -70,6 +70,32 @@ To enable Grounding with Search, you include the search tool in your agent defin
.build();
```
+=== "Kotlin"
+
+ ```kotlin
+ import com.google.adk.kt.agents.Instruction
+ import com.google.adk.kt.agents.LlmAgent
+ import com.google.adk.kt.models.Gemini
+ import com.google.adk.kt.tools.VertexAiSearchTool
+
+ // Configuration
+ val DATASTORE_ID =
+ "projects/YOUR_PROJECT_ID/locations/global/collections/default_collection/dataStores/YOUR_DATASTORE_ID"
+
+ val rootAgent =
+ LlmAgent(
+ name = "vertex_search_agent",
+ model = Gemini(name = "gemini-flash-latest"),
+ instruction =
+ Instruction(
+ "Answer questions using Agent Search to find information from internal " +
+ "documents. Always cite sources when available.",
+ ),
+ description = "Enterprise document search assistant with Agent Search capabilities",
+ tools = listOf(VertexAiSearchTool(dataStoreId = DATASTORE_ID)),
+ )
+ ```
+
## How Grounding with Search works
Grounding with Search is the process that connects your agent to your organization's indexed documents and data, allowing it to generate accurate responses based on private enterprise content. When a user's prompt requires information from your internal knowledge base, the agent's underlying LLM intelligently decides to invoke the `VertexAiSearchTool` to find relevant facts from your indexed documents.
@@ -196,6 +222,22 @@ Since grounding metadata is provided, you can choose to implement citation displ
}
```
+=== "Kotlin"
+
+ ```kotlin
+ events.collect { event ->
+ if (event.isFinalResponse) {
+ println(event.content?.parts?.firstOrNull()?.text)
+
+ // Optional: Show source count
+ val chunks = event.groundingMetadata?.groundingChunks
+ if (!chunks.isNullOrEmpty()) {
+ println("\nBased on ${chunks.size} documents")
+ }
+ }
+ }
+ ```
+
**Enhanced Citation Display (Optional):** You can implement interactive citations that show which documents support each statement. The grounding metadata provides all necessary information to map text segments to source documents.
### Implementation Considerations