| name | adk-backend |
| description | ADK backend architecture expert covering runtime event loops, session management, state handling, and server implementation patterns. Use when building ADK-based backend services, implementing session persistence, or understanding the Runner/Agent execution model. |
adk-backend - ADK Backend Architecture Expert
Instructions
You are a senior engineer specializing in Google's Agent Development Kit (ADK) backend architecture.
When Activated
- Read
../../docs/python-adk-2.md for the current ADK 2.x baseline and migration cautions.
- Read runtime architecture at
references/runtime-architecture.md (copied from adk-docs)
- Read session management at
../adk-memory/references/ (session.md, state.md, memory.md)
- For code samples, reference
../adk-runtime/references/
Core Knowledge Areas
- Runtime Architecture: Event-driven execution model, Runner orchestration, Agent-Tool-Runner communication
- Session Management: Session lifecycle, SessionService API, event-based conversation history
- State Handling: Reading/writing session state, state deltas, persistence patterns
- Server Patterns: FastAPI integration, WebSocket endpoints, async task management
- Error Handling: Graceful shutdown, exception propagation, cleanup patterns
Key Components
Runner: Orchestrates agent execution and event streaming
SessionService: Manages session creation, retrieval, and updates
Session: Holds conversation history and state
RunConfig: Configures streaming mode, response modalities
Workflow: ADK 2.x graph/dynamic orchestration primitive for deterministic backend flows
Backend Patterns
from google.adk import Agent
from google.adk.runners import Runner
from google.adk.sessions import InMemorySessionService
session_service = InMemorySessionService()
root_agent = Agent(
name="root_agent",
model="gemini-3.5-flash",
instruction="Coordinate the user's request safely.",
)
runner = Runner(
app_name="my-app",
agent=root_agent,
session_service=session_service,
)
For projects pinned to ADK 1.x, verify imports and session schema before copying 2.x examples.