Why it matters

Sessions are what makes agents remember within a conversation. Understanding backends and lifecycle shapes production deployments.

Advertisement

The architecture

Session: id + app_name + user_id + state + events.

State: dict for custom data. Written by agents, read by future turns.

ADK session modelSession statecustom key-valueEventsmessage + tool historySessionServicepersistence backendInMemorySessionService for dev; VertexAiSessionService for prod persistence
Session components.
Advertisement

How it works end to end

InMemorySessionService: dev only. State lost on restart.

VertexAiSessionService: managed persistence. Scales, survives restarts.

Database backends: DatabaseSessionService for custom SQL backends.

Access: agents read/write state via ToolContext.state.