📚 API ReferenceContexts
<RAGMemory>
Add long term memories to your agent.
The RAGMemory component enables your agent to maintain long-term memory through a question-answer database system. This allows the agent to remember and recall information from previous conversations and interactions. The memory is shared across conversations.
Import
import { RAGMemory } from 'react-agents';
Usage
Add the component to your agent:
import { RAGMemory } from 'react-agents';
return (
<Agent>
{/* ... */}
<RAGMemory
chunkMessages={5} // Optional: Number of messages to chunk together when creating memories
/>
{/* ... */}
</Agent>
);
Additional Notes:
- The
chunkMessages
prop is optional and controls how many messages are grouped together when creating new memories - If not specified, a default chunk size will be used
- The agent will:
- Automatically create memories from conversation chunks
- Summarize chunks of messages into memorable information
- Store memories for later recall
- Load relevant memories during conversations
- Use memories to maintain context across sessions
- Memories persist across conversations and agent restarts
- Memories are stored in a vector database for efficient semantic search
- The agent can access memories that are semantically relevant to the current conversation