In Google ADK, what do adk web, adk run, and adk api_server each give you?
answer
- three local entry points, one agent package
- browser, terminal, HTTP
- root_agent discovered by folder convention
- Events, Trace, State, Eval tabs
- /run and /run_sse over FastAPI
basics
~20 sadk web starts a local dev UI over your agent folder, with chat plus Events, Trace and Eval tabs. adk run drives the same agent from the terminal. adk api_server serves it as a local HTTP API.
solid answer
~40 sAll three are local entry points onto the same agent package — a directory with `__init__.py` and an `agent.py` exposing `root_agent`. `adk web <parent_dir>` launches the browser dev UI: you pick an app, chat with it, and inspect each turn's Events, the Trace timeline of LLM and tool spans, current session State, and an Eval tab for recording and running eval cases. `adk run <agent_dir>` gives the same execution in a terminal REPL, which is what you want in a container or over SSH. `adk api_server <parent_dir>` starts a local FastAPI service exposing `POST /run`, `POST /run_sse` for streaming, and session endpoints under `/apps/{app}/users/{user}/sessions/{id}` — the shape you integrate a frontend against before deploying. By default all three use in-memory session storage, so restarting the process wipes conversations.
code
bash · 5 lines# agents/
# weather/__init__.py, agent.py (defines root_agent), .env
adk web ./agents # dev UI over the parent of agent packages
adk run ./agents/weather # same agent, terminal REPL
adk api_server ./agents # local FastAPI: POST /run, POST /run_ssego deeper
Be able to name the three commands and what each opens: a browser dev UI, a terminal loop, and a local HTTP API. Mention that the agent is discovered by folder convention from a root_agent.
Explain that all three wrap the same agent and the same server routes, that /run_sse is the streaming variant, and that session storage is in-memory unless you point it at a database URI.
Show you use the dev UI for diagnosis, not just chat: the Events tab to read actual tool arguments and the Trace tab to attribute latency. Say why you integrate frontends against api_server rather than the UI.
Frame the local CLI as the cheap end of a loop that ends in deployment, and argue for keeping the local surface identical to the deployed one so integration contracts and traces do not change shape between environments.
## The three local entry points Google ADK ships a CLI whose job is to put a *loop* around your agent code before any of it reaches a cloud. The three commands that matter day to day are `adk web`, `adk run` and `adk api_server`. They differ only in the surface they wrap around the same agent, not in how the agent executes. ## What counts as "an agent" to the CLI All three discover agents by directory convention. An agent is a Python package folder containing `__init__.py` (which imports the agent module) and `agent.py` that defines a module-level `root_agent`. `adk web` and `adk api_server` are pointed at the **parent** directory holding one or more such folders, and each folder becomes a selectable app; `adk run` is pointed at the **agent folder itself**. A `.env` file inside the agent folder supplies model credentials and project settings. Getting this layout wrong is the single most common first-hour failure: the UI starts but the app dropdown is empty. ## adk web — the dev UI `adk web` serves a local web app on a localhost port. Beyond the chat box you get: - **Events** — the ordered list of events for the session, so you can open the exact function call the model emitted, the arguments it passed, and the function response that came back. This is where you catch a malformed tool argument that the chat transcript hides behind a fluent answer. - **Trace** — a span timeline for the turn: which LLM call took how long, which tool call sat inside it, and where the wall-clock went. - **State** — the current session state dictionary, so you can see what a tool actually wrote. - **Eval** — create an eval set, save the session you just ran into it as a case, and run cases back against the agent. The UI is a development tool, not a product surface. It talks to the same server routes `adk api_server` exposes. ## adk run — the terminal loop `adk run` starts an interactive text loop against one agent. It is the right choice on a remote box, inside a devcontainer, or when you want to script a quick smoke check without a browser. It prints the agent's responses; the rich per-event inspection lives in the web UI. ## adk api_server — the HTTP surface `adk api_server` starts a FastAPI application locally. The important routes are `POST /run` (run a turn, get the events back as a list) and `POST /run_sse` (the same turn streamed as server-sent events, which is what you want for token-by-token UX). Session lifecycle is handled by REST endpoints under `/apps/{app_name}/users/{user_id}/sessions/{session_id}` — create a session, fetch it, list events. Because this is the same app that a Cloud Run deployment serves, integrating your frontend against `adk api_server` locally means the contract does not change when you deploy. ## Session persistence is opt-in By default every one of these uses in-memory session storage: sessions live in the process and die with it. For a dev loop where you want conversations to survive restarts, point the command at a database URI via its session-service URI option (in google-adk 2.x the flag is `--session_service_uri`; earlier 0.x/1.x releases spelled it `--session_db_url`). There are matching options for the artifact and memory services. Knowing this default is what saves you from the "my agent has amnesia" bug report. ## Choosing between them Use `adk web` while you are shaping prompts, tools and instructions — the Events and Trace tabs are the whole reason ADK bundles a UI. Use `adk run` for headless smoke checks and CI-adjacent scripting. Use `adk api_server` the moment another process needs to call the agent, because it is the deployable shape. None of the three is a load-bearing production server on its own: production means either the same FastAPI app inside your own container on Cloud Run, or a managed Vertex AI Agent Engine deployment.
- Which of these commands would you point a React frontend at during development, and why?`adk api_server`. It serves the same FastAPI app that a Cloud Run deployment runs, so the routes your frontend codes against — `POST /run`, `POST /run_sse` for streaming, and the session endpoints under `/apps/{app}/users/{user}/sessions/{id}` — stay identical after deploy. Building against the dev UI instead means writing an integration you throw away.
- You start adk web and the app dropdown is empty. What do you check first?The directory you pointed it at. `adk web` expects the parent of one or more agent packages, each a folder with `__init__.py` and an `agent.py` defining a module-level `root_agent`. Pointing it straight at the agent folder, or missing the `__init__.py` import, yields a running server with nothing to select.
- Why do conversations disappear when you restart adk web?Because the default session service keeps sessions in process memory. Restarting throws them away. Pass a database URI through the session-service URI option (`--session_service_uri` in google-adk 2.x) to persist sessions across restarts, which also matters when you want to replay a real conversation into an eval case later.
saying these in an interview costs you the question
- Thinking adk web is a production server you can expose
- Assuming sessions persist across restarts by default
- Pointing adk web at the agent folder instead of its parent
- Believing adk run and adk web execute the agent differently
- Not knowing api_server exposes the same routes as a deployment