Dakera DAKERA docs
LANGCHAIN · PYTHON

LangChain Integration

Drop-in LangChain components backed by Dakera — persistent agent memory and server-side RAG with no local embedding model.

Package: langchain-dakera  ·  GitHub →

Quick Start

1

Run Dakera

Dakera is a self-hosted memory server. Spin it up with Docker:

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

# Verify it's running
curl http://localhost:3300/health

For production with persistent storage, use Docker Compose.

2

Install

pip install langchain-dakera

Requirements: Python ≥ 3.10, a running Dakera server.

3

Use it

from langchain_dakera import DakeraMemory, DakeraVectorStore

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

# RAG vector store — server handles embedding
vectorstore = DakeraVectorStore(
    api_url="http://localhost:3300",
    api_key="dk-mykey",
    namespace="my-docs",
)

DakeraMemory

Persistent semantic memory for LangChain conversation chains. Stores and recalls conversation history using Dakera's hybrid search (BM25 + vector).

Conversation chain

from langchain.chains import ConversationChain
from langchain_openai import ChatOpenAI
from langchain_dakera import DakeraMemory

memory = DakeraMemory(
    api_url="http://localhost:3300",
    api_key="dk-mykey",
    agent_id="chat-agent",
    top_k=5,        # memories to recall per turn
    importance=0.7, # importance score for stored memories
)

chain = ConversationChain(
    llm=ChatOpenAI(model="gpt-4o"),
    memory=memory,
)

# First session
response = chain.predict(input="My name is Alice and I'm building a chatbot.")

# Later session — memory persists across restarts
response = chain.predict(input="What was I building?")
print(response)  # "You mentioned you were building a chatbot."

DakeraMemory options

ParameterTypeDefaultDescription
api_urlstrDakera server URL
api_keystr""Dakera API key
agent_idstrAgent identifier for memory namespacing
recall_kint5Memories to surface per turn
min_importancefloat0.0Minimum importance threshold for recall
importancefloat0.7Importance assigned to stored memories
memory_keystr"history"Key injected into the prompt
input_keystrfirst keyInput key used as recall query

DakeraVectorStore

Server-side embedded vector store for RAG. Dakera handles embeddings on the server — no OpenAI or Hugging Face API calls needed for indexing or retrieval.

Indexing documents

from langchain_community.document_loaders import DirectoryLoader
from langchain.text_splitter import RecursiveCharacterTextSplitter
from langchain_dakera import DakeraVectorStore

loader = DirectoryLoader("./docs", glob="**/*.md")
docs = loader.load()
splitter = RecursiveCharacterTextSplitter(chunk_size=500, chunk_overlap=50)
chunks = splitter.split_documents(docs)

# Index into Dakera — server handles embedding
vectorstore = DakeraVectorStore(
    api_url="http://localhost:3300",
    api_key="dk-mykey",
    namespace="my-docs",
)
vectorstore.add_documents(chunks)

RAG chain

from langchain.chains import RetrievalQA
from langchain_openai import ChatOpenAI
from langchain_dakera import DakeraVectorStore

vectorstore = DakeraVectorStore(
    api_url="http://localhost:3300",
    api_key="dk-mykey",
    namespace="my-docs",
)

qa_chain = RetrievalQA.from_chain_type(
    llm=ChatOpenAI(model="gpt-4o"),
    retriever=vectorstore.as_retriever(search_kwargs={"k": 4}),
)

answer = qa_chain.run("How does Dakera handle memory decay?")
print(answer)

DakeraVectorStore options

ParameterTypeDefaultDescription
api_urlstrDakera server URL
api_keystr""Dakera API key
namespacestrVector namespace to read/write
embedding_modelstrnamespace defaultServer-side embedding model override

Using environment variables

import os
from langchain_dakera import DakeraMemory

memory = DakeraMemory(
    api_url=os.environ["DAKERA_URL"],
    api_key=os.environ["DAKERA_API_KEY"],
    agent_id="my-agent",
)

Related integrations

Links