AUTOGEN · PYTHON

AutoGen Integration

Persistent, semantically-recalled memory for AutoGen agents. Your agents remember everything — across sessions, across restarts. Dakera handles embedding, storage, and retrieval server-side.

Package: autogen-dakera  ·  GitHub →

Quick Start

1

Run Dakera

docker run -d \
  --name dakera \
  -p 3300:3300 \
  -e DAKERA_ROOT_API_KEY=dk-mykey \
  ghcr.io/dakera-ai/dakera:latest

curl http://localhost:3300/health
2

Install

# Core + integration
pip install autogen-dakera

# With AutoGen (if not already installed)
pip install "autogen-dakera[autogen]"

Requirements: Python ≥ 3.10, a running Dakera server.

3

Add memory to your agent

from autogen_agentchat.agents import AssistantAgent
from autogen_ext.models.openai import OpenAIChatCompletionClient
from autogen_dakera import DakeraMemory

memory = DakeraMemory(
    api_url="http://localhost:3300",
    api_key="dk-mykey",
    agent_id="my-agent",
)

model_client = OpenAIChatCompletionClient(model="gpt-4o")

agent = AssistantAgent(
    name="assistant",
    model_client=model_client,
    memory=[memory],
)

# Agent now persists what it learns across sessions

Configuration

ParameterTypeDefaultDescription
api_urlstrDakera server URL (e.g. http://localhost:3300)
api_keystr""API key set via DAKERA_ROOT_API_KEY
agent_idstrLogical identifier for this agent's memory
min_importancefloat0.0Minimum importance score for recalled memories
top_kint5Number of memories to surface per query

Multi-agent team with shared memory

import asyncio
from autogen_agentchat.agents import AssistantAgent
from autogen_agentchat.teams import RoundRobinGroupChat
from autogen_agentchat.conditions import MaxMessageTermination
from autogen_ext.models.openai import OpenAIChatCompletionClient
from autogen_dakera import DakeraMemory

async def main():
    shared_memory = DakeraMemory(
        api_url="http://localhost:3300",
        api_key="dk-mykey",
        agent_id="research-team",
        top_k=8,
    )

    model_client = OpenAIChatCompletionClient(model="gpt-4o")

    researcher = AssistantAgent(
        name="researcher",
        model_client=model_client,
        memory=[shared_memory],
        system_message="You are a research expert. Remember key findings.",
    )

    analyst = AssistantAgent(
        name="analyst",
        model_client=model_client,
        memory=[shared_memory],
        system_message="You are a data analyst. Build on what the researcher found.",
    )

    team = RoundRobinGroupChat(
        [researcher, analyst],
        termination_condition=MaxMessageTermination(max_messages=6),
    )

    # First session — agents learn and store
    result = await team.run(task="Research AI memory architectures")
    print(result.messages[-1].content)

    # Later session — agents recall prior research
    result = await team.run(task="What do we know about transformer memory?")
    print(result.messages[-1].content)

asyncio.run(main())

v0.2.0 — Sessions, Knowledge Graph, Entities & Namespaces

Version 0.2.0 adds four new classes for advanced memory management. All are importable from autogen_dakera.

Session management

Group related memories into sessions. Track what your agents learn per conversation.

from autogen_dakera import DakeraSessionManager

sessions = DakeraSessionManager(
    api_url="http://localhost:3300",
    api_key="dk-mykey",
    agent_id="my-agent",
)

# Use as a context manager
with sessions.start(metadata={"task": "research"}) as session:
    # Run your team — all memories are grouped under this session
    result = await team.run(task="Research AI memory")

# List active sessions
active = sessions.list(active_only=True)

# Get memories from a specific session
memories = sessions.memories(session_id=session.id)

Knowledge graph

Build and query a knowledge graph from your agent's stored memories.

from autogen_dakera import DakeraKnowledgeGraph

kg = DakeraKnowledgeGraph(
    api_url="http://localhost:3300",
    api_key="dk-mykey",
    agent_id="my-agent",
)

# Build the graph from stored memories
kg.build()

# Query the knowledge graph
results = kg.query(query="What has the team researched?")

# Find paths between entities
path = kg.find_path(from_id="entity-1", to_id="entity-2")

# Export the full graph
graph = kg.export(format="json")

Entity extraction

Extract named entities from text and link them to memories.

from autogen_dakera import DakeraEntityExtractor

extractor = DakeraEntityExtractor(
    api_url="http://localhost:3300",
    api_key="dk-mykey",
    agent_id="my-agent",
)

# Extract entities from text
found = extractor.extract(
    text="Alice from Acme Corp discussed the Q4 roadmap.",
    entity_types=["person", "organization"],
)

# Get entities linked to a memory
linked = extractor.memory_entities(memory_id="mem_abc123")

Namespace management

Create and manage vector namespaces for organizing document collections.

from autogen_dakera import DakeraNamespaceManager

ns = DakeraNamespaceManager(
    api_url="http://localhost:3300",
    api_key="dk-mykey",
)

# Create a namespace
ns.create(name="team-docs", dimension=1024)

# List all namespaces
all_ns = ns.list_namespaces()

# Get namespace details and stats
info = ns.get(name="team-docs")
stats = ns.stats(name="team-docs")

Enhanced DakeraMemory (v0.2.0)

The existing DakeraMemory class gained new parameters in v0.2.0:

ParameterTypeDefaultDescription
memory_typestr"episodic"Memory type: episodic, semantic, procedural, working
tagslist[]Tags applied to stored memories
session_idstrNoneLink memories to a session
ttl_secondsintNoneAuto-expire memories after N seconds

New methods: hybrid_search(query, top_k) for combined BM25 + vector search, and batch_query() for parallel queries.

How it works

  1. During conversation, AutoGen calls DakeraMemory.add() with new messages
  2. Dakera embeds the content server-side and stores it with a semantic vector
  3. Before each agent response, AutoGen calls DakeraMemory.query() — Dakera performs hybrid search and returns the most relevant past memories
  4. Memories are injected into the agent's context automatically

Related integrations

Links

Frequently Asked Questions

How do I add persistent memory to AutoGen?

Install the autogen-dakera package, initialize DakeraMemory with your Dakera server URL and API key, then pass it to your AssistantAgent via the memory parameter. Dakera handles embedding and retrieval server-side.

Does Dakera work with AutoGen?

Yes, via the official autogen-dakera integration package. It implements AutoGen's memory protocol so agents automatically store and recall memories across sessions.

What does Dakera add to AutoGen?

Dakera provides persistent cross-session memory, hybrid BM25 + vector semantic search over past interactions, knowledge graph construction, session management, and memory decay. Agents retain learned context across restarts without any local embedding model.