Skip to content

ADK Plugin: Memory

FloTorch ADK Memory services enable persistent memory capabilities for your agents, allowing them to store and retrieve information across sessions. The memory system integrates seamlessly with Google ADK’s agent framework and provides two distinct memory implementations to suit different use cases.

Available Memory Types:

  • FlotorchMemoryService - Traditional keyword-based memory search and retrieval
  • FlotorchADKVectorMemoryService - Semantic vector-based memory search for advanced retrieval

Important: Memory services require prior setup in the FloTorch Console. Memory capabilities are not built-in and must be explicitly configured.

Before using FloTorch ADK Memory services, ensure you have completed the general prerequisites outlined in the ADK Plugin Overview, Including installation and environment configuration.

from flotorch.adk.memory import FlotorchMemoryService
# Initialize memory service (requires prior registration in FloTorch Console)
memory_service = FlotorchMemoryService(
name="your-memory-provider",
api_key="your_api_key",
base_url="https://gateway.flotorch.cloud"
)
from flotorch.adk.memory import FlotorchADKVectorMemoryService
# Initialize vector memory service (requires prior vector store configuration)
vector_memory = FlotorchADKVectorMemoryService(
api_key="your_api_key",
base_url="https://gateway.flotorch.cloud",
vectorstore_id="your_vectorstore_id"
)
FlotorchMemoryService(
name: str, # Memory provider name (from FloTorch Console) - required
base_url: str = None, # FloTorch Gateway URL (defaults to environment variable)
api_key: str = None, # API key for authentication (defaults to environment variable)
)

Parameter Details:

  • name - The name of the memory provider configured in FloTorch Console
  • base_url - FloTorch Gateway endpoint URL
  • api_key - Authentication key for accessing FloTorch Gateway
FlotorchADKVectorMemoryService(
api_key: str, # FloTorch API key - required
base_url: str, # FloTorch Gateway URL - required
vectorstore_id: str = None, # Vector store ID from FloTorch Console
)

Parameter Details:

  • api_key - Authentication key for accessing FloTorch Gateway
  • base_url - FloTorch Gateway endpoint URL
  • vectorstore_id - The identifier of the vector store configured in FloTorch Console

Memory services provide automatic conversation management:

  • Content Extraction - Automatically extracts content from ADK sessions
  • Role Mapping - Converts ADK roles to FloTorch-compatible formats
  • Metadata Storage - Stores conversations with associated metadata
  • Tool Call Handling - Manages tool calls and responses within memory

Provides seamless role conversion between ADK and FloTorch formats:

  • model / assistant / agent / bot / aiassistant
  • user / human / personuser
  • systemsystem
  • tooltool

Traditional Memory Search:

  • Keyword-Based Search - Performs traditional text-based searches
  • User/App Filtering - Filters results by user ID and application name
  • Metadata Filtering - Supports custom metadata filtering
  • Date Range Queries - Allows filtering by time ranges

Vector Memory Search:

  • Semantic Similarity - Performs vector-based semantic searches
  • KNN Configuration - Adjustable k-nearest neighbors parameter
  • Score Thresholds - Configurable similarity score thresholds
  • Query Rewriting - Supports query reformulation for better results
from flotorch.adk.memory import FlotorchMemoryService
from google.adk import Runner
# Initialize memory service
memory_service = FlotorchMemoryService(
name="your-memory-provider",
api_key="your_api_key",
base_url="https://gateway.flotorch.cloud"
)
# Use with Runner
runner = Runner(
agent=your_agent,
memory_service=memory_service
)
  1. Memory Provider Setup - Always configure memory providers in FloTorch Console before using them in code
  2. Memory Type Selection - Use traditional memory for keyword searches and vector memory for semantic retrieval
  3. Error Handling - Implement proper error handling for memory operations in production environments