Add persistent memory to Microsoft AutoGen agents.
AutoGen Integration
CortexDB provides persistent memory for Microsoft AutoGen agents, enabling multi-agent conversations that remember context across sessions.
Installation
pip install cortexdb[autogen]
Setup
from autogen import AssistantAgent, UserProxyAgent
from cortexdb.integrations.autogen import CortexMemoryAgent
# Create a memory-augmented assistant
assistant = CortexMemoryAgent(
name="assistant",
system_message="You are a helpful AI assistant with long-term memory.",
llm_config={"model": "gpt-4o"},
cortex_config={
"api_key": "your-cortex-api-key",
"tenant_id": "my-app",
"namespace": "autogen-assistant",
"top_k": 10,
},
)
user = UserProxyAgent(
name="user",
human_input_mode="ALWAYS",
)
# Conversations are automatically stored and recalled
user.initiate_chat(assistant, message="What do you remember about our project?")
Teachable Agent Pattern
from cortexdb.integrations.autogen import CortexTeachableAgent
agent = CortexTeachableAgent(
name="teachable_assistant",
llm_config={"model": "gpt-4o"},
cortex_config={
"api_key": "your-cortex-api-key",
"tenant_id": "my-app",
},
)
# Teach the agent
user.initiate_chat(agent, message="Remember: our deploy window is Tuesdays 2-4pm EST.")
# Later sessions...
user.initiate_chat(agent, message="When can we deploy?")
# "Based on what you told me, your deploy window is Tuesdays 2-4pm EST."
Configuration
| Parameter | Default | Description |
|---|---|---|
| api_key | $CORTEX_API_KEY | CortexDB API key |
| tenant_id | Required | Tenant identifier |
| namespace | None | Memory namespace |
| top_k | 10 | Results per recall |
| auto_remember | True | Auto-store conversation turns |