from ryumem import Ryumem# All configuration is done hereryumem = Ryumem( server_url="http://localhost:8000", api_key="ryu_your_api_key_here", track_tools=True, # Enable tool tracking augment_queries=True, # Enable query augmentation similarity_threshold=0.3, # Match queries with 30%+ similarity top_k_similar=5, # Use top 5 similar past queries)
Need to set up a Ryumem server? See the Setup Guide.
3
Add Memory to Agent
from google.adk.agents import Agentfrom ryumem.integrations import add_memory_to_agent# Create your agentagent = Agent( name="assistant", model="gemini-2.0-flash-exp", instruction="You are a helpful assistant with memory.")# Enable memory - configuration comes from ryumem instanceagent = add_memory_to_agent(agent, ryumem)
The agent now has auto-generated memory tools:
search_memory() - Find relevant information from past conversations
save_memory() - Store new information for later retrieval
get_entity_context() - Get comprehensive context about specific entities (when entity extraction is enabled)
All tool executions are automatically logged when track_tools=True, creating a complete history of what your agent has done.
When augment_queries=True (configured in Ryumem instance):
Tracks user queries as episodes automatically
Finds similar past queries using semantic search
Augments new queries with context from similar past conversations
Links queries to tool executions hierarchically
Query augmentation helps agents learn from past interactions. If a user asks “What’s the weather in London?” and later asks “How about London today?”, the second query gets enriched with context from the first.