Skip to main content

Documentation Index

Fetch the complete documentation index at: https://mintlify.com/derailed-dash/gemini-file-search-demo/llms.txt

Use this file to discover all available pages before exploring further.

Before writing any agent code, you need a Google Cloud project, the demo repository, and a Gemini API key. This page walks you through each step. The setup takes around ten minutes and uses uv as the Python package manager — either via make install if you are on Linux, macOS, or WSL, or directly via uv sync on Windows.
1

Create a Google Cloud project

You need a Google Cloud project to run this codelab. You can use an existing project or create a new one.Make sure billing is enabled on your project. See the billing verification guide if you are unsure how to check the billing status.
Completing this codelab is not expected to cost more than a few pennies.
2

Clone the demo repo

Run the following commands from your terminal, or from the terminal integrated into Google Cloud Shell Editor. Cloud Shell is convenient because all required tools are pre-installed.
git clone https://github.com/derailed-dash/gemini-file-search-demo
cd gemini-file-search-demo
The repository has this structure:
gemini-file-search-demo/
├── app/
│   ├── basic_agent_adk/        # Agent with Google Search, using ADK framework
│   │   └── agent.py
│   ├── rag_agent_adk/          # Agent with Google Search and File Search, using ADK framework
│   │   ├── agent.py
│   │   └── tools_custom.py
│   ├── sdk_agent.py            # Agent using GenAI SDK (no ADK) with Google Search tool
│   └── sdk_rag_agent.py        # Agent using GenAI SDK (no ADK) with Gemini File Search tool
├── data/
│   └── story.md                # Sample story with "bespoke content" to use with Gemini File Search Store
├── notebooks/
│   └── file_search_store.ipynb # Jupyter notebook for creating and managing Gemini File Search Store

├── .env.template               # Template for environment variables - make a copy as .env
├── Makefile                    # Makefile for `make` commands
├── pyproject.toml              # Project configuration and dependencies
└── README.md                   # This file
Open the cloned folder in Cloud Shell Editor or your preferred editor before continuing.
3

Set up your development environment

Install the project dependencies using uv. The --extra jupyter flag includes the Jupyter kernel needed to run the notebook in a later step.
make install
make is available on Linux, macOS, and WSL. If you are on Windows without WSL, use the uv sync command directly.
make install also checks for uv and installs it automatically if it is not already present.
4

Create a Gemini API key

To use the Gemini Developer API — which is required for the Gemini File Search Tool — you need a Gemini API key.The easiest way to obtain one is through Google AI Studio, which provides a convenient interface for creating and managing API keys linked to your Google Cloud project. Follow the API key guide for the specific steps.Once your key is created, copy it and keep it somewhere safe. You will use it in the next step.
Do not commit your API key to version control. The .env file used below is already listed in .gitignore for the demo repo.
5

Configure your .env file

The repo includes an .env.template file. Copy it to a new file called .env:
cp .env.template .env
Open .env and replace your-api-key with your actual Gemini API key. The file should look like this:
.env
export GEMINI_API_KEY="your-api-key"
export MODEL="gemini-2.5-flash"
export STORE_NAME="demo-file-store"
The three variables configure the following:
VariableValuePurpose
GEMINI_API_KEYYour API key from Google AI StudioAuthenticates requests to the Gemini Developer API
MODELgemini-2.5-flashThe Gemini model used by all agents in this codelab
STORE_NAMEdemo-file-storeThe display name for your Gemini File Search Store
6

Source the .env file

Load the environment variables into your shell session:
source .env
Run this command in every new terminal session before running any of the agents or notebooks. You can verify the variables are set by running echo $GEMINI_API_KEY.
Your environment is now ready. Continue to the next section to build the baseline agent.

Build docs developers (and LLMs) love