Overview
Memory systems in OrbitAI enable agents to retain and recall information across conversations and executions. By providing different types of memory—short-term, long-term, and entity memory—agents can maintain context, learn from past interactions, and build sophisticated knowledge about users, tasks, and environments.Contextual
Maintain conversation context across multiple turns
Persistent
Store information across sessions and executions
Intelligent
Retrieve relevant memories using semantic search
Entity-Aware
Track and remember people, places, and organizations
Configurable
Fine-tune memory behavior with detailed configuration
Efficient
Automatic pruning and compression for optimal performance
Key Capabilities
Multi-Type Memory
Multi-Type Memory
OrbitAI supports three distinct memory types that can be used independently or together: short-term memory for conversations, long-term memory for persistence, and entity memory for tracking named entities.
Semantic Retrieval
Semantic Retrieval
Memory uses embedding-based semantic search to retrieve the most relevant information for current tasks, ensuring agents have access to pertinent past knowledge.
Automatic Management
Automatic Management
Built-in mechanisms for memory compression, summarization, and pruning prevent memory bloat while maintaining important information.
Cross-Session Persistence
Cross-Session Persistence
Long-term memory persists to disk, allowing agents to maintain knowledge across application restarts and sessions.
Memory Architecture
Memory Types
OrbitAI provides three complementary memory systems, each designed for specific use cases:Short-Term Memory
Short-Term Memory
Retains information within a single conversation or task sequence. Ideal for maintaining context in multi-turn interactions.
memory: Bool (default: false)
Scope: Current session only (in-memory)
Use Cases:
- Multi-turn conversations where context is needed
- Sequential task workflows with dependencies
- Conversational agents that reference prior exchanges
- Building context progressively within a session
- Benefits
- Limitations
- When to Use
✅ Fast Access: In-memory storage for quick retrieval
✅ Context Continuity: Maintains conversation flow
✅ No Persistence Overhead: Clears when session ends
✅ Privacy Friendly: Data doesn’t persist after session
Long-Term Memory
Long-Term Memory
Persists information across sessions and executions. Perfect for tracking user preferences, historical data, and learning over time.
longTermMemory: Bool (default: false)
Scope: Cross-session (persistent storage)
Use Cases:
- User preference tracking and personalization
- Historical interaction analysis
- Learning from past successes and failures
- Building knowledge bases over time
- Benefits
- Limitations
- When to Use
✅ Cross-Session: Remembers across app restarts
✅ User Personalization: Learns preferences over time
✅ Historical Context: Access to past interactions
✅ Knowledge Accumulation: Builds expertise progressively
Entity Memory
Entity Memory
Tracks and remembers named entities—people, places, organizations, products—and their attributes and relationships.
entityMemory: Bool (default: false)
Scope: Entity graph (in-memory or persistent)
Use Cases:
- Customer relationship management (CRM)
- Knowledge graph construction
- Entity relationship tracking
- Person/place/organization awareness
- Benefits
- Limitations
- When to Use
✅ Entity Recognition: Automatically identifies entities
✅ Relationship Tracking: Maintains entity connections
✅ Structured Knowledge: Organized entity graphs
✅ Contextual Awareness: Understands entity context
Memory Type Combinations
You can enable multiple memory types simultaneously for sophisticated agents:Recommendation: Start with short-term memory only, then add long-term and entity memory as specific needs arise. Each type adds overhead, so enable only what you need.
Memory Configuration
TheMemoryConfiguration object provides fine-grained control over memory behavior, storage, and performance characteristics.
Configuration Parameters
Int
default:"100"
Maximum number of memory items to store before automatic pruning.Range: 10-10000
Recommendation: 50-100 for most use cases
String
default:"./memory"
File system path where long-term memory is persisted.Examples:
"./memory"- Default location"./data/agent-memory"- Custom directory"~/Documents/OrbitMemory"- User directory
String
default:"text-embedding-ada-002"
Embedding model used for semantic memory retrieval.Options:
"text-embedding-ada-002"- OpenAI (high quality)"text-embedding-3-small"- OpenAI (efficient)"text-embedding-3-large"- OpenAI (highest quality)
Double
default:"0.7"
Minimum similarity score (0.0-1.0) for memory retrieval.Range: 0.0 (retrieve all) to 1.0 (exact match only)
Recommendation:
0.6-0.7- Broad retrieval0.75-0.8- Balanced (recommended)0.85-0.95- Precise retrieval
Bool
default:"false"
Enable automatic memory compression and summarization.When enabled, older memory items are automatically summarized to reduce storage while retaining key information.
Bool
default:"false"
Automatically summarize memory items after a threshold.Works with
compressionEnabled to create concise memory representations.Bool
default:"false"
Automatically remove oldest memory items when
maxMemoryItems is reached.Strategy: FIFO (First In, First Out) or importance-based rankingConfiguration Examples
Basic Memory Configuration
High-Quality Memory Configuration
Memory-Efficient Configuration
Large-Scale Memory Configuration
Enabling and Disabling Memory
Memory can be configured at both agent and orbit levels, providing flexibility for different architectural patterns.Agent-Level Memory
Enable memory for individual agents to give them context retention capabilities:- When to Use
- Memory Isolation
- Best Practices
Agent-level memory is ideal when:
- Different agents have different memory needs
- Some agents need persistence, others don’t
- Fine-grained control over memory usage
- Each agent maintains separate context
Orbit-Level Memory
Enable memory at the orbit level for shared memory across all agents:- Memory Priority
- When to Use
Disabling Memory
Explicitly disable memory when not needed to save resources:Memory Configuration Best Practices
Start Simple
Begin with short-term memory only. Add long-term and entity memory as specific needs emerge.
Match Use Case
Enable memory types that match your use case:Chatbot:
memory: true
Personal assistant: memory: true, longTermMemory: true
CRM: All three types
API worker: memory: falseConfigure Limits
Always set appropriate memory limits:
Monitor Usage
Track memory usage and adjust configuration:
Memory Operations
Memory systems provide several operations for storing, retrieving, and managing information.Accessing Memory
Memory is accessed through theTaskExecutionContext:
Memory Storage Interface
TheMemoryStorage protocol defines memory operations:
Memory Item Structure
Automatic Memory Management
OrbitAI automatically manages memory without manual intervention:Manual Memory Operations
For advanced use cases, you can manually interact with memory:Memory Lifecycle
Advanced Memory Setup
Custom Memory Storage
Implement custom memory storage for specialized backends:Memory with Vector Databases
Integrate with vector databases for scalable memory:Memory Caching
Add caching layer for frequently accessed memories:Memory Compression
Implement custom compression strategies:Memory vs Context Window
Understanding when to use memory systems versus the LLM’s context window:- Memory Systems
- Context Window
- Hybrid Approach
- Decision Guide
Memory Systems:
- Store information externally (outside context window)
- Retrieve relevant data as needed via semantic search
- Not limited by token count
- Slower access (retrieval step required)
- Best for: Large knowledge bases, long-term retention
Context Window Management: When
respectContextWindow: true, OrbitAI automatically prunes old messages when approaching the model’s token limit while retaining system messages and recent context.Best Practices
Memory Configuration Best Practices
Enable Selectively
Only enable memory types you actually need:Good:Bad:
Set Appropriate Limits
Configure memory limits based on use case:Quick tasks: 20-50 items
General agents: 50-100 items
Knowledge workers: 100-500 items
Large scale: 500-5000 items
Use Compression
Enable compression for long-running agents:Benefits:
- Reduced storage usage
- Better retrieval performance
- Automatic maintenance
Tune Similarity Threshold
Adjust threshold based on precision needs:Broad retrieval: 0.6-0.7
Balanced: 0.75-0.8 (recommended)
Precise: 0.85-0.95
Organize by Path
Use descriptive persistence paths:
Monitor Memory Growth
Track and manage memory usage:
Architecture Best Practices
- Agent Memory Design
- Orbit Memory Design
- Scaling Considerations
Design agents with appropriate memory for their role:
Performance Best Practices
Optimize Embedding Costs
Optimize Embedding Costs
Embeddings can be expensive. Optimize usage:
Minimize Retrieval Overhead
Minimize Retrieval Overhead
Reduce memory retrieval latency:
Manage Memory Lifecycle
Manage Memory Lifecycle
Properly manage memory throughout lifecycle:
Security and Privacy Best Practices
Troubleshooting
Common Memory Issues
High Memory Usage
High Memory Usage
Symptom: Application uses excessive RAM or disk space.Causes:Solutions:
maxMemoryItemsset too high- Compression disabled
- No pruning enabled
- Large embeddings cached
- Memory not cleared between sessions
Memory Not Persisting
Memory Not Persisting
Symptom: Long-term memory doesn’t persist across sessions.Causes:Solutions:
longTermMemorynot enabled- Invalid
persistencePath - Insufficient disk permissions
- Application crashes before persistence
- Memory not explicitly persisted
Poor Memory Retrieval
Poor Memory Retrieval
Symptom: Relevant memories not retrieved or irrelevant memories returned.Causes:Solutions:
similarityThresholdtoo high or too low- Poor embedding model
- Query doesn’t match stored content
- Insufficient memory items stored
- Embedding generation issues
Memory Conflicts
Memory Conflicts
Symptom: Memory inconsistencies or conflicts between agents.Causes:Solutions:
- Multiple agents writing to same keys
- Orbit memory vs agent memory confusion
- Concurrent writes without coordination
- Stale memory reads
Slow Memory Operations
Slow Memory Operations
Symptom: Memory storage/retrieval is slow.Causes:Solutions:
- Large number of memory items
- Expensive embedding generation
- Slow disk I/O
- No caching
- Inefficient similarity search
Debugging Memory
Create a debug utility for memory inspection:Next Steps
Agent Configuration
Learn how to configure agents with memory systems
Orbit Workflows
Understand memory in orbit execution contexts
Knowledge Sources
Explore knowledge sources for external knowledge integration
Performance Optimization
Optimize memory and agent performance