agentleFS
sagullapallisagullapalli/claude-code-setup/.claude/skills/google-adk-patterns/SKILL.md

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

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
  1. Distinctive:

    Start with 01-agent-setup.md for installation

    line 85
  2. Distinctive:

    Read 02-event-persistence.md for critical gotchas

    line 86
  3. Distinctive:

    Check 03-state-management.md for session patterns

    line 87
  4. Distinctive:

    Next Steps: Read 01-agent-setup.md for complete setup guide.

    line 159

≈ “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.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

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

  1. 01-agent-setup.md - Agent Creation & Configuration
    • Installation (Python 3.10+ required)
    • Authentication (Vertex AI, Google AI Studio)
    • Creating agents (LlmAgent, SequentialAgent)
    • Model configuration
  2. 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
  3. 03-state-management.md - Session State & Reloads
    • Session management patterns
    • State loss on reload (critical gotcha)
    • Metadata tracking across reloads
    • GCS-backed session storage
  4. 04-tool-integration.md - Function Calling & Tools
    • Python function tools (type hints, docstrings)
    • @adk_tool decorator
    • Tool best practices
    • Error handling
  5. 05-fastapi-integration.md - API Integration Patterns
    • FastAPI + ADK integration
    • Async execution patterns
    • Error handling in production
    • Complete examples
  6. 06-multi-agent-deployment.md - Multi-Agent Systems & Deployment
    • Hierarchical agents (coordinator/specialist)
    • Sequential workflows
    • RAG pattern
    • Deployment to Vertex AI Agent Engine
  7. 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:

  1. Start with 01-agent-setup.md for installation
  2. Read 02-event-persistence.md for critical gotchas
  3. 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

TaskModuleWhy
Building new agent01-agent-setup.mdInstallation, creation, config
Debugging persistence02-event-persistence.mdEvent handling, save patterns
Session reload issues03-state-management.mdState loss gotchas
Adding tools04-tool-integration.mdFunction calling patterns
API integration05-fastapi-integration.mdFastAPI + ADK
Multi-agent system06-multi-agent-deployment.mdHierarchical, sequential, RAG
Production deployment06-multi-agent-deployment.mdVertex AI Agent Engine
OAuth authentication07-oauth-authentication.mdOpenAPI 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

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)

Download now (ZIP)

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
What did you use it for? e.g. Reviewing pull requests in a Rails app

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.