Enterprise-grade search integration with ADK - Build agents that search across websites, documents, and structured data.
Blog Post: https://arjunprabhulal.com/adk-builtin-tools-vertex-search/
- What is Vertex AI Search?
- RAG vs Search: When to Use Which
- Prerequisites
- Google Cloud Setup
- Create a Data Store
- Setup Steps
- Running the Agent
- Project Structure
- Next Steps
Vertex AI Search (formerly Enterprise Search) provides Google-quality search for your data:
┌─────────────────────────────────────────────────────────────┐
│ DATA SOURCES │
│ │
│ ┌──────────┐ ┌──────────┐ ┌──────────┐ ┌──────────┐ │
│ │ Websites │ │ PDFs │ │ BigQuery │ │Cloud │ │
│ │ │ │ │ │ Tables │ │Storage │ │
│ └──────────┘ └──────────┘ └──────────┘ └──────────┘ │
└─────────────────────────────────────────────────────────────┘
│
▼
┌─────────────────────────────────────────────────────────────┐
│ VERTEX AI SEARCH │
│ │
│ • Automatic indexing and ranking │
│ • Semantic understanding │
│ • Multi-modal search (text, images) │
│ • Extractive answers with citations │
└─────────────────────────────────────────────────────────────┘
│
▼
┌─────────────────────────────────────────────────────────────┐
│ ADK AGENT │
│ │
│ Uses VertexAiSearchTool to query and synthesize results │
└─────────────────────────────────────────────────────────────┘
| Feature | Vertex AI RAG | Vertex AI Search |
|---|---|---|
| Best For | Q&A over documents | Enterprise search portals |
| Data Size | Smaller corpora | Large-scale data |
| Updates | Manual re-indexing | Automatic crawling |
| Sources | Uploaded files | Websites, GCS, BigQuery |
| Output | Generated answers | Search results + snippets |
Use RAG when: You need precise answers from a curated document set.
Use Search when: You need to search across websites, large document collections, or structured data.
- Python 3.10+
- Google Cloud Project with billing enabled
gcloudCLI installed and authenticated- Data to index (website URL, GCS bucket, or documents)
gcloud services enable aiplatform.googleapis.com
gcloud services enable discoveryengine.googleapis.com# Replace with your project ID and email
PROJECT_ID="your-project-id"
USER_EMAIL="your-email@example.com"
# Vertex AI User
gcloud projects add-iam-policy-binding $PROJECT_ID \
--member="user:$USER_EMAIL" \
--role="roles/aiplatform.user"
# Discovery Engine Viewer (or Editor to create data stores)
gcloud projects add-iam-policy-binding $PROJECT_ID \
--member="user:$USER_EMAIL" \
--role="roles/discoveryengine.viewer"gcloud auth application-default login- Go to Agent Builder Console
- Click Create App → Select Search
- Choose your data source type:
- Website: Enter URLs to crawl
- Cloud Storage: Select GCS bucket
- BigQuery: Choose dataset
- Unstructured Documents: Upload files
- Configure indexing settings
- Note the Data Store ID from the console
projects/PROJECT_ID/locations/global/collections/default_collection/dataStores/DATASTORE_ID
Example:
projects/my-project/locations/global/collections/default_collection/dataStores/my-docs-store_1234567890
- Navigate to this module:
cd 09-vertex-ai-search- Create and activate a virtual environment:
python -m venv .venv
source .venv/bin/activate # On Windows: .venv\Scripts\activate- Install dependencies:
pip install -r ../requirements.txt- Configure environment variables in
vertex_search_agent/.env:
GOOGLE_GENAI_USE_VERTEXAI=1
GOOGLE_CLOUD_PROJECT=your-project-id
GOOGLE_CLOUD_LOCATION=us-central1
DATA_STORE_ID=projects/your-project-id/locations/global/collections/default_collection/dataStores/your-datastore-id
Replace your-project-id and your-datastore-id with your actual values.
adk webOpen http://127.0.0.1:8000 and select vertex_search_agent.
Test Queries:
- "Search for [topic in your data store]"
- "Find documents about [subject]"
- "What information do you have on [query]?"
adk run vertex_search_agent09-vertex-ai-search/
├── README.md
└── vertex_search_agent/
├── __init__.py
├── agent.py # Search agent with VertexAiSearchTool
└── .env # Vertex AI configuration
| Feature | Description |
|---|---|
| Semantic Search | Understands meaning, not just keywords |
| Extractive Answers | Highlights exact passages that answer queries |
| Citations | Links back to source documents |
| Multi-turn | Supports follow-up questions |
| Filters | Filter by metadata, date, etc. |
Continue to 10. Custom Function Tools