---
title: "Google ADK Package Anatomy: Modules, Imports, and What Lives Where"
date: "2026-11-25T08:04:00+07:00"
description: "A guided tour of the google-adk package layout — runners, agents, sessions, tools, events, flows, and apps — so you always know which module owns what."
author: "AI Assistant"
image: "https://blog.redlinesoft.net/images/post/google-adk-package-anatomy-modules.jpg"
alt: "Module map of the google-adk Python package structure"
tags: ['google-adk', 'package-structure', 'python', 'architecture', 'internals']
---

Open any ADK example and the imports look deceptively small: `Agent`, `Runner`, maybe a tool function. Then you need a database session service, or an artifact store, or a workflow primitive, and the import path suddenly matters — `google.adk.runners` versus `google.adk.agents`, `google.adk.flows` versus `google.adk.apps`. Knowing the package anatomy saves you from the two classic failure modes: importing a private module that moves in the next release, and reaching for the wrong abstraction because you didn't know it existed.

Here's the map of the `google-adk` distribution, organized by responsibility.

## The runtime core: `runners`

`google.adk.runners` owns execution. The central types:

- **`Runner`** — the full engine: wires agent, session service, artifact service, memory service, and model wiring together.
- **`InMemoryRunner`** — a convenience subclass preconfigured with in-memory services. Perfect for tests and prototypes; its sessions die with the process, which is exactly the point.
- **`RunConfig`** — per-run knobs: `max_llm_calls`, streaming mode, session retrieval, context-window compression.

```python
from google.adk.runners import InMemoryRunner, RunConfig
```

If a class coordinates *when things happen* during a run, it lives here. Note that `Runner` is where service injection happens — the seam covered in [dependency injection in ADK](/blog/adk-dependency-injection-services-adapters).

## The agent zoo: `agents`

`google.adk.agents` is a package of its own containing every agent type:

- **`LlmAgent` / `Agent`** — the workhorse: model + instruction + tools + sub-agents.
- **Workflow agents** — `SequentialAgent`, `ParallelAgent`, `LoopAgent` (in Python these are deprecated in favor of graph workflows — see [design patterns](/blog/adk-design-patterns-single-pipeline-swarm)).
- **Specialists** — transfer agents, custom-agent base classes, planner-bearing agents.
- **`BaseAgent`** — the abstract base every agent implements; subclass it for non-LLM orchestration logic.

Sub-packages under `agents` organize the rest:

| Sub-package | Contains |
|---|---|
| `agents.llm_agent` | `LlmAgent` implementation |
| `agents.flows` | run-flow orchestration (single-agent vs. multi-agent flows) |
| `agents.models` | model connectors: `Gemini`, `LiteLlm`, `Ollama`, `Vllm`, routing |
| `agents.readonly_context` | the read-only context projection |

```python
from google.adk.agents import Agent, LlmAgent, BaseAgent
from google.adk.agents.sequential_agent import SequentialAgent   # explicit path
```

Rule of thumb: `from google.adk.agents import X` for the common types; explicit sub-module paths when you need something specific, so the dependency is visible at a glance.

## Conversation storage: `sessions`

`google.adk.sessions` owns the three-state of a conversation:

- **`SessionService`** (abstract) — the contract: create/get/list sessions, append events.
- **`InMemorySessionService`** — dict-backed; default in `InMemoryRunner`.
- **`DatabaseSessionService`** — persistent storage for real deployments.
- **`StateSessionService`** and related variants for state-centric storage.

```python
from google.adk.sessions import InMemorySessionService, DatabaseSessionService
```

The session triple `(app_name, user_id, session_id)` is this package's addressing scheme — the foundation of [multi-tenant scoping](/blog/adk-multi-tenant-app-names-user-scopes).

## Communication records: `events`

`google.adk.events` defines what moves through the system:

- **`Event`** — content parts plus `EventActions` (state deltas, artifact references, control signals like transfer/escalation), metadata, and `is_final_response()`.
- **`LlmResponse`** — the raw model output layer beneath events.

```python
from google.adk.events import Event, EventActions
```

If you're building analytics, auditing, or replay over a session, this is the module you'll parse.

## Capabilities: `tools`

`google.adk.tools` is where agent abilities live:

- **`FunctionTool`** — wrap any Python function.
- **`ToolContext`** — the per-call context (state, credentials, confirmations).
- Built-ins: `load_artifacts`, `search_memory`, `list_documents`, transfer tools, retrieval tools.
- **`AgentTool`** — expose an entire agent as a tool of another agent.

```python
from google.adk.tools import FunctionTool, ToolContext
```

Plugins (`google.adk.plugins`) hook lifecycle events for cross-cutting behavior — approvals, safety checks, telemetry — without embedding them in tools.

## Orchestration: `flows` and graph workflows

- **`google.adk.flows`** — the run-flow layer deciding how a single turn is processed (`AutoFlow` for automatic tool/sub-agent dispatch, single-agent flows for the simple case).
- **Graph workflows (ADK 2.0)** — declarative node/edge graphs, first-class in TypeScript 2.0 and evolving in Python, replacing the deprecated workflow agents for new code.

## Application scope: `apps` and plugins

`google.adk.apps` provides the **`App`** class — application-level configuration, `app:*` state scope, plugins, caching and compaction configuration, lifecycle hooks. It's the composition root described in the DI post: build once, inject everywhere.

## Supporting cast

| Module | Responsibility |
|---|---|
| `google.adk.artifacts` | `ArtifactService` — versioned blobs referenced by events |
| `google.adk.memory` | `MemoryService` — cross-session recall |
| `google.adk.auth` | credential storage, `request_credential` flows |
| `google.adk.cli` | `adk` command-line tooling (web UI, API server, eval) |
| `google.adk.version` | version introspection — useful in health endpoints |

## Import hygiene rules

1. **Public paths only.** Import from documented modules; `google.adk.*._private` internals move between releases.
2. **Prefer the factory conveniences.** `InMemoryRunner` over hand-assembling four services, until you actually need to swap one.
3. **Declare what you use.** Explicit sub-module imports (`agents.models.gemini`) document intent better than re-exports that may be reorganized.
4. **Version-pin the package.** ADK moves fast; pin `google-adk` and check its changelog before upgrading — deprecations (like the workflow agents) appear early with long windows.
5. **One composition module.** Assemble runner, services, and app in a single module; import `root_agent` everywhere else. It keeps the dependency graph honest.

## Where to go next

With the map in hand, the natural follow-ups are [design patterns for composing agents](/blog/adk-design-patterns-single-pipeline-swarm) (which module hosts which primitive) and [production Python tooling with uv, ruff, and mypy](/blog/adk-uv-ruff-mypy-production) for keeping a codebase this size clean. For the class that stitches several of these modules together at the top, read [dependency injection in ADK](/blog/adk-dependency-injection-services-adapters).

## References

- [Technical Overview — ADK components](https://adk.dev/get-started/about/)
- [App workflow management class](https://adk.dev/apps/)
- [Conversational context: session, state, memory](https://adk.dev/sessions/)
- [google/adk-python](https://github.com/google/adk-python)
- [Agent Development Kit](https://adk.dev/)
