Google ADK Patterns
Skill4 starsChanged 10 months agoMITView on GitHub
Google ADK (Agent Development Kit) patterns for AI agents. Use when building agents, handling events, state, tools, or Vertex AI integration.
- Installs packages
In this repository12 other files it gives its agents.
- CLAUDE.mdCLAUDE.md
- Claude Agent SDK PatternsSkill
- delegation-templatesSkill
- deploymentSkill
- frontend-patternsSkill
- LLM Evaluation PatternsSkill
- LLM Observability PatternsSkill
- memory-workflowSkill
- orchestrator-workflowsSkill
- react-native-best-practicesSkill
- skill-creatorSkill
- testing-strategySkill
The file
We split this skill into the rules it gives an agent
4 rules. About 0 are common, 4 are distinctive, and 0 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈4
Distinctive · estimate
This author's own choices. Worth a look.
0
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 85
Start with 01-agent-setup.md for installation
- Distinctive: line 86
Read 02-event-persistence.md for critical gotchas
- Distinctive: line 87
Check 03-state-management.md for session patterns
- Distinctive: line 159
Next Steps: Read 01-agent-setup.md for complete setup guide.
≈ “Common” is an estimate: at least 1 in 5 of the 213,897 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Google ADK Patterns - Quick Reference
Google ADK (Agent Development Kit) is the official framework for building production-ready multi-agent applications with Vertex AI.
IMPORTANT: Google ADK (google-adk) ≠ Google GenAI SDK (google-genai). ADK is a complete agent framework; GenAI SDK is for direct Gemini API calls.
For current API syntax, use Context7:
get-library-docs: /google/adk-docs (topic: "agents", "tools", "session")
Modules
- 01-agent-setup.md - Agent Creation & Configuration
- Installation (Python 3.10+ required)
- Authentication (Vertex AI, Google AI Studio)
- Creating agents (LlmAgent, SequentialAgent)
- Model configuration
- 02-event-persistence.md - Event Handling & Persistence
- Event structure and serialization
model_dump(mode='json')for bytes handling- Manual event persistence (critical gotchas)
- Complete conversation history management
- 03-state-management.md - Session State & Reloads
- Session management patterns
- State loss on reload (critical gotcha)
- Metadata tracking across reloads
- GCS-backed session storage
- 04-tool-integration.md - Function Calling & Tools
- Python function tools (type hints, docstrings)
- @adk_tool decorator
- Tool best practices
- Error handling
- 05-fastapi-integration.md - API Integration Patterns
- FastAPI + ADK integration
- Async execution patterns
- Error handling in production
- Complete examples
- 06-multi-agent-deployment.md - Multi-Agent Systems & Deployment
- Hierarchical agents (coordinator/specialist)
- Sequential workflows
- RAG pattern
- Deployment to Vertex AI Agent Engine
- 07-oauth-authentication.md - OAuth 2.0 for Vertex AI Agent Engine
- OpenAPI security definitions (mandatory)
- Token retrieval from session state (direct access patterns)
- Credential injection in callbacks (before_tool_callback)
- 401 error handling (after_tool_callback)
- Gemini Enterprise OAuth configuration
Quick Lookup
Common Issues:
- Event not persisting? → 02-event-persistence.md - Manual append required
- State lost after reload? → 03-state-management.md - Separate tracking needed
- Tool not called? → 04-tool-integration.md - Check type hints/docstrings
- Session not saving? → 03-state-management.md - GCS session service
- Performance issues? → 02-event-persistence.md - Batch saves
- Authentication failing? → 01-agent-setup.md - Vertex AI auth
- OAuth tokens not found? → 07-oauth-authentication.md - Direct state access patterns
- 401 errors looping? → 07-oauth-authentication.md - after_tool_callback interception
First Time Setup:
- Start with 01-agent-setup.md for installation
- Read 02-event-persistence.md for critical gotchas
- Check 03-state-management.md for session patterns
Anti-Patterns (Common Gotchas)
Assuming run_async() auto-persists events
→ See 02-event-persistence.md - Manual session.events.append() + extend() required
Expecting state to survive reload without save → See 03-state-management.md - Track separately, restore after reload
Using model_dump() instead of model_dump(mode='json')
→ See 02-event-persistence.md - Bytes won't serialize without mode='json'
Forgetting name parameter on agents
→ See 01-agent-setup.md - name is required
Using GenAI SDK instead of ADK
→ See 01-agent-setup.md - pip install google-adk, NOT google-genai
Multiple saves per request → See 02-event-persistence.md - Batch updates, save once
Using load_credential() in sync callbacks
→ See 07-oauth-authentication.md - Returns coroutine, use direct state access
Searching for temp:oauth2 in Vertex AI
→ See 07-oauth-authentication.md - Pattern is oauth2_*, NOT temp:oauth2
Omitting OpenAPI security definitions
→ See 07-oauth-authentication.md - Must inject security: [{"oauth2": []}]
When to Use Which Module
| Task | Module | Why |
| Building new agent | 01-agent-setup.md | Installation, creation, config |
| Debugging persistence | 02-event-persistence.md | Event handling, save patterns |
| Session reload issues | 03-state-management.md | State loss gotchas |
| Adding tools | 04-tool-integration.md | Function calling patterns |
| API integration | 05-fastapi-integration.md | FastAPI + ADK |
| Multi-agent system | 06-multi-agent-deployment.md | Hierarchical, sequential, RAG |
| Production deployment | 06-multi-agent-deployment.md | Vertex AI Agent Engine |
| OAuth authentication | 07-oauth-authentication.md | OpenAPI OAuth, token retrieval, 401 handling |
Quick Start
# Install
pip install google-adk # Python 3.10+ required
# Imports
from google.adk.agents import LlmAgent
from google.adk.runners import InMemoryRunner
# Auth (Vertex AI)
import os
os.environ["GOOGLE_GENAI_USE_VERTEXAI"] = "TRUE"
os.environ["GOOGLE_CLOUD_PROJECT"] = "your-project"
os.environ["GOOGLE_CLOUD_LOCATION"] = "us-central1"
# Create & Run
agent = LlmAgent(model="gemini-2.0-flash", name="assistant")
runner = InMemoryRunner(agent=agent, app_name="app")
response = await runner.run_debug("Hello!")Next Steps: Read 01-agent-setup.md for complete setup guide.
Resources
- Official Docs: https://google.github.io/adk-docs/
- GitHub: https://github.com/google/adk-python
- PyPI: https://pypi.org/project/google-adk/
- Examples: https://github.com/google/adk-python/tree/main/examples
Context7 for live docs:
/google/adk-docs- Official documentation (5419 snippets)/google/adk-python- Python SDK reference/google/adk-samples- Ready-to-use agent samples
Last Updated: 2025-12-26 (Hybrid format with Context7 integration)
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

