Skip to content

← All guides

How to Add Persistent Memory to AutoGen Agents

Microsoft AutoGen multi-agent conversations are ephemeral by default. Add persistent memory so your agents remember context, decisions, and user preferences across sessions.

The Problem

  • Multi-agent conversations reset between runs
  • Agents can't learn from previous interactions
  • No built-in persistent memory or search
  • No way to undo if an agent stores bad information

The Solution: Novyx

Use the Novyx SDK directly with AutoGen's function calling. Register store_memory and recall_memory as AutoGen tools, and your agents get persistent, searchable memory with rollback.

Quick Start

Install the integration package:

bash
pip install novyx pyautogen

Add memory functions to your AutoGen agents:

python
from novyx import Novyx
import autogen

nx = Novyx(api_key="YOUR_API_KEY")

# Define memory functions
def store_memory(content: str, tags: list = None) -> str:
    """Store a memory persistently."""
    result = nx.remember(content, tags=tags)
    return f"Stored: {result.id}"

def recall_memory(query: str, limit: int = 5) -> list:
    """Recall relevant memories by semantic search."""
    results = nx.recall(query, limit=limit)
    return [m.observation for m in results.memories]

# Configure AutoGen with memory tools
llm_config = {
    "config_list": [{"model": "gpt-4", "api_key": "..."}],
    "functions": [
        {
            "name": "store_memory",
            "description": "Store important information for later recall",
            "parameters": {
                "type": "object",
                "properties": {
                    "content": {"type": "string", "description": "What to remember"},
                    "tags": {"type": "array", "items": {"type": "string"}}
                },
                "required": ["content"]
            }
        },
        {
            "name": "recall_memory",
            "description": "Search past memories by meaning",
            "parameters": {
                "type": "object",
                "properties": {
                    "query": {"type": "string", "description": "What to search for"},
                    "limit": {"type": "integer", "default": 5}
                },
                "required": ["query"]
            }
        }
    ]
}

assistant = autogen.AssistantAgent(
    name="assistant",
    llm_config=llm_config
)

# Agent now has persistent cross-session memory

What You Get

Cross-Session Memory

Agent conversations persist across runs. Context is never lost between executions.

Semantic Search

Agents recall memories by meaning. No exact keyword matching needed.

Multi-Agent Sharing

All agents in the conversation can store and recall from the same memory pool.

Rollback & Audit

Roll back to any point in time. Every memory write has a cryptographic audit trail.

How It Works

1

Install both packages

Install novyx and pyautogen. No separate integration package needed.

2

Register memory functions

Define store_memory and recall_memory, add them to llm_config functions.

3

Agents use memory naturally

The LLM decides when to store and recall. Memory persists across all sessions.

Frequently Asked Questions

How do I add persistent memory to an AutoGen agent?

Define store_memory and recall_memory functions using the Novyx SDK, then register them as AutoGen tools. Agents call these tools naturally during conversation to persist and retrieve context across sessions.

Can AutoGen agents share memory?

Yes. Using Novyx Context Spaces, all agents in an AutoGen conversation can store and recall from the same memory pool. What one agent learns, the others can access immediately.

Does AutoGen have built-in persistent memory?

AutoGen agents lose context between sessions by default. Novyx integrates as callable tools that store conversation insights and task outcomes with full audit trails and rollback capability.

See all integrations on the Integrations page, or read the API docs.

Start Building with Persistent Memory

5,000 memories free. No credit card required.

Start Free

Enter your email to create your developer account.