DEV Community

Cover image for Building Your First AI Agent Locally: A Practical Guide to Google ADK with Antigravity IDE
Shadrack Inusah
Shadrack Inusah

Posted on

Building Your First AI Agent Locally: A Practical Guide to Google ADK with Antigravity IDE

Introduction

Building AI agents has traditionally required cloud infrastructure and credits, which can be a barrier for students and developers just getting started. But what if you could build, test, and run intelligent AI agents entirely on your local machine, for free?

In this guide, I'll walk you through creating your first AI agent using the Google Agent Development Kit (ADK) and Antigravity IDE, no cloud credits required. Plus, once you're ready, you can deploy to Google Cloud with minimal changes.

Whether you're exploring AI development for the first time, or building a proof-of-concept, this hands-on tutorial will get you up and running in under 30 minutes.

What is the Google Agent Development Kit (ADK)?

The Google Agent Development Kit is an open-source, Python-first framework for building reliable AI agents at scale. Think of it as a structured way to:

  • Define agent instructions and behavior
  • Attach tools and integrations
  • Switch between different LLM backends (Gemini, Vertex AI)
  • Test and debug locally before deploying

Key Advantages
✅ No vendor lock-in – Code-first, framework-agnostic design
✅ Local-first development – Test everything on your machine
✅ Built-in tooling – CLI and Web UI included
✅ Easy deployment – Ship to Cloud Run, App Engine, or Kubernetes when ready

Prerequisites
Before we start, make sure you have:

  • Python 3.10+ installed on your system
  • A text editor or IDE (we'll use Antigravity IDE)
  • A free Gemini API key (available at Google AI Studio)
  • About 30 minutes of your time ⏱️

Step 1: Set Up Your Workspace

Create a Project Directory
Create a new folder for your agent project:

mkdir Agent
cd Agent
Enter fullscreen mode Exit fullscreen mode

Initialize a Virtual Environment
A virtual environment keeps your project dependencies isolated:

# Create virtual environment
python -m venv .venv

# Activate it
# On macOS/Linux:
source .venv/bin/activate

# On Windows (Command Prompt):
.venv\Scripts\activate.bat

# On Windows (PowerShell):
.\.venv\Scripts\Activate.ps1
Enter fullscreen mode Exit fullscreen mode

Pro Tip: Always use a virtual environment. It prevents package conflicts and makes your setup reproducible.

Step 2: Install the Google ADK

This is the critical part. Install the correct package:

pip install google-adk

Enter fullscreen mode Exit fullscreen mode

⚠️ Important: Do NOT run pip install adk. This installs an unrelated RPC library that will conflict with ADK commands.

Verify the installation:

adk --version
Enter fullscreen mode Exit fullscreen mode

Step 3: Scaffold Your First Agent

The ADK CLI can generate boilerplate files for you:

adk create my_agent
Enter fullscreen mode Exit fullscreen mode

The CLI might prompt you:

  1. Choose a model → Select 1 for gemini-3.5-flash (free, fast, and capable)
  2. Choose a backend → Select 1 for Google AI (no infrastructure setup needed)
  3. Enter your Google API Key → Paste your Gemini API key (or a placeholder for now)

After running this command, you'll see:

my_agent/
├── .env              # API credentials (ignored by Git)
├── .gitignore        # Prevents committing secrets
├── __init__.py       # Package marker
└── agent.py          # Your agent definition
Enter fullscreen mode Exit fullscreen mode

Step 4: Configure Your API Key

Open my_agent/.env:

GOOGLE_GENAI_USE_ENTERPRISE=0
GOOGLE_API_KEY=YOUR_GEMINI_API_KEY
Enter fullscreen mode Exit fullscreen mode

Replace YOUR_GEMINI_API_KEY with your actual key from Google AI Studio.

Security Note: The .gitignore prevents this file from being committed to version control. Never commit API keys!

Step 5: Explore Your Agent Code

Open my_agent/agent.py. You'll see something like:

from google.adk.agents.llm_agent import Agent

root_agent = Agent(
    model='gemini-3.5-flash',
    name='root_agent',
    description='A helpful assistant for user questions.',
    instruction='Answer user questions to the best of your knowledge',
)

Enter fullscreen mode Exit fullscreen mode

This is your agent definition. It's simple, but powerful:

  • model: The LLM powering your agent
  • name: A unique identifier for the agent
  • description: What your agent does
  • instruction: The system prompt that guides behavior

Step 6: Run Your Agent (Two Options)

Option A: Terminal CLI (Interactive Chat)
For a quick test in your terminal:

# On Windows, set UTF-8 encoding to avoid emoji crashes:
export PYTHONIOENCODING="utf-8"

adk run my_agent
Enter fullscreen mode Exit fullscreen mode

You'll get an interactive prompt where you can type messages and get responses from your agent in real-time.

Option B: Web UI (Visual Chat Interface)
For a more polished experience:

adk web my_agent
Enter fullscreen mode Exit fullscreen mode

Open your browser to http://127.0.0.1:8000 and you'll see a clean chat interface. This is great for demos and user testing.

Real-World Use Cases

Here are some ideas you can build with ADK:

  • 📚 Study Assistant – Explains concepts, generates quizzes
  • 🛠️ Code Helper – Debugs code, suggests optimizations
  • 📰 News Aggregator – Summarizes news from multiple sources
  • 🤖 Customer Support Bot – Handles FAQs, routes to humans
  • 📊 Data Analyst – Processes data and generates insights

Get Started Now

Ready to build? Clone or download the starter template:

📦 Repository: KojoShaddy/my_agent

The repo includes:

  • Complete setup guide
  • Step-by-step codelab
  • Example agent code
  • Deployment documentation

Conclusion

Building AI agents is no longer gatekept by cloud infrastructure. With Google ADK and Antigravity IDE, you have everything you need to start building intelligent agents on your local machine, today.

Whether this is your first AI project or you're exploring advanced agent architectures, this foundation will serve you well. Start local, iterate fast, and scale to the cloud when you're ready.

Resources & Next Steps

📖 Official Google ADK Docs
🔑 Get Your Free Gemini API Key
💻 Download Antigravity IDE
🚀 Google Cloud Deployment Guide

Top comments (0)