tl  tr
  Home | Tutorials | Articles | Videos | Products | Tools | Search
Interviews | Open Source | Tag Cloud | Follow Us | Bookmark | Contact   
 Generative AI > Google Gemini API > ADK Episodic Memory Agent

ADK Episodic Memory Agent

Author: Venkata Sudhakar

Standard ADK agents are stateless by default - each session starts fresh with no knowledge of previous interactions. Episodic memory changes this by giving the agent access to a searchable log of past events. When a customer contacts ShopMax India again, the agent can retrieve relevant past interactions and use them to provide a personalised, context-aware response without asking the customer to repeat themselves.

The pattern stores interaction summaries in a simple key-value store keyed by user ID and timestamp. A FunctionTool retrieves the most recent N episodes for a user. The agent reads these episodes as context before responding. In production, replace the in-memory store with Firestore or Cloud Bigtable for durability and scale.

The below example shows a ShopMax India support agent that remembers a customer's previous order and complaint history.


It gives the following output,

Hello Ananya! Welcome back to ShopMax India.

I can see from our records that on 5th March 2026, you reported that the remote
for your Samsung 55-inch TV was not working, and we raised replacement request
REQ-8821. The replacement remote was dispatched and was expected within 2 days.

Since it has been a few days, the remote should have arrived by now. Did you
receive it? If there are still any issues, I can escalate this immediately.

[Episode saved: Ananya checked remote replacement status for REQ-8821]

Episodic memory transforms a transactional support bot into a relationship-aware agent. Customers feel recognised, reducing frustration and repeat explanations. For ShopMax India, store episodes in Firestore with user_id as the document key and a subcollection of episodes sorted by timestamp. Set a TTL policy to auto-delete episodes older than 12 months to comply with data retention policies. Index the summary field for keyword search when the agent needs to find a specific past episode by topic rather than recency.


 
  


  
bl  br