AI Agents with Memory
Learn how to create AI agents with memory capabilities for maintaining context and information across tasks.
Feature | Knowledge | Memory |
---|---|---|
When Used | Pre-loaded before agent execution | Created and updated during runtime |
Purpose | Provide static reference information | Store dynamic context and interactions |
Storage | Read-only knowledge base | Read-write memory store |
Persistence | Permanent until explicitly changed | Can be temporary (STM) or persistent (LTM) |
Updates | Manual updates through knowledge files | Automatic updates during agent execution |
Quick Start
Install Package
First, install the PraisonAI Agents package:
duckduckgo_search is a tool that allows agents to search the web. It is required for the multiple agents example shown below.
Set API Key
Set your OpenAI API key as an environment variable in your terminal:
Create a file
Create a new file app.py
with the basic setup:
Start Agents
Type this in your terminal to run your agents:
Requirements
- Python 3.10 or higher
- OpenAI API key. Generate OpenAI API key here. Use Other models using this guide.
- Basic understanding of Python
Understanding Memory
What is Agent Memory?
Memory in AI agents enables them to:
- Maintain context across multiple tasks
- Remember previous interactions and findings
- Build upon past knowledge
- Share information between agents
- Create more coherent and contextual responses
Features
Context Retention
Maintain information across multiple interactions.
Information Sharing
Share knowledge between multiple agents.
Long-term Storage
Store and retrieve information over extended periods.
Memory Types
Support for different memory types (short-term, long-term).
Multi-Agent Memory
Configuration Options
Troubleshooting
Memory Issues
If memory isn’t working as expected:
- Check memory configuration
- Enable verbose mode for debugging
- Verify memory provider settings
Context Flow
If context isn’t being maintained:
- Review task dependencies
- Check memory configuration
- Verify agent communication
Next Steps
AutoAgents
Learn about automatically created and managed AI agents
Mini Agents
Explore lightweight, focused AI agents
For optimal results, configure memory settings based on your specific use case requirements and expected interaction patterns.
Memory Configuration Options
The memory system in PraisonAI supports various configuration options to customize how agents store and retrieve information:
Memory Types
PraisonAI’s memory system includes several types of memory:
Short-term Memory
- Temporary storage for current context
- Automatically cleared between sessions
- Fast access for immediate task context
Long-term Memory
- Persistent storage for important information
- Semantic search capabilities with RAG
- Quality-based storage decisions
Memory Quality Control
PraisonAI includes built-in quality control for memory storage: