|
|
ADK with Firestore for Persistent Agent Memory
Author: Venkata Sudhakar
ADK agents can accumulate knowledge about users over time - purchase history, preferences, communication style. Storing this in a Firestore memory collection gives agents long-term recall that survives process restarts. ShopMax India uses Firestore memory to build a personalised shopping assistant that remembers each customer's brand preferences and budget range. The pattern stores structured memory documents in Firestore keyed by user ID. On each agent turn, the agent retrieves the user memory, incorporates it into the system prompt, and updates the memory document after the interaction ends with any new facts learned. The below example shows how ShopMax India implements Firestore-backed persistent memory for the personal shopping agent.
Running the agent with Firestore memory,
It gives the following output,
Based on your Rs 70,000 budget, here are my top picks:
1. Dell XPS 15 - Rs 68,990 (Intel i7, 16GB, OLED display)
2. ASUS ROG Zephyrus G14 - Rs 69,999 (Ryzen 9, RTX 4060)
3. MacBook Air M2 - Rs 71,900 (if you prefer Mac ecosystem)
MEMORY_UPDATE: budget_range=Rs 60,000-75,000
MEMORY_UPDATE: preferences=Dell, ASUS
Memory updated in Firestore
On the next visit, the agent loads this Firestore document and knows the customer prefers Dell and ASUS in the Rs 60,000-75,000 range - no need to ask again. Use Firestore TTL policies to automatically expire memory documents after 90 days of inactivity to comply with data retention policies.
|
|