Skip to main content

Python SDK for Dakera - AI memory platform

Project description

Dakera AI

dakera-py

Python SDK for Dakera AI — the memory engine for AI agents

CI PyPI Downloads License: MIT Docs LoCoMo 88.2%


Why Dakera?

Dakera Others
LoCoMo accuracy 88.2% (1,540 Q standard eval) 60–92%
Deployment Single binary, Docker one-liner External vector DB + embedding service required
Embeddings Built-in — no OpenAI key needed Requires external embedding API
Search modes Vector · BM25 · Hybrid · Knowledge Graph Usually one or two
Transport HTTP + gRPC HTTP only

Full benchmark results · dakera.ai


Run Dakera

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

curl http://localhost:3000/health  # → {"status":"ok"}

For persistent storage with Docker Compose:

curl -sSfL https://raw.githubusercontent.com/Dakera-AI/dakera-deploy/main/docker-compose.yml \
  -o docker-compose.yml
DAKERA_API_KEY=dk-mykey docker compose up -d

Full deployment guide (Docker Compose, Kubernetes, Helm): dakera-deploy


Install

pip install dakera

For async support (AsyncDakeraClient):

pip install dakera[async]

Works with LangChain, LlamaIndex, CrewAI, AutoGen, and any Python agent framework.


Quick Start

from dakera import DakeraClient
client = DakeraClient(base_url="http://localhost:3000", api_key="dk-mykey")
client.store_memory(agent_id="my-agent", content="User prefers brevity", importance=0.9)

Full example — store, recall, upsert, and hybrid search:

from dakera import DakeraClient

client = DakeraClient(base_url="http://localhost:3000", api_key="dk-mykey")

# Store an agent memory
client.store_memory(
    agent_id="my-agent",
    content="User prefers concise responses with code examples",
    importance=0.9,
    tags=["preference"],
)

# Recall memories (semantic search)
response = client.recall(agent_id="my-agent", query="what does the user prefer?", top_k=5)
for m in response.memories:
    print(f"[{m.importance:.2f}] {m.content}")

# Upsert vectors
client.upsert("my-namespace", vectors=[
    {"id": "vec1", "values": [0.1, 0.2, 0.3], "metadata": {"category": "docs"}},
])

# Hybrid search (vector + BM25)
results = client.hybrid_search("my-namespace", query="completed task", top_k=5, vector_weight=0.7)
for r in results:
    print(r.id, r.score)

Async

import asyncio
from dakera import AsyncDakeraClient

async def main():
    client = AsyncDakeraClient(base_url="http://localhost:3000", api_key="dk-mykey")
    response = await client.recall(agent_id="my-agent", query="preferences", top_k=5)
    for m in response.memories:
        print(m.content)

asyncio.run(main())

Features

  • Agent Memory — store, recall, search, and forget memories with importance scoring
  • Sessions — group memories by conversation with auto-consolidation on session end
  • Knowledge Graph — traverse memory relationships, find paths, export graphs
  • Vector Search — ANN queries with metadata filters and batch operations
  • Full-Text Search — BM25 ranking with stemming and stop-word filtering
  • Hybrid Search — combine vector similarity with keyword matching
  • Text Auto-Embedding — server-side embedding generation (no local model needed)
  • Namespaces — isolated vector stores per project, tenant, or use case
  • Feedback Loop — upvote/downvote/flag memories to improve recall quality
  • T-I-F ReliabilityTifScore and evaluate_tif() for Truth-Indeterminacy-Falsity scoring of memory reliability
  • Entity Extraction — GLiNER NER for automatic entity detection
  • Streaming — SSE event subscriptions for real-time memory updates
  • Sync + Async — full parity between DakeraClient and AsyncDakeraClient
  • Typed Models — full type annotations with strict mypy, PEP 561 py.typed marker
  • Retry & Rate Limiting — built-in exponential backoff and rate-limit header tracking
  • Filter DSLF.eq(), F.gt(), F.contains() typed filter builder

Connect to Dakera

from dakera import DakeraClient, RetryConfig

# Self-hosted
client = DakeraClient(base_url="http://your-server:3000", api_key="your-key")

# Cloud (early access)
client = DakeraClient(base_url="http://<your-server-ip>:3000", api_key="your-key")

