Go client for Dakera AI — the memory engine for AI agents
| Dakera | Others | |
|---|---|---|
| LoCoMo Recall@20 | 88.2% (1,536 Q, LLM-judged retrieval recall) | not directly comparable |
| 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 |
| Dependencies | stdlib net/http only |
Often pulls in gRPC or third-party HTTP clients |
→ Try the playground · Full benchmark results · dakera.ai
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/docker-compose.yml \
-o docker-compose.yml
DAKERA_API_KEY=dk-mykey docker compose up -dFull deployment guide (Docker Compose, Kubernetes, Helm): dakera-deploy
go get github.com/dakera-ai/dakera-go@latestRequires Go 1.21+. Uses only the standard library — no external runtime dependencies.
client := dakera.NewClientWithOptions(dakera.ClientOptions{BaseURL: "http://localhost:3000", APIKey: "dk-mykey"})
imp := float32(0.9)
client.StoreMemory(context.Background(), "my-agent", dakera.StoreMemoryRequest{Content: "User prefers brevity", Importance: &imp})Full example — store, recall, upsert, and hybrid search:
package main
import (
"context"
"fmt"
dakera "github.com/dakera-ai/dakera-go"
)
func main() {
client := dakera.NewClientWithOptions(dakera.ClientOptions{
BaseURL: "http://localhost:3000",
APIKey: "dk-mykey",
})
ctx := context.Background()
// Store an agent memory
imp := float32(0.9)
mem, _ := client.StoreMemory(ctx, "my-agent", dakera.StoreMemoryRequest{
Content: "User prefers concise responses with code examples",
Importance: &imp,
})
fmt.Println("Stored:", mem.Memory.ID)
// Recall memories (semantic search)
resp, _ := client.Recall(ctx, "my-agent", dakera.RecallRequest{
Query: "what does the user prefer?",
TopK: 5,
})
for _, m := range resp.Memories {
fmt.Printf("[%.2f] %s\n", m.Score, m.Content)
}
// Upsert vectors
client.Upsert(ctx, "my-namespace", []dakera.VectorInput{
{ID: "vec1", Values: []float32{0.1, 0.2, 0.3}},
})
// Hybrid search (vector + BM25)
results, _ := client.HybridSearch(ctx, "my-namespace", nil, "completed task", &dakera.HybridSearchOptions{
TopK: 5,
VectorWeight: 0.7,
})
for _, r := range results {
fmt.Println(r.ID, r.Score)
}
}All methods accept a context.Context — use it for timeouts, deadlines, or cancellation:
ctx, cancel := context.WithTimeout(context.Background(), 5*time.Second)
defer cancel()
resp, err := client.Recall(ctx, "my-agent", dakera.RecallRequest{Query: "preferences", TopK: 3})SDK v0.12.3 targets Dakera server v0.12.3 (Dakera-AI/dakera#917, #920, #921, #923, #926, #930,
#932, #933, #938, #940) and stays compatible with v0.12.0 – v0.12.2 servers: new request fields are
omitted unless you set them and new response fields are optional (zero on an older server). The
neighbourhood modes, IncludeSummaries, MatchedText / MatchedIDs, Retrieval, ContextOf,
ContextMemories, RankScore, EventTime, the truncation report, Warnings, the deduplicated-memory
routes and GetMemory without an agent id need server >= 0.12.3 (an older server ignores the new
request fields and answers inline). The super_admin requirement of OpsShutdown and the 422 on
unknown admin-request fields are server 0.12.3 behaviour.
Also server 0.12.3 behaviour: recall, search and batch recall for an agent that has stored nothing
answer 200 with no memories (older servers answered 404 NAMESPACE_NOT_FOUND), and session ids
may contain : (Capabilities(ctx) reports Naming.SessionIDPattern).
A client that writes history (an import, a backfill, a replayed conversation) can say when each
memory's event happened. The server records it as metadata _dakera_event_time and uses it, not the
ingest time, for recency, Since / Until, the temporal windows and graph ordering (CreatedAt
stays the ingest time; TTL and decay count from it):
_, err := client.StoreMemory(ctx, "my-agent", dakera.StoreMemoryRequest{
Content: "Alice moved to Paris.",
EventTime: dakera.EventTimeAt(time.Date(2023, 5, 20, 2, 21, 0, 0, time.UTC)), // or EventTimeUnix(1684549260)
})
batch, err := client.StoreMemoriesBatch(ctx, dakera.BatchStoreMemoryRequest{
AgentID: "my-agent",
Memories: []dakera.BatchStoreMemoryItem{{Content: "Bob joined.", EventTime: dakera.EventTimeRFC3339("2023-06-02T10:00:00Z")}},
})More than 24 hours ahead or before 1970 is a *ValidationError naming event_time.
StoreMemoryRequest.ValidFrom is now sent as metadata valid_from, where the server reads it.
Content longer than the embedding model reads is stored whole, but its vector covers only the first
EmbeddedTokens. StoreMemory and UpdateMemory then return resp.Truncation
(ContentTokens, EmbeddedTokens, MaxTokens, Windows), and StoreMemoriesBatch lists such
memories in resp.Truncated. Store, batch store, recall and batch recall answers carry Warnings
naming request fields the server ignored ("unknown field 'created_at' ignored"); every field the SDK
sends is one the server knows, so Warnings stays nil unless the server is older than the SDK.
With AutoPilot deduplication in merge mode (AutopilotUpdateConfig with DedupMode: dakera.DedupModeMerge; DedupModeReport only counts duplicates), a memory folded into a duplicate,
or merged by consolidation, stays restorable for TrashRetentionHours:
list, err := client.ListDeduplicated(ctx, "my-agent")
for _, m := range list.Memories {
fmt.Println(m.ID, m.Kind, "->", m.SurvivorID, "restorable until", m.RestorableUntil)
}
mem, err := client.RestoreDeduplicated(ctx, "my-agent", list.Memories[0].ID) // 404: no copy, 409: id taken againThe audit log records deduplicated and restored events with a Reason. GetMemory(ctx, "", id)
finds a memory without its agent id when exactly one agent your key can read holds it.
A recall also returns neighbourhood context: memories written in the same session within a few
minutes of the top results. By default (server DAKERA_NEIGHBORHOOD_MODE=inline) they follow the
ranked results in Memories, so len(resp.Memories) can exceed TopK; each one has
IsNeighborhood() true and a Score that is not comparable with the ranked results'. Ask for
NeighborhoodModeSeparate to keep Memories to at most TopK ranked results and get the context
in ContextMemories (each with ContextOf, the id of the ranked memory it belongs to):
resp, err := client.Recall(ctx, "my-agent", dakera.RecallRequest{
Query: "where does Alice live?",
TopK: 3,
NeighborhoodMode: dakera.NeighborhoodModeSeparate, // or NeighborhoodModeInline / NeighborhoodModeOff
})
for _, m := range resp.Memories { // at most 3
fmt.Println(m.ID, m.Score, m.MatchedText) // MatchedText / MatchedIDs: see below
}
for _, c := range resp.ContextMemories {
fmt.Println("context of", c.ContextOf, ":", c.Content)
}IncludeSummaries (*bool) says whether session summaries may be recalled (unset: the server's
choice). When the server collapses derived sentence sub-memories into their source
(DAKERA_RECALL_COLLAPSE_DERIVED), a result is the source memory with MatchedIDs (the sentences
that matched, best first) and MatchedText (the best sentence, when it outranked the source's own
text); search results carry the same fields (SearchMemoriesDetailed also returns TotalCount,
RerankReport and EffectiveTopK). Every new field is omitted from requests unless set and is
optional in answers, so older servers keep working (they ignore NeighborhoodMode and answer
inline).
A PDF, DOCX, HTML, Markdown or text document becomes a set of chunk memories of an agent:
ordinary memories, each sized for the embedding model, carrying its heading breadcrumb and its
provenance (_dakera_document: document id, title, pages, heading path). Recall, search and
filters treat them as memories; a result can cite the document, page and section.
// Text, Markdown or HTML given inline
acc, err := client.ImportDocument(ctx, dakera.ImportDocumentRequest{
AgentID: "docs-bot",
Content: markdown,
MediaType: dakera.MediaTypeMarkdown,
DocumentImportOptions: dakera.DocumentImportOptions{
Tags: []string{"manual"},
Chunking: &dakera.ChunkingOptions{Strategy: dakera.ChunkStrategyStructure},
},
})
// A PDF / DOCX: upload it as an attachment, then import it
up, _ := client.UploadAttachment(ctx, "library", pdfBytes, dakera.MediaTypePDF)
acc, err = client.ImportAttachmentDocument(ctx, "library", up.AttachmentRef,
dakera.ImportAttachmentDocumentRequest{AgentID: "docs-bot", DocumentID: "manual-v3"})
// The import is a job
job, err := client.WaitForDocumentJob(ctx, "docs-bot", acc.JobID, dakera.JobWaitOptions{Timeout: 5 * time.Minute})
// Cite where a recalled chunk comes from
for _, m := range resp.Memories {
if doc := m.DocumentChunk(); doc != nil {
fmt.Println(doc.Title, doc.HeadingPath, doc.PageStart)
}
}ListDocuments (cursor paging), GetDocument (a document and its chunks) and DeleteDocument
complete the surface. Capabilities(ctx) reports Documents (SupportsDocuments(), limits,
media types). A server with DAKERA_DOCUMENTS off answers 501 (*FeatureDisabledError); a
server older than v0.12.3 answers 404 (*NotFoundError, whose message says so). A failed job
(*JobFailedError) carries the status and code: 413 (too big / too many chunks), 422
(UNPROCESSABLE_CONTENT), 504 (EXTRACTION_TIMEOUT).
Send raw text without pre-computing embeddings — Dakera embeds server-side:
client.UpsertText(ctx, "my-namespace", []dakera.TextInput{
{ID: "doc1", Text: "Agent completed onboarding flow successfully"},
})- 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 Reliability —
TifScorestruct andEvaluateTif()for Truth-Indeterminacy-Falsity scoring of memory reliability - Entity Extraction — GLiNER NER for automatic entity detection
- SSE Streaming — Server-sent event subscriptions for real-time memory updates
- Typed Filters —
Eq(),Gt(),Contains(),ArrayContains()and more - Context-Based — all methods accept
context.Contextfor cancellation and timeouts - Retry & Rate Limiting — built-in exponential backoff and rate-limit header tracking
- Zero Dependencies — standard library
net/httpclient, no external runtime deps
// Self-hosted
client := dakera.NewClientWithOptions(dakera.ClientOptions{
BaseURL: "http://your-server:3000",
APIKey: "your-key",
})
// Cloud (early access)
client := dakera.NewClientWithOptions(dakera.ClientOptions{
BaseURL: "http://<your-server-ip>:3000",
APIKey: "your-key",
})
// With custom retry config
client := dakera.NewClientWithOptions(dakera.ClientOptions{
BaseURL: "http://localhost:3000",
APIKey: "your-key",
RetryBackoff: &dakera.RetryConfig{MaxRetries: 5, BaseDelay: 200 * time.Millisecond, MaxDelay: 30 * time.Second, Jitter: true},
})Defaults: a 30 s request timeout (Timeout, also the connect and response-header timeout unless
ConnectTimeout is set) and Go's TLS defaults (TLS 1.2+, system roots, verification on). Event
streams have no overall timeout (cancel their ctx).
Proxies (since v0.12.3): the default transport is a clone of http.DefaultTransport, so the
client honours the HTTPS_PROXY, HTTP_PROXY and NO_PROXY environment variables like any Go HTTP
client (before v0.12.3 it ignored them). To opt out, set NO_PROXY for the Dakera host, or pass your
own transport with Proxy: nil:
t := http.DefaultTransport.(*http.Transport).Clone()
t.Proxy = nil // never use a proxy
client := dakera.NewClientWithOptions(dakera.ClientOptions{BaseURL: "http://localhost:3000", Transport: t})Retries: MaxRetries is the number of attempts. 429 and 503 (honouring
Retry-After) and connection failures before the request was sent are retried for every request;
other 5xx answers and dropped connections are retried only for requests that cannot apply a write
twice (GET, PUT, DELETE, recall, search and the query routes), never for a write POST such
as StoreMemory. The API key is never printed: Client and ClientOptions redact it in %v,
%+v and %#v. OdeExtractEntities requests to the ODE sidecar (OdeURL) currently carry the
Dakera API key; tracked in Dakera-AI/dakera#924.
OpsShutdown (POST /ops/shutdown) needs a global super_admin key; an admin key gets a
403 (*AuthorizationError) from servers v0.12.3 and later.
SDK v0.12.2 targets Dakera server v0.12.2 and stays compatible with v0.12.0 and v0.12.1
servers: new request fields are omitted unless you set them, new response fields are optional
(nil / empty on an older server), and the new routes answer 404 there. Check
caps.Auth, caps.Sessions (or SupportsKeyUpdate(), SupportsSessionTouch()) to see what the
connected server has.
| Feature | API |
|---|---|
| Create an agent before its first memory | CreateAgent(ctx, "mlx-dev") (Created is false for an existing agent) |
| Edit a key's name or namespaces | UpdateKey, UpdateNamespaceKey with UpdateKeyRequest{Namespaces: dakera.GrantNamespaces("team-*")} (nil = unchanged, GrantAllNamespaces() = null, GrantNamespaces() = []) |
| Rotate with a grace period | RotateKeyWithOptions(ctx, id, &dakera.RotateKeyOptions{GraceSecs: &grace}) → OldKeyID, OldKeyExpiresAt |
| Who am I | Whoami(ctx) — scope, grants, Unrestricted, GrantsVersion, InertNamespaces |
| Namespace kinds | ListNamespacesWithKinds, NamespaceInfo.Kind |
| Session idle lifecycle | StartSessionRequest.IdleTimeoutSecs, TouchSession, Session.EndedReason / LastActivityAt / IdleSince, StoreMemoryResponse.SessionState, BatchStoreMemoryResponse.EndedSessions, SetSessionIdleTimeout |
| Derived records | IncludeDerived on AgentMemoriesOptions and WakeUpOptions; AdminDerivationStatus, AdminDrainDerivations |
| Content previews | ContentPreviewChars on AgentMemoriesOptions, SessionMemoriesOptions, FullKnowledgeGraphRequest, CrossAgentNetworkRequest → ContentLen, ContentTruncated |
// A developer key that may create and use its own agents (prefix grant).
key, _ := client.CreateKey(ctx, dakera.CreateKeyRequest{
Name: "dev", Scope: dakera.KeyScopeWrite,
Namespaces: dakera.GrantNamespaces("_dakera_agent_mlx-*"),
})
_ = key // key.Key is shown once: store it in your secret manager, never in code
// A session the server never ends for inactivity.
zero := 0
sess, _ := client.StartSession(ctx, dakera.StartSessionRequest{AgentID: "mlx-dev", IdleTimeoutSecs: &zero})
// A list view: 200-character previews, full text only when needed.
preview := 200
mems, _ := client.AgentMemories(ctx, "mlx-dev", &dakera.AgentMemoriesOptions{ContentPreviewChars: &preview})
for _, m := range mems {
if m.ContentTruncated != nil && *m.ContentTruncated {
full, _ := client.GetMemory(ctx, "mlx-dev", m.ID)
_ = full
}
}
_ = sessBehaviour changes in server v0.12.2 that clients can hit:
- Sessions end after 4 hours without activity by default (
DAKERA_SESSION_IDLE_TIMEOUT_SECS). Activity is a memory stored, batch-stored, imported or updated with the session, a session-scoped recall or search, orTouchSession. Storing into an ended session still succeeds: checkStoreMemoryResponse.SessionState/BatchStoreMemoryResponse.EndedSessionsand start a new session when it saysended. - Sessions are authorized by their agent: keys no longer need a
_dakera_sessionsgrant (it is accepted and inert), a key without grants lists no sessions, andEndSessionwith a Read key gets403. - Stricter validation (400, the field named in the message): invalid key grants (
a**b, blank entries, internal namespaces), a client-setdakera-curatedtag,_dakera_*metadata keys other than_dakera_content_date/_dakera_lang, ids of the formmem_s+ 24 hex, agent ids over 241 bytes, TTLs over 100 years. - The content limit is in bytes (UTF-8,
DAKERA_MAX_MEMORY_CONTENT_BYTES, 100000 by default) andUpdateMemoryenforces it too. - Listings exclude derived records:
AgentMemoriesandGetWakeUpContextleave CE-31 sentence sub-memories out unlessIncludeDerivedis set. - Legacy
foo*grants stay inert on keys created before v0.12.2 (GrantsVersion0,InertNamespaces) until the key's namespaces are saved again withUpdateKey.
SDK v0.12.0 targets Dakera server v0.12.0 and is compatible with both v0.11.108 and
v0.12.0 servers: every new request field is omitted from the wire unless you set it, and the
new routes only exist on a v0.12 server (see the table below). Operator guide for the server
side: docs/v0.12/UPGRADE.md in the server release, and the release notes in the
Dakera changelog.
| Feature | API | Needs |
|---|---|---|
| What the server supports | client.Capabilities(ctx) — models, index kinds, rabitq, records, attachments, vision, scoring, QueryLanguages |
v0.12 (404 on v0.11) |
| Readiness | HealthReady, IsReady, WaitUntilReady (a 503 is "not ready", never healthy) |
any |
Retry-After |
honoured on 429 and 503 (capped at RetryConfig.MaxDelay); ServerError.RetryAfter |
any |
| Errors | PayloadTooLargeError (IsQuota() tells a full namespace from an oversize request), FeatureDisabledError / NotImplementedError (501), ConflictError (409); DakeraError.Details / .Resource |
any |
| Attachments | UploadAttachment, ListAttachments, DownloadAttachment, DeleteAttachment, StoreMemoryRequest.AttachmentRef |
DAKERA_ATTACHMENTS |
| Transcription / image index jobs | TranscribeAttachment, IndexAttachmentImage, Get*Job, WaitFor* |
DAKERA_ATTACHMENTS (+ DAKERA_VISION) |
| Records | UpsertRecords, GetRecord — one vector plus named representations (dense, token_multivector, patch_multivector; f32/f16/i8) |
DAKERA_RECORDS |
| Per-request language | Lang on store, batch store, update, recall, search and ExtractMemoryEntities |
v0.12 |
| New values | models bge-m3, colbert-small; index kind ivfpq; search mode rabitq (server-wide, DAKERA_SEARCH_MODE) |
v0.12 |
| Clearing entity types | PutNamespaceEntityConfig (PUT) and PatchNamespaceEntityConfig (merge); ConfigureNamespaceNer clears with PUT |
v0.12 for PUT |
// Wait for a starting server, then check what it can do.
if _, err := client.WaitUntilReady(ctx, dakera.ReadyWaitOptions{Timeout: 2 * time.Minute}); err != nil {
log.Fatal(err)
}
caps, _ := client.Capabilities(ctx)
if caps.SupportsAttachments() {
up, _ := client.UploadAttachment(ctx, dakera.AgentMemoryNamespace("my-agent"), wavBytes, "audio/wav")
job, _ := client.TranscribeAttachment(ctx, dakera.AgentMemoryNamespace("my-agent"), up.AttachmentRef,
dakera.TranscribeRequest{AgentID: "my-agent", Lang: "en"})
_, err = client.WaitForTranscription(ctx, dakera.AgentMemoryNamespace("my-agent"), up.AttachmentRef, job.JobID,
dakera.JobWaitOptions{Timeout: 5 * time.Minute})
}Things to know when upgrading a server:
- Health checks: v0.12 binds its port while models load.
/healthanswers503withRetry-Afteruntil then; use/health/ready(HealthReady/WaitUntilReady). - Clearing
entity_types: on a v0.12 serverPATCH /v1/namespaces/{ns}/configmerges and an empty list is omitted from JSON, so a PATCH cannot clear it. UsePutNamespaceEntityConfig(orConfigureNamespaceNerwith no entity types, which uses PUT and falls back to PATCH on a v0.11 server). - Errors are JSON everywhere; every
503carriesRetry-After; over-size bodies are413; configuration errors are501. UpsertResponse/DeleteResponsenow decode the server's realupserted_count/deleted_countfields (earlier versions read camelCase names the server never sent and so reported0).- The Go SDK does not use gRPC; gRPC clients written against v0.12 must send the API key in call
metadata (
x-api-keyorauthorization: Bearer).
See the examples/ directory:
basic/— vectors, namespaces, queries, filtersmemory/— store/recall memories, sessions, agent statsadvanced/— text embedding, full-text, hybrid search, analytics
| Documentation | Full API reference and guides |
| Go SDK docs | pkg.go.dev reference |
| Benchmark | LoCoMo evaluation results |
| dakera.ai | Website and early access |
| GitHub Org | All public repos |
| dakera-deploy | Self-hosting guide |
| SDK | Package |
|---|---|
| dakera-py | dakera (PyPI) |
| dakera-js | @dakera-ai/dakera (npm) |
| dakera-rs | dakera-client (crates.io) |
| 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.
