ADK Code Reference
Before using this skill, activate /google-agents-cli-workflow first — it contains the required development phases and scaffolding steps.
Prerequisites
- Run
agents-cli info — if it shows project config, skip to the reference below
- If no project exists: run
agents-cli scaffold create <name>
- If user has existing code: run
agents-cli scaffold enhance .
Do NOT write agent code until a project is scaffolded.
Python only for now. This reference currently covers the Python ADK SDK.
Support for other languages is coming soon.
Quick Reference — Most Common Patterns
from google.adk.agents import Agent
def get_weather(city: str) -> dict:
"""Get current weather for a city."""
return {"city": city, "temp": "22°C", "condition": "sunny"}
root_agent = Agent(
name="my_agent",
model="gemini-flash-latest",
instruction="You are a helpful assistant that ...",
tools=[get_weather],
)
References
The first two are cheatsheets for common patterns; for broad or deep knowledge, go to the source (docs index or installed package).
| Reference |
When to read |
references/adk-python.md |
Core ADK API: Agent, tools, callbacks, plugins, state, artifacts, multi-agent systems, SequentialAgent / ParallelAgent / LoopAgent, custom BaseAgent. Default for most agents. |
references/adk-workflows.md |
Graph-based Workflow API (ADK 2.0): nodes, edges, fan-out/fan-in, HITL, parallel processing. Use when you need explicit graph topology. |
curl https://adk.dev/llms.txt |
Docs index (every page title + URL). Fetch it, then WebFetch the specific page for anything beyond the cheatsheets. |
| Installed ADK package |
Exact signatures and symbols — inspect the source (see "Inspecting ADK Source Code" in references/adk-python.md). |
Related Skills
/google-agents-cli-workflow — Development workflow, coding guidelines, and operational rules
/google-agents-cli-scaffold — Project creation and enhancement with agents-cli scaffold create / scaffold enhance
/google-agents-cli-eval — Evaluation methodology, dataset schema, and the eval-fix loop
/google-agents-cli-deploy — Deployment targets, CI/CD pipelines, and production workflows
1---
2name: google-agents-cli-adk-code
3description: >
4 This skill should be used when the user wants to "write agent code",
5 "build an agent with ADK", "add a tool", "create a callback", "define an agent",
6 "use state management", or needs ADK (Agent Development Kit) Python API patterns
7 and code examples. Part of the Google ADK skills suite.
8 It provides a quick reference for agent types, tool definitions, orchestration
9 patterns, callbacks, and state management.
10 Do NOT use for creating new projects (use google-agents-cli-scaffold) or deployment
11 (use google-agents-cli-deploy).
12metadata:
13 author: Google
14 license: Apache-2.0
15 version: 0.5.0
16 requires:
17 bins:
18 - agents-cli
19 install: "uv tool install google-agents-cli"
20---
21
22# ADK Code Reference
23
24> **Before using this skill**, activate `/google-agents-cli-workflow` first — it contains the required development phases and scaffolding steps.
25
26## Prerequisites
27
281. Run `agents-cli info` — if it shows project config, skip to the reference below
292. If no project exists: run `agents-cli scaffold create <name>`
303. If user has existing code: run `agents-cli scaffold enhance .`
31
32Do NOT write agent code until a project is scaffolded.
33
34> **Python only for now.** This reference currently covers the Python ADK SDK.
35> Support for other languages is coming soon.
36
37## Quick Reference — Most Common Patterns
38
39```python
40from google.adk.agents import Agent
41
42def get_weather(city: str) -> dict:
43 """Get current weather for a city."""
44 return {"city": city, "temp": "22°C", "condition": "sunny"}
45
46root_agent = Agent(
47 name="my_agent",
48 model="gemini-flash-latest",
49 instruction="You are a helpful assistant that ...",
50 tools=[get_weather],
51)
52```
53
54---
55
56## References
57
58The first two are cheatsheets for common patterns; for broad or deep knowledge, go to the source (docs index or installed package).
59
60| Reference | When to read |
61|------|-------------|
62| `references/adk-python.md` | Core ADK API: `Agent`, tools, callbacks, plugins, state, artifacts, multi-agent systems, `SequentialAgent` / `ParallelAgent` / `LoopAgent`, custom `BaseAgent`. Default for most agents. |
63| `references/adk-workflows.md` | Graph-based Workflow API (ADK 2.0): nodes, edges, fan-out/fan-in, HITL, parallel processing. Use when you need explicit graph topology. |
64| `curl https://adk.dev/llms.txt` | Docs index (every page title + URL). Fetch it, then `WebFetch` the specific page for anything beyond the cheatsheets. |
65| Installed ADK package | Exact signatures and symbols — inspect the source (see "Inspecting ADK Source Code" in `references/adk-python.md`). |
66
67## Related Skills
68
69- `/google-agents-cli-workflow` — Development workflow, coding guidelines, and operational rules
70- `/google-agents-cli-scaffold` — Project creation and enhancement with `agents-cli scaffold create` / `scaffold enhance`
71- `/google-agents-cli-eval` — Evaluation methodology, dataset schema, and the eval-fix loop
72- `/google-agents-cli-deploy` — Deployment targets, CI/CD pipelines, and production workflows