Project Scaffolding Best Practices: Structuring Modular ADK Applications
Scaffold modular ADK projects with agents-cli: pick adk create or the full app/tests layout, keep root_agent importable, and wire evals, manifest, and env from day one.
Published on • November 24, 2026
AI Assistant

A single agent.py is fine for a weekend experiment, but the moment an ADK project grows a second tool, an eval dataset, and a Dockerfile, a flat layout starts fighting you. Google’s Agents CLI (agents-cli) exists for exactly that transition: it gives your coding assistant — or your plain terminal — the skills and commands to scaffold, test, evaluate, and deploy ADK agents instead of inventing a layout yourself.
This tutorial covers the two scaffolding paths ADK offers (adk create and agents-cli create), the modular file structure Agents CLI generates, and the conventions that keep the project runnable as it grows. For what an agent is before you structure one, see the technical overview at adk.dev.
Two Scaffolding Paths
adk create | agents-cli create | |
|---|---|---|
| Prerequisites | pip install google-adk (Python 3.10+) | Python 3.11+, uv, Node.js |
| Install | — | uvx google-agents-cli setup |
| Output | single agent.py + .env | full app/tests/Docker layout |
| Run | adk run my_agent | agents-cli playground |
| Best for | learning ADK, prototypes | evals, CI, deployment |
The install step for Agents CLI is one command — it adds the agents-cli binary plus the google-agents-cli-* skills to any coding agents already on your machine:
uvx google-agents-cli setup
Then scaffold with defaults (the adk_python template targeting agent_runtime):
agents-cli create my-agent -y
Use adk create when you want a single-file agent for learning; use agents-cli create when you plan to test, evaluate, and deploy.
The Modular Layout
Agents CLI scaffolds this structure (from the ADK Agents CLI quickstart):
my-agent/
app/
agent.py # main agent code
fast_api_app.py # server, telemetry, and routes
app_utils/ # session and artifact services
tests/
eval/ # evaluation datasets and metrics
integration/ # end-to-end agent tests
unit/
pyproject.toml # project config and dependencies
agents-cli-manifest.yaml # Agents CLI configuration
Dockerfile # container image for deployment
GEMINI.md # project guidance for coding agents
.env # API keys or project IDs
Three properties make this layout modular rather than merely tidy:
app/agent.pystays thin. It should defineroot_agent— the only required element of an ADK agent — and import tools from sibling modules. Everything else lives inapp_utils/or tool modules you add.- Tests mirror intent.
tests/unit/for tool functions,tests/integration/for end-to-end agent runs,tests/eval/for the datasets you will feedagents-cli eval run. - Ops metadata is code-adjacent.
agents-cli-manifest.yaml,Dockerfile, andGEMINI.mdtravel with the agent, soagents-cli deployand your coding agent both read the same configuration.
Keep the Agent Importable
Whatever structure you choose, the agent module must be importable by the framework. A minimal app/agent.py:
from google.adk.agents.llm_agent import Agent
def get_current_time(city: str) -> dict:
"""Returns the current time in a specified city."""
return {"status": "success", "city": city, "time": "10:30 AM"}
root_agent = Agent(
model="gemini-flash-latest",
name="root_agent",
description="Tells the current time in a specified city.",
instruction="You are a helpful assistant that tells the current time in cities.",
tools=[get_current_time],
)
Names are validated by ADK: name must be a valid Python identifier, must be unique within the agent tree, and cannot be user (reserved for end-user input). When you split a monolith into sub-agents, keep those constraints in mind — see adk-agent-swarm-multi-agent-systems.md for how a modular agent tree is composed.
Environment and Authentication
After scaffolding, open .env and set a Gemini API key from Google AI Studio, commenting out the three GOOGLE_CLOUD_* lines so the SDK uses your key instead of Vertex AI:
GEMINI_API_KEY=YOUR_API_KEY
Local development (create, run, eval) needs no Google Cloud project; only deployment and cloud features do. And if you ever wire a Runner into your own server, make sure its app_name matches the agent package directory — ADK warns on mismatch and session lookups will fail with a SessionNotFoundError hint pointing back at it.
Run, Evaluate, Extend
The scaffolded project is immediately runnable:
agents-cli playground # ADK web UI with hot reload at localhost:8080
agents-cli eval run # run the agent over the eval dataset and grade traces
agents-cli deploy # deploy to Google Cloud
To bolt deployment and CI/CD onto a project you scaffolded yourself earlier, run agents-cli scaffold enhance. If you want an existing single-file agent to grow up instead, move it into app/agent.py and adopt the tests/eval split rather than starting over. Deterministic orchestration inside the agent is a separate concern — google-adk-2-graph-workflows-deterministic-orchestration.md covers graph workflows when part of your logic should not be an LLM call at all.
Two hygiene notes: Agents CLI emits one usage log entry per command to your own Cloud project, and you can opt out with AGENTS_CLI_TELEMETRY=0 (or the standard DO_NOT_TRACK=1), checking status via agents-cli info. Never commit .env; the scaffold already treats it as local-only configuration.
Takeaway: Scaffold with agents-cli create when the project must survive testing and deployment, keep app/agent.py as a thin root_agent definition over importable modules, split tests by intent (unit/integration/eval), and treat .env, the manifest, and the Dockerfile as first-class project files — structure you establish at scaffold time is what makes evals and agents-cli deploy frictionless later.