Skip to content

[autogen-ext] Add DakeraMemory — self-hosted persistent vector memory backend #7901

Description

@ferhimedamine

Summary

Add autogen_ext/memory/dakera/ — a self-hosted memory backend for AutoGen agents using Dakera, a persistent, decay-weighted vector memory server.

Install: pip install autogen-ext[dakera]

This follows the established pattern of chromadb/, mem0/, and redis/ memory backends in autogen-ext.

Motivation

The existing autogen-ext memory backends each have limitations for certain deployments:

Backend Limitation
ChromaDB Local-only, no multi-agent sharing across machines
Mem0 Requires Mem0 cloud API key, data leaves your infrastructure
Redis No semantic search, key-value only
Dakera Self-hosted, multi-agent shared, semantic search with decay

Dakera fills the gap for teams that need:

  • Memory shared across multiple AutoGen agents on different machines
  • Zero data egress (all memory stays on your infrastructure)
  • GDPR / air-gap compliance
  • Decay-weighted recall (recent + frequently-accessed memories rank higher)

Proposed implementation

DakeraMemory implements the Memory ABC (autogen_core.memory):

from autogen_core.memory import Memory, MemoryContent, MemoryQueryResult, UpdateContextResult
from autogen_core import Component
from pydantic import BaseModel, SecretStr

class DakeraMemoryConfig(BaseModel):
    base_url: str = "http://localhost:3000"
    api_key: Optional[SecretStr] = None  # falls back to DAKERA_API_KEY env var
    agent_id: str = "autogen"
    session_id: Optional[str] = None
    top_k: int = 5
    timeout: float = 10.0

class DakeraMemory(Memory, Component[DakeraMemoryConfig]):
    component_config_schema = DakeraMemoryConfig
    component_provider_override = "autogen_ext.memory.dakera.DakeraMemory"

    async def update_context(self, model_context: ChatCompletionContext) -> UpdateContextResult:
        # Recalls relevant prior memories and injects as SystemMessage before LLM call
        ...

    async def query(self, query, cancellation_token=None, **kwargs) -> MemoryQueryResult: ...
    async def add(self, content, cancellation_token=None) -> None: ...
    async def clear(self) -> None: ...
    async def close(self) -> None: ...

Usage

from autogen_agentchat.agents import AssistantAgent
from autogen_ext.memory.dakera import DakeraMemory, DakeraMemoryConfig
from autogen_ext.models.openai import OpenAIChatCompletionClient

memory = DakeraMemory(
    DakeraMemoryConfig(
        base_url="http://localhost:3000",
        api_key="dk_your_key",
        agent_id="support-agent",
        top_k=5,
    )
)

agent = AssistantAgent(
    "support",
    model_client=OpenAIChatCompletionClient(model="gpt-4o"),
    memory=[memory],
)

Files

File Purpose
memory/dakera/__init__.py Exports DakeraMemory, DakeraMemoryConfig
memory/dakera/_dakera.py Full Memory + Component implementation
pyproject.toml Adds dakera = ["httpx>=0.27.0"] optional extra

Self-hosting

docker run -p 3000:3000 -e DAKERA_API_KEY=key dakera/dakera:latest

Happy to submit a PR if this is accepted as a viable direction.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions