Google adk

From Mindrally/skills · View interactive version

Google adk is an AI agent skill from the GitHub repository Mindrally/skills. Best practices for building AI agents with Google's Agent Development Kit (ADK) in Python, covering agent design, tools, sessions, memory, artifacts, evaluation, and deployment. Use when building LLM agents or multi-agent systems with ADK, defining ADK tools, wiring up sessions/state/memory, working

How to use this skill

Skill file

Google Agent Development Kit (ADK)

This skill covers building production-grade AI agents with Google's Agent Development Kit (ADK) for Python, including agent composition, tool design, session/state/memory management, artifacts, evaluation, and deployment.

Workflow for Building an ADK Agent

  1. Define the agent — Create an LlmAgent (or Agent) with a clear name, model, instruction, and description. Keep the instruction focused on one job.
  2. Author tools — Write plain Python functions with type hints and docstrings, or wrap existing APIs with FunctionTool. Validate all inputs before side effects.
  3. Compose multi-agent systems — For complex workflows, split responsibility across sub-agents and use SequentialAgent, ParallelAgent, or LoopAgent for deterministic orchestration, or delegate via sub_agents for LLM-driven routing.
  4. Wire up session and state — Choose a SessionService (in-memory for dev, DatabaseSessionService or Vertex AI-managed for production) and use session.state for conversation-scoped data.
  5. Add memory (optional) — Configure a MemoryService for cross-session recall when the agent needs to remember facts between separate conversations.
  6. Handle artifacts (optional) — Configure an ArtifactService when the agent generates or receives files, images, or other binary outputs.
  7. Run locally — Use adk web, adk run, or the Runner API to exercise the agent against a Session.
  8. Evaluate — Write .evalset.json test cases and run adk eval to check tool-call trajectories and response quality against regressions.
  9. Deploy — Package the agent for Vertex AI Agent Engine, Cloud Run, or GKE, and separate dev/staging/prod configuration.

Agent Design

Tools

Example: Defining an Agent with Tools

from google.adk.agents import Agent
from google.adk.tools import FunctionTool
from google.adk.runners import InMemoryRunner
from google.genai import types


def get_order_status(order_id: str) -> dict:
    """Look up the current status of a customer order.

    Args:
        order_id: The unique identifier of the order, e.g. "ord-12345".

    Returns:
        A dict with 'status' ('found' or 'error') and either 'state'
        and 'updated_at', or an error 'message'.
    """
    if not order_id or not order_id.startswith("ord-"):
        return {"status": "error", "message": "invalid order_id format"}

    # In production this would call a real order service.
    orders = {"ord-12345": {"state": "shipped", "updated_at": "2026-08-30T10:00:00Z"}}
    order = orders.get(order_id)
    if order is None:
        return {"status": "error", "message": f"no order found for {order_id}"}
    return {"status": "found", **order}


root_agent = Agent(
    name="order_support_agent",
    model="gemini-2.0-flash",
    description="Answers customer questions about order status.",
    instruction=(
        "You help customers check their order status. "
        "Always call get_order_status before answering an order question. "
        "If the tool returns an error, apologize and ask the customer to "
        "double-check their order ID. Never invent an order status."
    ),
    tools=[FunctionTool(func=get_order_status)],
)


async def main() -> None:
    runner = InMemoryRunner(agent=root_agent, app_name="order_support")
    session = await runner.session_service.create_session(
        app_name="order_support", user_id="user-1"
    )
    message = types.Content(
        role="user", parts=[types.Part(text="What's the status of ord-12345?")]
    )
    async for event in runner.run_async(
        user_id="user-1", session_id=session.id, new_message=message
    ):
        if event.content and event.content.parts:
            for part in event.content.parts:
                if part.text:
                    print(part.text)


if __name__ == "__main__":
    import asyncio

    asyncio.run(main())

Sessions, State, and Memory

Artifacts

Evaluation and Deployment

Common Mistakes

Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.