Memory Configuration
Overview
The memory
object allows you to configure conversation memory and personalization features for the application. This configuration controls how the system remembers and personalizes conversations, including token limits, message context windows, and agent-based memory processing.
Example
memory:
disabled: false
validKeys: ["user_preferences", "conversation_context", "personal_info"]
tokenLimit: 2000
personalize: true
messageWindowSize: 5
agent:
provider: "openAI"
model: "gpt-4"
instructions: "You are a helpful assistant that remembers user preferences and context."
model_parameters:
temperature: 0.7
max_tokens: 1000
disabled
Key | Type | Description | Example |
---|---|---|---|
disabled | Boolean | Disables memory functionality when set to true. When disabled, the system will not store or use conversation memory. | disabled: false |
Default: false
memory:
disabled: true
validKeys
Key | Type | Description | Example |
---|---|---|---|
validKeys | Array of Strings | Specifies which keys are valid for memory storage. This helps control what types of information can be stored in memory. | validKeys: ["user_name", "preferences", "context"] |
Default: No restriction (all keys are valid)
memory:
validKeys:
- "user_preferences"
- "conversation_context"
- "personal_information"
- "learned_facts"
tokenLimit
Key | Type | Description | Example |
---|---|---|---|
tokenLimit | Number | Sets the maximum number of tokens that can be used for memory storage and processing. | tokenLimit: 2000 |
Default: No limit
memory:
tokenLimit: 2000
personalize
Key | Type | Description | Example |
---|---|---|---|
personalize | Boolean | When set to true, gives users the ability to opt in or out of using memory features. Users can toggle memory on/off in their chat interface. When false, memory features are completely disabled. | personalize: true |
Default: true
memory:
personalize: false
messageWindowSize
Key | Type | Description | Example |
---|---|---|---|
messageWindowSize | Number | Specifies the number of recent messages to include in the memory context window. | messageWindowSize: 5 |
Default: 5
memory:
messageWindowSize: 10
agent
Key | Type | Description | Example |
---|---|---|---|
agent | Object | Union | Configures the agent responsible for memory processing. Can be either a reference to an existing agent by ID or a complete agent configuration. | agent: { provider: "openAI", model: "gpt-4" } |
The agent
field supports two different configuration formats:
Agent by ID
When you have a pre-configured agent, you can reference it by its ID:
memory:
agent:
id: "memory-agent-001"
Custom Agent Configuration
For more control, you can define a complete agent configuration:
memory:
agent:
provider: "openAI"
model: "gpt-4"
instructions: "You are a memory assistant that helps maintain conversation context and user preferences."
model_parameters:
temperature: 0.3
max_tokens: 1500
top_p: 0.9
Agent Configuration Fields
When using custom agent configuration, the following fields are available:
provider (required)
Key | Type | Description | Example |
---|---|---|---|
provider | String | Specifies the AI provider for the memory agent (e.g., "openAI", "anthropic", "google"). | provider: "openAI" |
model (required)
Key | Type | Description | Example |
---|---|---|---|
model | String | Specifies the model to use for memory processing. | model: "gpt-4" |
instructions (optional)
Key | Type | Description | Example |
---|---|---|---|
instructions | String | Custom instructions that replace the default instructions for when to set and/or delete memory. Should mainly be used when using validKeys that require specific information handling. | instructions: "Only store user preferences and facts when explicitly mentioned." |
model_parameters (optional)
Key | Type | Description | Example |
---|---|---|---|
model_parameters | Object | Additional parameters to pass to the model for fine-tuning its behavior. | model_parameters: { temperature: 0.7 } |
Complete Configuration Example
Here’s a comprehensive example showing all memory configuration options:
version: 1.2.8
cache: true
memory:
disabled: false
validKeys:
- "user_preferences"
- "conversation_context"
- "learned_facts"
- "personal_information"
tokenLimit: 3000
personalize: true
messageWindowSize: 8
agent:
provider: "openAI"
model: "gpt-4"
instructions: |
Store memory using only the specified validKeys. For user_preferences: save
explicitly stated preferences about communication style, topics of interest,
or workflow preferences. For conversation_context: save important facts or
ongoing projects mentioned. For learned_facts: save objective information
about the user. For personal_information: save only what the user explicitly
shares about themselves. Delete outdated or incorrect information promptly.
model_parameters:
temperature: 0.2
max_tokens: 2000
top_p: 0.8
frequency_penalty: 0.1
Notes
- Memory functionality enhances conversation continuity and personalization
- When
personalize
is true, users get a toggle in their chat interface to control memory usage - Token limits help control memory usage and processing costs
- Valid keys provide granular control over what information can be stored
- Custom
instructions
replace default memory handling instructions and should be used withvalidKeys
- Agent configuration allows customization of memory processing behavior
- When disabled, all memory features are turned off regardless of other settings
- The message window size affects how much recent context is considered for memory updates