# With custom retry config
client = DakeraClient(
    base_url="http://localhost:3000",
    api_key="your-key",
    retry_config=RetryConfig(max_retries=5, base_delay=0.2),
)

Integrations

TealTiger Governance Middleware

TealTiger is a governance middleware for AI agents that enforces cost limits, decision policies, and delegation rules. Use Dakera as the persistent backend for all TealTiger artefacts:

pip install dakera[tealtiger] tealtiger
import asyncio
from dakera.async_client import AsyncDakeraClient
from dakera.integrations.tealtiger import (
    DakeraCostStorage,
    DakeraDecisionStore,
    DakeraDelegationHelper,
)

client = AsyncDakeraClient("http://localhost:3000", api_key="dk-mykey")

# Drop-in async CostStorage backend — passes directly to TealTiger client
cost_storage = DakeraCostStorage(client)

from tealtiger import TealOpenAI, TealOpenAIConfig
teal_client = TealOpenAI(config=TealOpenAIConfig(cost_storage=cost_storage))

# Governance decision audit trail with idempotency checks (all methods are async)
decision_store = DakeraDecisionStore(client)
# receipt_id = await decision_store.store_receipt("my-agent", decision)
# is_duplicate = await decision_store.is_terminal("my-agent", correlation_id)

# Multi-hop delegation chain traversal via memory knowledge graph
delegation = DakeraDelegationHelper(client)
await delegation.link_delegation(child_id=child_mem_id, parent_id=parent_mem_id)
chain = await delegation.get_delegation_chain("my-agent", root_id, max_depth=5)

All cost records, decision receipts, and delegation chains are stored in Dakera memory with importance-weighted retention (DENY receipts at 0.95 outlast ALLOW at 0.80) and full knowledge-graph traversal for audit purposes.

See examples/tealtiger_governance.py for a complete walkthrough. Join the integration discussion or visit the TealTiger repo.


Examples

See the examples/ directory:


Resources

Documentation Full API reference and guides
Python SDK docs Python-specific reference
Benchmark LoCoMo evaluation results
dakera.ai Website and early access
GitHub Org All public repos
dakera-deploy Self-hosting guide

Other SDKs

SDK Package
dakera-js @dakera-ai/dakera (npm)
dakera-rs dakera-client (crates.io)
dakera-go github.com/dakera-ai/dakera-go
dakera-cli CLI tool
dakera-mcp MCP server for Claude/Cursor

dakera.ai · Docs · Benchmark · Request Early Access

Built with Rust. Single binary. Zero external dependencies.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

dakera-0.12.5.tar.gz (134.6 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

dakera-0.12.5-py3-none-any.whl (88.4 kB view details)

Uploaded Python 3

File details

Details for the file dakera-0.12.5.tar.gz.

File metadata

  • Download URL: dakera-0.12.5.tar.gz
  • Upload date:
  • Size: 134.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for dakera-0.12.5.tar.gz
Algorithm Hash digest
SHA256 3ce7ecdd03b4f58343b4930dbafe1bde9747391c65f270bb6e9242063620f084
MD5 8ac9516383ef78216397b0613bd6a3a4
BLAKE2b-256 302b1930725b60b48a359428703afbe4a00afadee3a2c5df7479cfc1caf016ad

See more details on using hashes here.

Provenance

The following attestation bundles were made for dakera-0.12.5.tar.gz:

Publisher: release.yml on Dakera-AI/dakera-py

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file dakera-0.12.5-py3-none-any.whl.

File metadata

  • Download URL: dakera-0.12.5-py3-none-any.whl
  • Upload date:
  • Size: 88.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for dakera-0.12.5-py3-none-any.whl
Algorithm Hash digest
SHA256 8384b84e557d630e8ef1195cb25335f11a4d91e8fa0f4f6bcbdb313b745d4175
MD5 ce32beb2189b6fe1f192775397f1f159
BLAKE2b-256 1166a6d2a3cb00b76161fb3b9db4cff1e762f13a4a32c37a1998d6414c29eac3

See more details on using hashes here.

Provenance

The following attestation bundles were made for dakera-0.12.5-py3-none-any.whl:

Publisher: release.yml on Dakera-AI/dakera-py

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page