Register and share your invite link to earn from video plays and referrals.

cv usk
@cv_usk
AI / Software Research Notes AI Agent, LLMOps, MLOps, Software Architecture ๆŠ•็จฟใฏๅ€‹ไบบใฎๆ„่ฆ‹ใงใ™ใ€‚
Joined May 2026
279 Following    414 Followers
# Practical and Useful Patterns with ADK Memory enables "long-term recall" across sessions. Build agents that learn from past conversations and deeply understand each user ๐Ÿง  ๐Ÿ“Œ **Title**: Memory ๐Ÿ”— **URL**: ## ๐Ÿงฉ Overview Memory manages long-term knowledge that is searchable across sessions. While State holds data for "the current conversation," Memory accumulates "knowledge gained from past conversations" and makes it searchable via natural language. The two key APIs are: - `add_session_to_memory` / `add_events_to_memory`: Add session or event content to memory - `search_memory`: Search memory with natural language queries Backends can use vector databases like Chroma, improving agent response quality through RAG (Retrieval-Augmented Generation) patterns. ## ๐Ÿ›  How to Use Import and instantiate `InMemoryMemoryService` from `google.adk.memory`. When a session ends, call `await memory_service.add_session_to_memory(session)` to store the session content in memory. To search, use `await memory_service.search_memory(app_name=..., user_id=..., query="previous network connection issues")` with a natural language query. Iterate over the returned results and access each `memory.content` to retrieve related past conversation content for use as agent context. ## ๐Ÿ— Practical Usage **Customer support scenario:** 1. User reports "My network isn't connecting again" 2. Search Memory for "network connection issues" 3. Retrieve: "User had the same issue 3 days ago, resolved by router restart" 4. Agent suggests: "Was your previous issue resolved? If the symptoms are the same, try restarting your router" This enables personalized support informed by past interaction history. **Learning assistant agent:** 1. User asks "I don't understand derivatives" 2. Search Memory to find "This user prefers visual explanations" and "Last time they understood through concrete examples" 3. Provide graph-based, example-driven explanations ## ๐Ÿ’ก Use Cases - ๐ŸŽง Customer support: Informed responses based on past inquiry history. "Was your previous issue resolved?" - ๐Ÿ“š Learning assistance: Remember user learning styles and comprehension levels to choose optimal teaching approaches - ๐Ÿฅ Health management: Understand trends from consultation history for continuous advice - ๐Ÿ›’ Personal shopper: Remember purchase history and preferences for accurate product suggestions ## โš ๏ธ Caveats - Storing personal information in Memory requires compliance with privacy policies and data protection regulations - Vector DB search accuracy depends on embedding model quality. Choose an appropriate model - Search costs increase as memory volume grows. Consider periodic cleanup or TTL (time-to-live) settings - `InMemoryMemoryService` loses data on process restart. Use persistent backends like Chroma in production โœจ With Memory giving agents long-term recall, you build deeper user relationships and agents that get smarter with every interaction! #ADK# #AIAgent#
Show more