billyjacobson/simple-alloy-agent
This repository demonstrates how to build an AI agent that can interact with an AlloyDB database. It uses the Google Agent Development Kit (ADK) and the MCP Database Toolbox to enable natural language queries via a simple web interface.
AlloyDB MCP ADK Example
This example demonstrates how to interact with an AlloyDB database using AI Agents with the Model Context Protocol (MCP) Database Toolbox and Google Agent Development Kit (ADK).
Prerequisites
- Access to an AlloyDB instance on Google Cloud Platform
- Gemini API key for accessing Google AI models
- Python 3.10 or newer
- uv package manager
Setup
-
Synchronize dependencies using uv:
uv sync
-
Create the environment files:
cp .env.example .env cp alloydb_agent/.env.example alloydb_agent/.env
-
Edit the
.envfiles and fill in your credentials:- In the root
.envfile:- Fill in AlloyDB connection details (
ALLOYDB_PROJECT,ALLOYDB_REGION, etc.)
- Fill in AlloyDB connection details (
- In the
alloydb_agent/.envfile:- For Google AI API (default):
- Set
GOOGLE_API_KEYwith your Gemini API key
- Set
- OR for Vertex AI:
- See the ADK documentation for complete Vertex AI setup instructions
- For Google AI API (default):
- In the root
-
Source the environment variables:
source .env -
Download the MCP Toolbox for Databases
export OS="linux/amd64" # one of linux/amd64, darwin/arm64, darwin/amd64, or windows/amd64 curl -O https://storage.googleapis.com/genai-toolbox/v0.6.0/$OS/toolbox chmod +x toolbox
-
Start the MCP Toolbox with the provided tools configuration:
./toolbox --tools-file "alloy-tools.yaml" -
In a separate terminal, activate the virtual environment and start the ADK server:
source .venv/bin/activate adk webThe ADK web interface should now be available at http://localhost:8000, where you can interact with your AlloyDB database using natural language.
Disclaimer
This is example/demo code and may not be actively maintained or ready for production deployment. Use at your own risk.
