Skip to content
Blog

Google ADK: Building an Omnichannel Memory System Across Web, Mobile, and Voice Agents

Design one memory layer serving web chat, mobile push, and live voice agents in ADK — sessions, state prefixes, MemoryService ingestion, and channel-specific trade-offs.

Published on • December 4, 2026

AI Assistant

A user asks your web chat agent to remember their dietary preference, switches to the mobile app mid-conversation, then calls the voice agent in the car and expects it to know where they left off. Most teams build three integrations and discover — too late — that each channel invented its own persistence story. Web remembers, mobile doesn’t, voice replays the system prompt and forgets everything.

Omnichannel memory is not a storage problem; it is a layering problem. ADK already gives you the layers: Session for one conversation thread, scoped state for preferences that outlive it, and MemoryService for searchable long-term knowledge. This article works through how those layers compose across channels, how to ingest and recall memory uniformly, and where voice agents diverge from text.

1. One memory model, three tiers

ADK’s docs draw the line clearly: a Session tracks the history (events) and temporary data (state) of a single conversation, while long-term knowledge lives in a MemoryService — a searchable archive potentially spanning many past chats. Adding the third dimension, channels, gives you the tier table every omnichannel design needs:

TierScopeADK mechanismSurvivesBest for
TurnOne invocationtemp: stateNothing (by design)Intermediate tool results
ConversationOne session threadsession.state, eventsDepends on SessionServiceBooking flow, open tickets
Cross-channelOne useruser: state, MemoryServicePersistent services onlyPreferences, identity, history

Two rules make this work across channels:

  1. Anything a user expects to persist across channels goes in user:-scoped state or the MemoryService — never in session-scoped state. The user: prefix ties the value to the user_id across all sessions within the same app_name.
  2. All channels must share the same SessionService and MemoryService instances (or at least the same backing stores). The docs are explicit that services must be shared across runners to share state and memory.

2. Ingest memory uniformly from every channel

The BaseMemoryService interface exposes three ingestion paths: add_session_to_memory (whole completed session), add_events_to_memory (a delta such as the latest turn), and add_memory (explicit MemoryEntry objects). The first two are your omnichannel workhorses.

Automate session ingestion with an agent callback, and hand the agent the preload_memory tool so recall is automatic at the start of each turn:

from google.adk.agents import Agent
from google.adk.memory import VertexAiMemoryBankService
from google.adk.runners import Runner
from google.adk.sessions import DatabaseSessionService
from google.adk.tools import preload_memory

async def auto_save_session_to_memory(callback_context):
    # Runs after each turn; ingests the current session into long-term memory
    await callback_context.add_session_to_memory()

agent = Agent(
    model="gemini-flash-latest",
    name="concierge_agent",
    instruction="Answer the user's questions. Recall prior conversations when relevant.",
    tools=[preload_memory],
    after_agent_callback=auto_save_session_to_memory,
)

memory_service = VertexAiMemoryBankService(
    project="my-gcp-project",
    location="us-central1",
    agent_engine_id="1234567890",
)

runner = Runner(
    agent=agent,
    app_name="concierge",
    session_service=DatabaseSessionService(db_url="postgresql+asyncpg://..."),
    memory_service=memory_service,
)

This single wiring serves web and mobile identically — both drive ordinary Runner.run() turns. The memory service choice shapes behavior: InMemoryMemoryService does keyword matching for prototyping, VertexAiMemoryBankService extracts LLM-distilled memories with semantic search, and VertexAiRagMemoryService does vector similarity over raw transcripts in a RAG corpus.

3. Read memory through tools, not prompts

Recall follows the same pattern on every channel: the agent decides when to search, using the built-in tools.

  • preload_memory — retrieves relevant memory at the beginning of each turn, similar to a callback.
  • load_memory — retrieves memory when the agent decides it would be helpful.
  • Custom tools — call tool_context.search_memory(query) directly for fine-grained control:
from google.adk.tools import ToolContext

async def search_past_conversations(query: str, tool_context: ToolContext) -> dict:
    response = await tool_context.search_memory(query)
    return {
        "results": [
            part.text
            for entry in response.memories
            for part in (entry.content.parts or [])
            if part.text
        ]
    }

