π’ Announcing our research paper: Zentry achieves 26% higher accuracy than OpenAI Memory, 91% lower latency, and 90% token savings! Read the paper to learn how we're revolutionizing AI agent memory.
Healthcare Assistant with Memory
This example demonstrates how to build a healthcare assistant that remembers patient information across conversations using Google ADK and Zentry.Overview
The Healthcare Assistant helps patients by:- Remembering their medical history and symptoms
- Providing general health information
- Scheduling appointment reminders
- Maintaining a personalized experience across conversations
Setup
Before you begin, make sure you have: Installed Google ADK and Zentry SDK:Code Breakdown
Letβs get started and understand the different components required in building a healthcare assistant powered by memoryDefine Memory Tools
First, weβll create tools that allow our agent to store and retrieve information using Zentry:Define Healthcare Tools
Next, weβll add tools specific to healthcare assistance:Create the Healthcare Assistant Agent
Now weβll create our main agent with all the tools:Set Up Session and Runner
Interact with the Healthcare Assistant
How It Works
This healthcare assistant demonstrates several key capabilities:-
Memory Storage: When Alex mentions her headaches and penicillin allergy, the agent stores this information in Zentry using the
save_patient_infotool. -
Contextual Retrieval: When Alex asks about headache causes, the agent uses the
retrieve_patient_infotool to recall her specific situation. - Memory Application: When discussing medications, the agent remembers Alexβs penicillin allergy without her needing to repeat it, providing safer and more personalized advice.
- Conversation Continuity: The agent maintains context across the entire conversation session, creating a more natural and efficient interaction.
Key Implementation Details
User ID Management
Instead of passing the user ID as a parameter to the memory tools (which would require modifying the ADKβs tool calling system), we attach it directly to the function object:Zentry Integration
The integration with Zentry happens through two primary functions:Zentry_client.add()- Stores new information with appropriate metadataZentry_client.search()- Retrieves relevant memories using semantic search
threshold parameter in the search function ensures that only highly relevant memories are returned.