Skip to content

lavinigam-gcp/adk-by-example

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

22 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

πŸš€ ADK by Example

Copy-paste solutions for common ADK (Agent Development Kit) tasks

License: MIT Examples Powered by Gemini Website

What is ADK by Example?

ADK by Example provides working code examples organized by what you need to accomplish, not by ADK features.

Instead of reading through documentation to understand concepts, find exactly what you need:

  • πŸ” "I need my agent to search Google" β†’ Here's the code
  • πŸ”— "I need to call my REST API" β†’ Copy this example
  • 🚒 "I need to deploy to Cloud Run" β†’ Follow these steps
  • 🀝 "I need multiple agents working together" β†’ Use this pattern

Think of it as Stack Overflow's best answers, but organized and tested.

🌐 Browse Examples Online

Visit https://lavinigam-gcp.github.io/adk-by-example/ to:

  • πŸ” Search by what you need: "I want to search Google", "deploy my agent"
  • πŸŒ™ Dark mode support: Automatically detects your system preference
  • πŸ“± Mobile-friendly: Responsive design works on all devices
  • ⚑ Quick actions: One-click copy for all commands
  • β™Ώ Accessible: WCAG 2.1 AA compliant with keyboard navigation
  • 🏷️ Smart filtering: Filter by category and search simultaneously

🎯 Quick Start

1. Clone & Configure (30 seconds)

# Clone the repository
git clone https://github.com/lavinigam-gcp/adk-by-example.git
cd adk-by-example

# Set up your environment
cp .env.example .env
# Edit .env and add your GOOGLE_API_KEY (minimum requirement)

2. Run Any Example (30 seconds)

# Navigate to examples directory
cd examples

# Start ADK web interface
adk web

# Select any agent from the dropdown and start chatting!

3. Copy to Your Project

# Option 1: Copy specific example
cp -r examples/01-getting-started/first-agent ~/my-project/

# Option 2: Use as reference and build your own
cat examples/03-adding-capabilities/search-google/agent.py

πŸ“š Browse Examples by What You Need

🎯 "I need to get started"

Example Description Difficulty
first-agent Working agent in 10 lines of code ⭐
understand-basics Agent with detailed comments explaining each part ⭐
use-config-yaml No-code agent using YAML configuration ⭐

πŸ€– "I need to connect to an AI model"

Example Description Difficulty
use-gemini-free Quick start with free Google AI Studio key ⭐
use-vertex-ai Production setup with Google Cloud ⭐⭐
use-claude Integrate Anthropic's Claude ⭐⭐
local-ollama Run models locally for offline development ⭐⭐

πŸ” "I need my agent to search/fetch data"

Example Description Difficulty
search-google Add web search capability to your agent ⭐
call-rest-api Integrate with any REST API ⭐⭐
query-bigquery Query BigQuery databases ⭐⭐
execute-code Run Python code safely ⭐⭐⭐

πŸ‘₯ "I need multiple agents working together"

Example Description Difficulty
route-to-experts Coordinator routing to specialist agents ⭐⭐
process-pipeline Sequential processing pipeline ⭐⭐
parallel-research Concurrent agent execution ⭐⭐⭐
review-loop Critic-refiner pattern ⭐⭐⭐

πŸ’Ύ "I need to manage state and context"

Example Description Difficulty
chat-with-history Maintain conversation history ⭐
share-between-agents Share data between agents ⭐⭐
persist-to-firestore Store state in database ⭐⭐

πŸš€ "I need to deploy to production"

Example Description Difficulty
deploy-cloud-run Deploy to Cloud Run ⭐⭐
add-monitoring Add telemetry and monitoring ⭐⭐
handle-errors Robust error handling ⭐⭐
rate-limiting Implement rate limits ⭐⭐⭐

🎨 "I need advanced patterns"

