Skip to main content

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

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.
Memory uses embedding-based semantic search to retrieve the most relevant information for current tasks, ensuring agents have access to pertinent past knowledge.
Built-in mechanisms for memory compression, summarization, and pruning prevent memory bloat while maintaining important information.
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.
Configuration Parameter: 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
Example:
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.
Configuration Parameter: 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
Example:
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.
Configuration Parameter: 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
Example:
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

The MemoryConfiguration 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 retrieval
  • 0.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 ranking

Configuration 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:
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
Example:

Orbit-Level Memory

Enable memory at the orbit level for shared memory across all agents:
Orbit-level memory creates a shared memory space accessible to all agents in the orbit:
Benefits:
  • Agents can build on each other’s work
  • Context flows naturally through workflow
  • Reduces redundant information storage
  • Natural collaboration pattern

Disabling Memory

Explicitly disable memory when not needed to save resources:
Memory adds overhead: Each enabled memory type consumes CPU, memory, and storage. Disable memory when agents don’t need to retain context between interactions.

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: false

Configure 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 the TaskExecutionContext:
Agents automatically use memory through the execution context—no manual memory operations needed in most cases.

Memory Storage Interface

The MemoryStorage 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:
  • 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
Example:
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

Design agents with appropriate memory for their role:

Performance Best Practices

Embeddings can be expensive. Optimize usage:
Reduce memory retrieval latency:
Properly manage memory throughout lifecycle:

Security and Privacy Best Practices

Memory contains sensitive data. Implement appropriate security measures.

Troubleshooting

Common Memory Issues

Symptom: Application uses excessive RAM or disk space.Causes:
  • maxMemoryItems set too high
  • Compression disabled
  • No pruning enabled
  • Large embeddings cached
  • Memory not cleared between sessions
Diagnosis:
Solutions:
Symptom: Long-term memory doesn’t persist across sessions.Causes:
  • longTermMemory not enabled
  • Invalid persistencePath
  • Insufficient disk permissions
  • Application crashes before persistence
  • Memory not explicitly persisted
Diagnosis:
Solutions:
Symptom: Relevant memories not retrieved or irrelevant memories returned.Causes:
  • similarityThreshold too high or too low
  • Poor embedding model
  • Query doesn’t match stored content
  • Insufficient memory items stored
  • Embedding generation issues
Diagnosis:
Solutions:
Symptom: Memory inconsistencies or conflicts between agents.Causes:
  • Multiple agents writing to same keys
  • Orbit memory vs agent memory confusion
  • Concurrent writes without coordination
  • Stale memory reads
Diagnosis:
Solutions:
Symptom: Memory storage/retrieval is slow.Causes:
  • Large number of memory items
  • Expensive embedding generation
  • Slow disk I/O
  • No caching
  • Inefficient similarity search
Diagnosis:
Solutions:

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

Pro Tip: Start with short-term memory only (memory: true). Monitor your agent’s behavior and add long-term or entity memory only when you have a specific need for persistence or entity tracking. Each memory type adds complexity and overhead.