Keeping recall inside tools — rather than injecting entire histories into the prompt — is what lets the same agent serve a 128K-token web session and a latency-sensitive voice session without rearchitecting either.

4. Voice agents: the channel that changes the rules

Live voice uses the same Session, SessionService, and state model as any ADK agent, but adds a LiveRequestQueue connection that can drop, time out, or outlive the context window. Three facts shape your memory design:

  • What gets saved differs. When run_live() exits, final (non-partial) transcriptions, usage metadata, and function calls persist to the ADK Session. Raw audio bytes and partial transcriptions are ephemeral — if you need them, capture them yourself before they vanish.
  • The ADK session outlives the Live API session. Each run_live() call rebuilds the Live API context from stored ADK history, which is precisely what lets a conversation continue across network drops and app restarts.
  • Session resumption handles reconnection across the Live API’s ~10-minute connection limit — but ADK only manages the ADK-to-Live-API hop; your client’s own reconnect logic stays yours.
from google.adk.agents.run_config import RunConfig
from google.genai import types

run_config = RunConfig(
    response_modalities=["AUDIO"],
    session_resumption=types.SessionResumptionConfig(),  # survive ~10-min drops
    context_window_compression=types.ContextWindowCompressionConfig(
        trigger_tokens=100000,   # compress near ~78% of a 128K window
        sliding_window=types.SlidingWindow(target_tokens=80000),
    ),
)

Note the compression trade-off for voice: older context becomes a summary, not verbatim history. If exact recall of early turns matters (legal, medical), keep critical facts in user: state or memory before they age out of the window.

5. Channel-specific considerations

ConcernWeb chatMobile appVoice agent
Session fetch costTolerable per turnWatch mobile latencyMust be fast; connection is live
Ingestion triggerafter_agent_callback per turnSame, plus add_events_to_memory for long sessionsOn run_live() exit, from saved events
Recall styleload_memory on demandpreload_memory for continuityPrefer preload_memory; tool round-trips cost seconds of audio
DurabilityDatabaseSessionServiceSame shared serviceSame shared service; audio itself not persisted
Identity keyAccount loginDevice + account linkVoice profile mapped to user_id

The mobile row deserves emphasis: use add_events_to_memory to ingest deltas mid-conversation rather than waiting for session end, since app users background and resume aggressively. And the voice row’s rule — preload instead of tool-call — exists because every retrieval round-trip is audible latency.

6. Identity, consolidation, and governance

Omnichannel systems fail socially before they fail technically. Three practices keep memory trustworthy:

  • One user_id mapping across channels. Every channel must resolve to the same ADK user_id, or the user: prefix scatters preferences across phantom identities.
  • Consolidation on write. VertexAiMemoryBankService.add_memory accepts custom_metadata={"enable_consolidation": True} so the Memory Bank merges related facts instead of accumulating contradictions (“prefers email” vs. “prefers SMS”).
  • Retention as a feature, not an afterthought. Because ingestion copies session content into long-term memory, define what deletion means at both tiers — a session delete alone will not purge an already-ingested memory.

Checklist

  • All channels share one SessionService and one MemoryService backing store
  • Cross-channel facts live under user: state or MemoryService, never session state
  • Every channel resolves to the same user_id
  • after_agent_callback ingests completed sessions automatically
  • Long-running mobile sessions ingest deltas with add_events_to_memory
  • Recall uses preload_memory/load_memory rather than prompt-injected history
  • Voice sessions enable session_resumption and capture anything ephemeral before exit
  • Critical early-turn facts survive context compression by living in state/memory
  • Deletion covers both sessions and ingested memories

Conclusion

Omnichannel memory in ADK is achieved by refusing to build channel-specific persistence: one shared SessionService for conversation durability, user:-scoped state for preferences, and a single MemoryService that every channel ingests into and searches. Web and mobile differ only in ingestion cadence; voice differs in what it saves and how it reads back.

Design the tiers first, wire the services once, and each new channel becomes configuration rather than a project — which is the only way “the agent remembers me” scales past the first surface you ship.

References