Example Description Difficulty
stream-responses Real-time streaming output ⭐⭐⭐
human-approval Human-in-the-loop pattern ⭐⭐⭐
custom-workflow Complex orchestration logic ⭐⭐⭐

πŸ› οΈ Environment Setup

Minimal Setup (Just to get started)

# You only need one API key to start
GOOGLE_API_KEY=your-key-here  # Get free at https://aistudio.google.com/app/apikey

Full Setup (For all examples)

See .env.example for all available configuration options.

πŸ“‚ Repository Structure

adk-by-example/
β”œβ”€β”€ examples/                    # All runnable examples
β”‚   β”œβ”€β”€ 01-getting-started/     # Beginner examples
β”‚   β”œβ”€β”€ 02-connecting-llms/     # Model integrations
β”‚   β”œβ”€β”€ 03-adding-capabilities/ # Tools and APIs
β”‚   β”œβ”€β”€ 04-orchestrating-agents/# Multi-agent patterns
β”‚   β”œβ”€β”€ 05-managing-context/    # State management
β”‚   β”œβ”€β”€ 06-going-production/    # Deployment
β”‚   └── 07-advanced-patterns/   # Complex scenarios
β”œβ”€β”€ website/                     # Documentation site
β”œβ”€β”€ scripts/                     # Utility scripts
β”‚   β”œβ”€β”€ validate_examples.py    # Test all examples
β”‚   └── create_example.py       # Scaffold new example
β”œβ”€β”€ .env.example                # Environment template
└── README.md                   # You are here

🀝 How This Differs From Official Resources

Resource Focus Best For Format
ADK by Example Solving specific problems "I need to..." scenarios Copy-paste code
Official Docs Understanding ADK concepts Learning how ADK works Reference guide
Code Samples Demonstrating features Exploring capabilities Complex demos
Tutorials Step-by-step learning Deep understanding Long-form guides

🎯 Design Principles

  1. JTBD-First: Organized by what developers need to do, not by features
  2. Copy-Paste Ready: Every example works immediately after cloning
  3. Minimal Setup: Single .env file configuration for all examples
  4. Real-World Focus: Examples solve actual problems, not toy demos
  5. Progressive Learning: Start simple, link to more complex variations
  6. Well-Tested: All examples verified with adk web command
  7. Grounded in Reality: Every example based on official ADK samples

🚦 Getting Help

Quick Troubleshooting

Problem: "Agent not showing in adk web"

  • Solution: Ensure __init__.py exists in the example folder

Problem: "Import errors when running"

  • Solution: Run from the examples/ directory, not from individual example folders

Problem: "API key errors"

  • Solution: Check .env file exists and contains valid GOOGLE_API_KEY

Resources

πŸ“ˆ Roadmap

  • Phase 1: Repository structure and foundation (βœ… Complete)
  • Phase 2: Getting Started category with 6 examples (βœ… Complete)
  • Phase 3: Production-ready website with advanced search (βœ… Complete)
    • JTBD-focused search with smart query processing
    • Dark mode with system preference detection
    • Full accessibility (WCAG 2.1 AA)
    • Mobile-responsive design
    • Category filtering and URL persistence
  • Phase 4: 30+ JTBD examples across all 7 categories (23% complete - 7/30)
  • Phase 5: Community contributions and integrations
  • Phase 6: Video tutorials for complex patterns

🀝 Contributing

We welcome contributions! See CONTRIBUTING.md for guidelines.

Quick contribution ideas:

  • πŸ› Report issues with examples
  • πŸ“ Improve documentation
  • 🎯 Suggest new JTBD scenarios
  • πŸ”§ Submit your own examples

πŸ“œ License

MIT License - see LICENSE file. Use these examples freely in your projects!

πŸ™ Acknowledgments


Made with ❀️ for the ADK community
⭐ Star this repo if you find it helpful!
🌐 Browse examples online

About

JTBD driven adk samples that shows you how to do certain specific stuff in ADK

Resources

Contributing

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published