Skip to content

Strands Plugin: Memory

FloTorch Strands Memory services enable persistent memory capabilities for your agents, allowing them to store and retrieve information across sessions. The memory system integrates seamlessly with Strands’ tool framework and provides long-term persistent storage through a memory tool interface.

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

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

from flotorch.strands.memory import FlotorchMemoryTool
# Initialize memory tool (requires prior registration in FloTorch Console)
memory = FlotorchMemoryTool(
provider_name="your-memory-provider",
api_key="your_api_key",
base_url="https://gateway.flotorch.cloud",
user_id="user_123",
app_id="app_123"
)

Configure your memory tool with the following parameters:

FlotorchMemoryTool(
provider_name: str, # Memory provider name (from FloTorch Console) - required
api_key: str, # FloTorch API key for authentication (required)
base_url: str, # FloTorch Gateway URL (required)
user_id: str, # User identifier for memory isolation (required)
app_id: str # Application identifier for memory isolation (required)
)

Parameter Details:

  • provider_name - The name of the memory provider configured in FloTorch Console
  • api_key - Authentication key for accessing FloTorch Gateway (can be set via environment variable)
  • base_url - FloTorch Gateway endpoint URL (can be set via environment variable)
  • user_id - User identifier for isolating memory per user
  • app_id - Application identifier for isolating memory per application

Fully implements Strands’ tool interface:

  • Tool Operations - Provides memory operations through tool interface
  • Memory Storage - Stores and retrieves information across sessions
  • Strands Compatibility - Works seamlessly with Strands’ tool framework

Memory tool provides automatic content management:

  • Content Extraction - Automatically extracts content from agent interactions
  • Memory Persistence - Persists memory to FloTorch Memory
  • Metadata Storage - Stores conversations with associated metadata
  • Tool Integration - Integrates as a tool in agent’s tool list

Provides comprehensive 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
from flotorch.strands.agent import FlotorchStrandsAgent
from flotorch.strands.memory import FlotorchMemoryTool
# Initialize memory tool
memory = FlotorchMemoryTool(
provider_name="your-memory-provider",
api_key="your_api_key",
base_url="https://gateway.flotorch.cloud",
user_id="user_123",
app_id="app_123"
)
# Use with agent (add to tools)
agent_manager = FlotorchStrandsAgent(
agent_name="customer-support",
custom_tools=[memory], # Add memory tool
base_url="https://gateway.flotorch.cloud",
api_key="your_api_key"
)
agent = agent_manager.get_agent()
from flotorch.strands.memory import FlotorchMemoryTool
# Initialize memory tool
memory = FlotorchMemoryTool(
provider_name="your-memory-provider",
api_key="your_api_key",
base_url="https://gateway.flotorch.cloud",
user_id="user_123",
app_id="app_123"
)
# Memory tool can be used by the agent through tool calls
# The agent will automatically use the memory tool when needed
  1. Memory Provider Setup - Always configure memory providers in FloTorch Console before using them in code
  2. User/App Isolation - Use appropriate user_id and app_id values to isolate memory per user and application
  3. Tool Integration - Add memory tool to agent’s tool list for automatic memory access
  4. Error Handling - Implement proper error handling for memory operations in production environments
  5. Memory Cleanup - Consider implementing memory cleanup strategies for long-running applications