Skip to main content
Memory lets agents remember conversations and learn from past interactions. Without memory, every message is like starting fresh.

Quick Start

from praisonaiagents import Agent

# Enable memory with one parameter
agent = Agent(
    instructions="You are a personal assistant",
    memory=True  # Remember conversations
)

agent.start("My name is Alex and I love Python")
# Later...
agent.start("What's my name?")  # Agent remembers: "Alex"
Just add memory=True to enable conversation memory.

Types of Memory

Short-Term

Remembers current chat

Long-Term

Persists across sessions

Knowledge

Access to documents

Memory Options

1

Basic Memory (Conversation)

agent = Agent(
    instructions="You are helpful",
    memory=True  # Remembers the conversation
)
2

Long-Term Memory (Persistent)

agent = Agent(
    instructions="You are a personal assistant",
    memory={
        "provider": "sqlite",  # Store in database
        "db_path": "memory.db"
    }
)
3

Knowledge Memory (Documents)

agent = Agent(
    instructions="Answer from documents",
    knowledge=["docs/"],  # Load documents
    memory=True
)

How Memory Works

StepWhat Happens
InputYou send a message
RetrieveAgent checks memory for context
ProcessCombines memory + new input
RespondGenerates informed response
SaveStores important info for later

Complete Example

from praisonaiagents import Agent

# Personal assistant with memory
assistant = Agent(
    name="PersonalAssistant",
    instructions="""You are a personal assistant.
    Remember user preferences and past conversations.
    Be helpful and personalized.""",
    memory=True
)

# First conversation
assistant.start("I prefer short, bullet-point answers")
assistant.start("My favorite programming language is Python")

# Later conversation - agent remembers!
assistant.start("Explain how to read a file")
# Agent will give short, bullet-point answer about Python

Multi-Agent Memory

Agents can share memory or have private memory:
from praisonaiagents import Agent, AgentTeam

# Agents with shared memory
researcher = Agent(instructions="Research topics", memory=True)
writer = Agent(instructions="Write summaries", memory=True)

team = AgentTeam(
    agents=[researcher, writer],
    memory=True  # Shared team memory
)

Best Practices

Start Simple

Use memory=True first, add complexity later

Be Specific

Tell the agent what to remember in instructions

Use Knowledge

For documents, use knowledge= not memory

Test Memory

Verify the agent remembers correctly

Next: Multi-Agent Systems

Learn how multiple agents work together.