0

RAG Agent — Agent Platform Vector Search

A starter RAG agent that answers questions grounded on documents indexed in Agent Platform Vector Search (Vector Search 2.0). A Kubeflow Pipelines (KFP) ingestion pipeline loads, chunks, and imports your documents into a Vector Search 2.0 Collection, where embeddings are auto-generated by the Co

Example · مثالpython

Content

RAG Agent — Agent Platform Vector Search

A starter RAG agent that answers questions grounded on documents indexed in Agent Platform Vector Search (Vector Search 2.0). A Kubeflow Pipelines (KFP) ingestion pipeline loads, chunks, and imports your documents into a Vector Search 2.0 Collection, where embeddings are auto-generated by the Collection's configured embedding model.

Agent Details

| Attribute | Detail | | :-- | :-- | | Interaction Type | Conversational | | Complexity | Intermediate | | Agent Type | Single Agent | | Components | Tools, RAG, Terraform, Evaluation, Ingestion Pipeline |

How it works

  • app/agent.py — ADK agent wiring the retrieve_docs tool.
  • app/retrievers.py — search_collection() runs semantic search against the Vector Search 2.0 Collection via vectorsearch_v1beta (or returns a mock when INTEGRATION_TEST=TRUE).
  • data_ingestion/ — a KFP pipeline (data_ingestion_pipeline/) that loads, chunks, and ingests documents into the Collection; run it with make data-ingestion.
  • infra/terraform/ — provisions the Vector Search 2.0 Collection (via scripts/setup_vector_search_collection.py) and a pipeline GCS bucket.

Setup

  1. cp .env.example .env and edit values.
  2. Provision the Collection: edit infra/terraform/vars/env.tfvars, then make setup-infra.
  3. Ingest documents into the Collection: make data-ingestion.

Run

make install && make playground

Select the app folder.

Test

make test runs the integration test. The retriever is mocked (INTEGRATION_TEST=TRUE), but the agent still makes a live Gemini call, so Google Cloud credentials (ADC) and Vertex AI access are required. Without credentials the test is skipped.

CI/CD

deployment/cloudbuild.yaml schedules the data-ingestion pipeline on Vertex AI Pipelines via the recipe's own submit_pipeline.py (it creates/updates a recurring PipelineJobSchedule with SCHEDULE_ONLY=TRUE; it does not run the pipeline inline). Wire it to a Cloud Build trigger, or run gcloud builds submit --config deployment/cloudbuild.yaml --substitutions=... (see the file header for the full substitution list). To deploy the agent itself, use the ADK-native path — e.g. uv run adk deploy cloud_run . or adk deploy agent_engine (not the deprecated agent-starter-pack tooling).

Looking for something else?

See [rag-agent-search](../rag-agent-search) for an Agent Platform Search (Discovery Engine) variant with a GCS data connector, or [multiformat-hybrid-rag](../../../contrib/python/multiformat-hybrid-rag) for a production hybrid (semantic + keyword) system.

Source and license

Source
Google ADK Samples
Original
google/adk-samples/core/python/rag-vector-search
License
Apache-2.0