NewDakera v0.12.0 is out: multilingual, multimodal and multi-vector memory, faster reranked recall, one-command rollbackSee what's new →

LangChain integration

langchain-dakera (0.3.0) connects LangChain applications in Python to a Dakera server: DakeraMemory stores and recalls conversation turns as agent memories, and DakeraVectorStore is a LangChain vector store whose embeddings are computed by the server, so no local embedding model is needed. This page is for Python developers adding Dakera to a LangChain project.

Quick start

pip install langchain-dakera

Requires Python ≥ 3.10, dakera>=0.13.1 (installed automatically) and a running Dakera server. Works with Dakera server v0.12.0 and v0.11.108.

from langchain_dakera import DakeraMemory, DakeraVectorStore

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

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

Features

Examples

Conversation memory

from langchain_dakera import DakeraMemory

memory = DakeraMemory(
    api_url="http://localhost:3000",
    api_key="dk-mykey",
    agent_id="chat-agent",
    recall_k=5,
    importance=0.7,
)

# Store a turn (saved as "Human: …\nAI: …")
memory.save_context(
    {"input": "My name is Alice and I'm building a chatbot."},
    {"output": "Nice to meet you, Alice."},
)

# Later, even after a restart: recall what is relevant to the new input
context = memory.load_memory_variables({"input": "What was I building?"})
print(context["history"])

DakeraMemory subclasses langchain_core.memory.BaseMemory, which exists in langchain-core 0.x only. With langchain-core 0.x you can pass it as memory= to a legacy chain such as ConversationChain; with 1.x, call load_memory_variables and save_context yourself as above.

Retrieval with server-side embeddings

from langchain_dakera import DakeraVectorStore

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

retriever = vectorstore.as_retriever(search_kwargs={"k": 4})
docs = retriever.invoke("How does Dakera handle memory decay?")
# Pass docs to your LLM prompt; each Document carries score and id in metadata

Document indexing

from langchain_community.document_loaders import DirectoryLoader
from langchain_text_splitters 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)

vectorstore = DakeraVectorStore(
    api_url="http://localhost:3000",
    api_key="dk-mykey",
    namespace="my-docs",
)
vectorstore.add_documents(chunks)

API reference

DakeraMemory options

ParameterTypeDefaultDescription
api_urlstr—Dakera server URL
api_keystr""API key
agent_idstr—Agent identifier for memory namespacing
recall_kint5Memories to surface per turn
min_importancefloat0.0Minimum importance threshold
importancefloat0.7Importance assigned to stored memories
memory_keystr"history"Key injected into the prompt
input_keystrfirst keyInput key used as recall query
memory_typestr"episodic"Type of stored memories
tagslist[str][]Tags added to stored memories
ttl_secondsintNoneTTL of stored memories
session_idstrNoneSession to store memories under

DakeraVectorStore options

ParameterTypeDefaultDescription
api_urlstr—Dakera server URL
api_keystr""API key
namespacestr—Vector namespace to read/write
embedding_modelstrNoneAccepted but not used in 0.3.0: the server embeds with the namespace's model

Configuration

The package does not read environment variables. To keep the URL and key out of source code, read them yourself:

import os
from langchain_dakera import DakeraMemory

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

Links

LangChain + Dakera in production

Persistent agent memory and server-side retrieval for LangChain, with recall, importance-weighted decay and the knowledge graph running on your own Dakera server.

Get Started → Python SDK Reference →

Other Python integrations: CrewAI · LlamaIndex · AutoGen · LangChain.js (TypeScript)

Stay sharp on agent memory
Benchmark results, SDK releases, and production patterns. Under 500 words per issue.
✓ You're in. First issue lands soon — watch for Dakera in your inbox.