dakera

package module
v0.11.55 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 17, 2026 License: MIT Imports: 15 Imported by: 0

README ¶

Dakera AI

dakera-go

Go client for Dakera AI — the memory engine for AI agents

CI Go Reference Docs


Why Dakera?

Dakera Others
LoCoMo accuracy 87.6% (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
Dependencies stdlib net/http only Often pulls in gRPC or third-party HTTP clients

→ Full benchmark results · dakera.ai


Run Dakera

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

curl http://localhost:3300/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

go get github.com/dakera-ai/dakera-go@latest

Requires Go 1.21+. Uses only the standard library — no external runtime dependencies.


Quick Start

package main

import (
    "context"
    "fmt"
    dakera "github.com/dakera-ai/dakera-go"
)

func main() {
    client := dakera.NewClientWithOptions(dakera.ClientOptions{
        BaseURL: "http://localhost:3300",
        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)
    }
}

Context-based cancellation

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})

Text auto-embedding

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"},
})

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
  • 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.Context for cancellation and timeouts
  • Retry & Rate Limiting — built-in exponential backoff and rate-limit header tracking
  • Zero Dependencies — standard library net/http client, no external runtime deps

Connect to Dakera

// Self-hosted
client := dakera.NewClientWithOptions(dakera.ClientOptions{
    BaseURL: "http://your-server:3300",
    APIKey:  "your-key",
})

// Cloud (early access)
client := dakera.NewClientWithOptions(dakera.ClientOptions{
    BaseURL: "https://api.dakera.ai",
    APIKey:  "your-key",
})

// With custom retry config
client := dakera.NewClientWithOptions(dakera.ClientOptions{
    BaseURL:     "http://localhost:3300",
    APIKey:      "your-key",
    RetryConfig: &dakera.RetryConfig{MaxRetries: 5, BaseDelayMs: 200},
})

Examples

See the examples/ directory:

  • basic/ — vectors, namespaces, queries, filters
  • memory/ — store/recall memories, sessions, agent stats
  • advanced/ — text embedding, full-text, hybrid search, analytics

Resources

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

Other SDKs

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.

Documentation ¶

Overview ¶

Package dakera provides a Go client for Dakera AI memory platform.

Example usage:

client := dakera.NewClient("http://localhost:3000")

// Upsert vectors
resp, err := client.Upsert(ctx, "my-namespace", []dakera.VectorInput{
    {ID: "vec1", Values: []float32{0.1, 0.2, 0.3}},
})

// Query similar vectors
results, err := client.Query(ctx, "my-namespace", []float32{0.1, 0.2, 0.3}, nil)

Package dakera provides a Go client for Dakera AI memory platform.

Index ¶

Constants ¶

View Source
const (
	OpEq  = "$eq"
	OpNe  = "$ne"
	OpGt  = "$gt"
	OpGte = "$gte"
	OpLt  = "$lt"
	OpLte = "$lte"
	OpIn  = "$in"
	OpNin = "$nin"
	OpAnd = "$and"
	OpOr  = "$or"
	// Existence check
	OpExists = "$exists"
	// String operators
	OpContains   = "$contains"
	OpIContains  = "$icontains"
	OpStartsWith = "$startsWith"
	OpEndsWith   = "$endsWith"
	OpGlob       = "$glob"
	OpRegex      = "$regex"
	// Array operators (CE-79)
	OpArrayContains    = "$arrayContains"
	OpArrayContainsAll = "$arrayContainsAll"
	OpArrayContainsAny = "$arrayContainsAny"
)

Filter operators for metadata filtering.

Variables ¶

This section is empty.

Functions ¶

func And ¶

func And(conditions ...map[string]interface{}) map[string]interface{}

And creates a logical AND filter.

func ArrayContains ¶ added in v0.11.51

func ArrayContains(value interface{}) map[string]interface{}

ArrayContains creates a filter that matches when an array metadata field contains value.

func ArrayContainsAll ¶ added in v0.11.51

func ArrayContainsAll(values ...interface{}) map[string]interface{}

ArrayContainsAll creates a filter that matches when an array field contains all values.

func ArrayContainsAny ¶ added in v0.11.51

func ArrayContainsAny(values ...interface{}) map[string]interface{}

ArrayContainsAny creates a filter that matches when an array field contains any of values.

func Contains ¶ added in v0.11.51

func Contains(substr string) map[string]interface{}

Contains creates a case-sensitive substring filter.

func EndsWith ¶ added in v0.11.51

func EndsWith(suffix string) map[string]interface{}

EndsWith creates a suffix filter.

func Eq ¶

func Eq(value interface{}) map[string]interface{}

Eq creates an equality filter.

func Exists ¶ added in v0.11.51

func Exists(present bool) map[string]interface{}

Exists creates a field-existence filter.

func Glob ¶ added in v0.11.51

func Glob(pattern string) map[string]interface{}

Glob creates a glob-pattern filter (supports * and ? wildcards).

func Gt ¶

func Gt(value interface{}) map[string]interface{}

Gt creates a greater-than filter.

func Gte ¶

func Gte(value interface{}) map[string]interface{}

Gte creates a greater-than-or-equal filter.

func IContains ¶ added in v0.11.51

func IContains(substr string) map[string]interface{}

IContains creates a case-insensitive substring filter.

func In ¶

func In(values ...interface{}) map[string]interface{}

In creates an "in list" filter.

func IsAuthenticationError ¶

func IsAuthenticationError(err error) bool

IsAuthenticationError checks if an error is an AuthenticationError.

func IsAuthorizationError ¶ added in v0.6.1

func IsAuthorizationError(err error) bool

IsAuthorizationError checks if an error is an AuthorizationError.

func IsConnectionError ¶

func IsConnectionError(err error) bool

IsConnectionError checks if an error is a ConnectionError.

func IsNotFoundError ¶

func IsNotFoundError(err error) bool

IsNotFoundError checks if an error is a NotFoundError.

func IsRateLimitError ¶

func IsRateLimitError(err error) bool

IsRateLimitError checks if an error is a RateLimitError.

func IsServerError ¶

func IsServerError(err error) bool

IsServerError checks if an error is a ServerError.

func IsTimeoutError ¶

func IsTimeoutError(err error) bool

IsTimeoutError checks if an error is a TimeoutError.

func IsValidationError ¶

func IsValidationError(err error) bool

IsValidationError checks if an error is a ValidationError.

func Lt ¶

func Lt(value interface{}) map[string]interface{}

Lt creates a less-than filter.

func Lte ¶

func Lte(value interface{}) map[string]interface{}

Lte creates a less-than-or-equal filter.

func Ne ¶

func Ne(value interface{}) map[string]interface{}

Ne creates a not-equal filter.

func Nin ¶

func Nin(values ...interface{}) map[string]interface{}

Nin creates a "not in list" filter.

func Or ¶

func Or(conditions ...map[string]interface{}) map[string]interface{}

Or creates a logical OR filter.

func Regex ¶ added in v0.11.51

func Regex(pattern string) map[string]interface{}

Regex creates a regular-expression filter.

func StartsWith ¶ added in v0.11.51

func StartsWith(prefix string) map[string]interface{}

StartsWith creates a prefix filter.

Types ¶

type AgentFeedbackSummary ¶ added in v0.9.2

type AgentFeedbackSummary struct {
	AgentID       string  `json:"agent_id"`
	Upvotes       uint64  `json:"upvotes"`
	Downvotes     uint64  `json:"downvotes"`
	Flags         uint64  `json:"flags"`
	TotalFeedback uint64  `json:"total_feedback"`
	HealthScore   float32 `json:"health_score"`
}

AgentFeedbackSummary is returned by GetAgentFeedbackSummary (INT-1).

type AgentMemoriesOptions ¶

type AgentMemoriesOptions struct {
	MemoryType string `json:"memory_type,omitempty"`
	Limit      *int   `json:"limit,omitempty"`
}

AgentMemoriesOptions represents options for listing agent memories.

type AgentNetworkEdge ¶ added in v0.5.0

type AgentNetworkEdge struct {
	Source      string  `json:"source"`
	Target      string  `json:"target"`
	SourceAgent string  `json:"source_agent"`
	TargetAgent string  `json:"target_agent"`
	Similarity  float32 `json:"similarity"`
}

AgentNetworkEdge is a similarity edge between memories from two different agents.

type AgentNetworkInfo ¶ added in v0.5.0

type AgentNetworkInfo struct {
	AgentID       string  `json:"agent_id"`
	MemoryCount   int     `json:"memory_count"`
	AvgImportance float32 `json:"avg_importance"`
}

AgentNetworkInfo is summary information for one agent.

type AgentNetworkNode ¶ added in v0.5.0

type AgentNetworkNode struct {
	ID         string   `json:"id"`
	AgentID    string   `json:"agent_id"`
	Content    string   `json:"content"`
	Importance float32  `json:"importance"`
	Tags       []string `json:"tags"`
	MemoryType string   `json:"memory_type"`
	CreatedAt  int64    `json:"created_at"`
}

AgentNetworkNode is a memory node in the cross-agent network graph.

type AgentNetworkStats ¶ added in v0.5.0

type AgentNetworkStats struct {
	TotalAgents     int     `json:"total_agents"`
	TotalNodes      int     `json:"total_nodes"`
	TotalCrossEdges int     `json:"total_cross_edges"`
	Density         float32 `json:"density"`
}

AgentNetworkStats contains network-level statistics.

type AgentSessionsOptions ¶

type AgentSessionsOptions struct {
	ActiveOnly *bool `json:"active_only,omitempty"`
	Limit      *int  `json:"limit,omitempty"`
}

AgentSessionsOptions represents options for listing agent sessions.

type AgentStats ¶

type AgentStats struct {
	AgentID        string           `json:"agent_id"`
	TotalMemories  int64            `json:"total_memories"`
	MemoriesByType map[string]int64 `json:"memories_by_type"`
	TotalSessions  int64            `json:"total_sessions"`
	ActiveSessions int64            `json:"active_sessions"`
	AvgImportance  *float32         `json:"avg_importance,omitempty"`
	OldestMemoryAt string           `json:"oldest_memory_at,omitempty"`
	NewestMemoryAt string           `json:"newest_memory_at,omitempty"`
}

AgentStats represents detailed stats for an agent.

type AgentSummary ¶

type AgentSummary struct {
	AgentID        string `json:"agent_id"`
	MemoryCount    int64  `json:"memory_count"`
	SessionCount   int64  `json:"session_count"`
	ActiveSessions int64  `json:"active_sessions"`
}

AgentSummary represents summary info for an agent.

type AggregationGroup ¶

type AggregationGroup struct {
	Key     string                 `json:"key"`
	Count   int                    `json:"count"`
	Metrics map[string]interface{} `json:"metrics,omitempty"`
	TopHits []QueryResult          `json:"top_hits,omitempty"`
}

AggregationGroup represents a single aggregation group.

type AggregationRequest ¶

type AggregationRequest struct {
	Vector    []float32              `json:"vector,omitempty"`
	GroupBy   string                 `json:"group_by,omitempty"`
	Metrics   []string               `json:"metrics,omitempty"`
	TopK      *int                   `json:"top_k,omitempty"`
	Filter    map[string]interface{} `json:"filter,omitempty"`
	TopGroups *int                   `json:"top_groups,omitempty"`
}

AggregationRequest represents an aggregation request with grouping.

type AggregationResponse ¶

type AggregationResponse struct {
	Groups       []AggregationGroup `json:"groups"`
	TotalGroups  int                `json:"total_groups"`
	SearchTimeMs *int64             `json:"search_time_ms,omitempty"`
}

AggregationResponse represents the response from aggregation.

type AnalyticsOptions ¶

type AnalyticsOptions struct {
	Period    string `json:"period,omitempty"`
	Namespace string `json:"namespace,omitempty"`
}

AnalyticsOptions represents options for analytics queries.

type AnalyticsOverview ¶

type AnalyticsOverview struct {
	TotalQueries     uint64  `json:"total_queries"`
	AvgLatencyMs     float64 `json:"avg_latency_ms"`
	P95LatencyMs     float64 `json:"p95_latency_ms"`
	P99LatencyMs     float64 `json:"p99_latency_ms"`
	QueriesPerSecond float64 `json:"queries_per_second"`
	ErrorRate        float64 `json:"error_rate"`
	CacheHitRate     float64 `json:"cache_hit_rate"`
	StorageUsedBytes uint64  `json:"storage_used_bytes"`
	TotalVectors     uint64  `json:"total_vectors"`
	TotalNamespaces  uint64  `json:"total_namespaces"`
	UptimeSeconds    uint64  `json:"uptime_seconds"`
}

AnalyticsOverview represents analytics overview response.

type ApiKey ¶

type ApiKey struct {
	ID          string   `json:"id"`
	Name        string   `json:"name"`
	Key         string   `json:"key,omitempty"`
	Permissions []string `json:"permissions,omitempty"`
	CreatedAt   string   `json:"created_at"`
	ExpiresAt   string   `json:"expires_at,omitempty"`
	Active      bool     `json:"active"`
}

ApiKey represents an API key.

type AuditEvent ¶ added in v0.9.5

type AuditEvent struct {
	ID        string                 `json:"id"`
	EventType string                 `json:"event_type"`
	AgentID   string                 `json:"agent_id,omitempty"`
	Namespace string                 `json:"namespace,omitempty"`
	Timestamp int64                  `json:"timestamp"`
	Details   map[string]interface{} `json:"details,omitempty"`
}

AuditEvent is a single business-event entry from the audit log (OBS-1).

type AuditExportResponse ¶ added in v0.9.5

type AuditExportResponse struct {
	Data   string `json:"data"`
	Format string `json:"format"`
	Count  int    `json:"count"`
}

AuditExportResponse is returned by POST /v1/audit/export (OBS-1).

type AuditListResponse ¶ added in v0.9.5

type AuditListResponse struct {
	Events []AuditEvent `json:"events"`
	Total  int          `json:"total"`
	Cursor string       `json:"cursor,omitempty"`
}

AuditListResponse is returned by GET /v1/audit (OBS-1).

type AuditQuery ¶ added in v0.9.5

type AuditQuery struct {
	AgentID   string
	EventType string
	FromTs    int64
	ToTs      int64
	Limit     int
	Cursor    string
}

AuditQuery holds optional filters for audit log queries (OBS-1).

type AuthenticationError ¶

type AuthenticationError struct {
	DakeraError
}

AuthenticationError is raised when authentication fails.

func NewAuthenticationError ¶

func NewAuthenticationError(message string, statusCode int, body interface{}, code ErrorCode) *AuthenticationError

func (*AuthenticationError) Error ¶

func (e *AuthenticationError) Error() string

type AuthorizationError ¶ added in v0.6.1

type AuthorizationError struct {
	DakeraError
}

AuthorizationError is raised when the server returns a 403 Forbidden response.

func NewAuthorizationError ¶ added in v0.6.1

func NewAuthorizationError(message string, statusCode int, code ErrorCode, body interface{}) *AuthorizationError

func (*AuthorizationError) Error ¶ added in v0.6.1

func (e *AuthorizationError) Error() string

type AutoPilotConfig ¶ added in v0.7.2

type AutoPilotConfig struct {
	Enabled                    bool    `json:"enabled"`
	DedupThreshold             float32 `json:"dedup_threshold"`
	DedupIntervalHours         uint64  `json:"dedup_interval_hours"`
	ConsolidationIntervalHours uint64  `json:"consolidation_interval_hours"`
}

AutoPilotConfig represents the AutoPilot configuration.

type AutoPilotConfigRequest ¶ added in v0.7.2

type AutoPilotConfigRequest struct {
	Enabled                    *bool    `json:"enabled,omitempty"`
	DedupThreshold             *float32 `json:"dedup_threshold,omitempty"`
	DedupIntervalHours         *uint64  `json:"dedup_interval_hours,omitempty"`
	ConsolidationIntervalHours *uint64  `json:"consolidation_interval_hours,omitempty"`
}

AutoPilotConfigRequest is the request for PUT /v1/admin/autopilot/config (PILOT-2). All fields are optional — nil means "keep current value".

type AutoPilotConfigResponse ¶ added in v0.7.2

type AutoPilotConfigResponse struct {
	Success bool            `json:"success"`
	Config  AutoPilotConfig `json:"config"`
	Message string          `json:"message"`
}

AutoPilotConfigResponse is returned by PUT /v1/admin/autopilot/config (PILOT-2).

type AutoPilotConsolidationResult ¶ added in v0.7.2

type AutoPilotConsolidationResult struct {
	NamespacesProcessed  int `json:"namespaces_processed"`
	MemoriesScanned      int `json:"memories_scanned"`
	ClustersMerged       int `json:"clusters_merged"`
	MemoriesConsolidated int `json:"memories_consolidated"`
}

AutoPilotConsolidationResult is the consolidation result from a manual trigger.

type AutoPilotDedupResult ¶ added in v0.7.2

type AutoPilotDedupResult struct {
	NamespacesProcessed int `json:"namespaces_processed"`
	MemoriesScanned     int `json:"memories_scanned"`
	DuplicatesRemoved   int `json:"duplicates_removed"`
}

AutoPilotDedupResult is the dedup result from a manual trigger.

type AutoPilotStatusResponse ¶ added in v0.7.2

type AutoPilotStatusResponse struct {
	Config              AutoPilotConfig              `json:"config"`
	LastDedupAt         *uint64                      `json:"last_dedup_at,omitempty"`
	LastConsolidationAt *uint64                      `json:"last_consolidation_at,omitempty"`
	LastDedup           *DedupResultSnapshot         `json:"last_dedup,omitempty"`
	LastConsolidation   *ConsolidationResultSnapshot `json:"last_consolidation,omitempty"`
	TotalDedupRemoved   uint64                       `json:"total_dedup_removed"`
	TotalConsolidated   uint64                       `json:"total_consolidated"`
}

AutoPilotStatusResponse is returned by GET /v1/admin/autopilot/status (PILOT-1).

type AutoPilotTriggerResponse ¶ added in v0.7.2

type AutoPilotTriggerResponse struct {
	Success       bool                          `json:"success"`
	Action        string                        `json:"action"`
	Dedup         *AutoPilotDedupResult         `json:"dedup,omitempty"`
	Consolidation *AutoPilotConsolidationResult `json:"consolidation,omitempty"`
	Message       string                        `json:"message"`
}

AutoPilotTriggerResponse is returned by POST /v1/admin/autopilot/trigger (PILOT-3).

type BackupInfo ¶

type BackupInfo struct {
	ID          string `json:"id"`
	CreatedAt   string `json:"created_at"`
	SizeBytes   int64  `json:"size_bytes"`
	Status      string `json:"status"`
	IncludeData bool   `json:"include_data"`
}

BackupInfo represents backup information.

type BatchForgetRequest ¶ added in v0.7.0

type BatchForgetRequest struct {
	// AgentID is the agent whose memory namespace to purge from.
	AgentID string `json:"agent_id"`
	// Filter contains the filter predicates — at least one must be set (server safety guard).
	Filter BatchMemoryFilter `json:"filter"`
}

BatchForgetRequest is the request body for DELETE /v1/memories/forget/batch.

type BatchForgetResponse ¶ added in v0.7.0

type BatchForgetResponse struct {
	DeletedCount int `json:"deleted_count"`
}

BatchForgetResponse is the response from DELETE /v1/memories/forget/batch.

type BatchMemoryFilter ¶ added in v0.7.0

type BatchMemoryFilter struct {
	// Tags restricts to memories that carry all listed tags.
	Tags []string `json:"tags,omitempty"`
	// MinImportance is the minimum importance (inclusive).
	MinImportance *float32 `json:"min_importance,omitempty"`
	// MaxImportance is the maximum importance (inclusive).
	MaxImportance *float32 `json:"max_importance,omitempty"`
	// CreatedAfter restricts to memories created at or after this Unix timestamp (seconds).
	CreatedAfter *int64 `json:"created_after,omitempty"`
	// CreatedBefore restricts to memories created before or at this Unix timestamp (seconds).
	CreatedBefore *int64 `json:"created_before,omitempty"`
	// MemoryType restricts to a specific memory type (e.g. "episodic").
	MemoryType string `json:"memory_type,omitempty"`
	// SessionID restricts to memories from a specific session.
	SessionID string `json:"session_id,omitempty"`
}

BatchMemoryFilter holds filter predicates for batch memory operations (CE-2).

All fields are optional. For BatchForget at least one must be set (server-side safety guard).

type BatchQuerySpec ¶

type BatchQuerySpec struct {
	Vector          []float32              `json:"vector"`
	TopK            int                    `json:"top_k,omitempty"`
	Filter          map[string]interface{} `json:"filter,omitempty"`
	IncludeValues   bool                   `json:"include_values,omitempty"`
	IncludeMetadata bool                   `json:"include_metadata,omitempty"`
}

BatchQuerySpec represents a single query in a batch query request.

type BatchRecallRequest ¶ added in v0.7.0

type BatchRecallRequest struct {
	// AgentID is the agent whose memory namespace to search.
	AgentID string `json:"agent_id"`
	// Filter contains the filter predicates to apply.
	Filter BatchMemoryFilter `json:"filter"`
	// Limit is the maximum number of results to return (default: 100).
	Limit int `json:"limit,omitempty"`
}

BatchRecallRequest is the request body for POST /v1/memories/recall/batch.

type BatchRecallResponse ¶ added in v0.7.0

type BatchRecallResponse struct {
	Memories []RecalledMemory `json:"memories"`
	// Total is the total memories in the agent namespace.
	Total int `json:"total"`
	// Filtered is the number of memories that passed the filter.
	Filtered int `json:"filtered"`
}

BatchRecallResponse is the response from POST /v1/memories/recall/batch.

type BatchTextQueryOptions ¶

type BatchTextQueryOptions struct {
	TopK           int                    `json:"top_k,omitempty"`
	Filter         map[string]interface{} `json:"filter,omitempty"`
	IncludeVectors bool                   `json:"include_vectors,omitempty"`
	Model          EmbeddingModel         `json:"model,omitempty"`
}

BatchTextQueryOptions represents options for batch text query operations.

type BatchTextQueryResponse ¶

type BatchTextQueryResponse struct {
	Results         [][]TextSearchResult `json:"results"`
	Model           EmbeddingModel       `json:"model"`
	EmbeddingTimeMs int64                `json:"embedding_time_ms"`
	SearchTimeMs    int64                `json:"search_time_ms"`
}

BatchTextQueryResponse represents the response from a batch text query operation.

type CacheStats ¶

type CacheStats struct {
	TotalEntries int     `json:"total_entries"`
	HitRate      float64 `json:"hit_rate"`
	MemoryBytes  int64   `json:"memory_bytes"`
}

CacheStats represents cache statistics.

type Client ¶

type Client struct {
	// contains filtered or unexported fields
}

Client is the Dakera client for interacting with the vector database.

func NewClient ¶

func NewClient(baseURL string) *Client

NewClient creates a new Dakera client with the given base URL.

func NewClientWithOptions ¶

func NewClientWithOptions(opts ClientOptions) *Client

NewClientWithOptions creates a new Dakera client with custom options.

func (*Client) AdminFulltextReindex ¶ added in v0.11.51

func (c *Client) AdminFulltextReindex(ctx context.Context, namespace string) (*FulltextReindexResponse, error)

AdminFulltextReindex backfills the BM25 fulltext index for memories stored before CE-12 auto-indexing was added (CE-54).

Sends POST /admin/fulltext/reindex. Requires Admin scope.

Pass a non-empty namespace to limit reindexing to that namespace, or an empty string to reindex all agent namespaces. Safe to call multiple times — already-indexed memories are counted in TotalSkipped and not re-processed.

func (*Client) AdminIndexStats ¶

func (c *Client) AdminIndexStats(ctx context.Context, namespace string) (map[string]interface{}, error)

AdminIndexStats gets index stats for a namespace via admin endpoint.

func (*Client) AgentGraphExport ¶ added in v0.9.0

func (c *Client) AgentGraphExport(ctx context.Context, agentID, format string) (*GraphExport, error)

AgentGraphExport exports the full knowledge graph for an agent.

Requires CE-5 (Memory Knowledge Graph) on the server.

format should be "json" (default), "graphml", or "csv".

func (*Client) AgentMemories ¶

func (c *Client) AgentMemories(ctx context.Context, agentID string, opts *AgentMemoriesOptions) ([]RecalledMemory, error)

AgentMemories gets memories for an agent.

func (*Client) AgentSessions ¶

func (c *Client) AgentSessions(ctx context.Context, agentID string, opts *AgentSessionsOptions) ([]Session, error)

AgentSessions gets sessions for an agent.

func (*Client) AgentStats ¶

func (c *Client) AgentStats(ctx context.Context, agentID string) (*AgentStats, error)

AgentStats gets stats for an agent.

func (*Client) Aggregate ¶

func (c *Client) Aggregate(ctx context.Context, namespace string, req AggregationRequest) (*AggregationResponse, error)

Aggregate performs aggregation with grouping.

func (*Client) AnalyticsLatency ¶

func (c *Client) AnalyticsLatency(ctx context.Context, opts *AnalyticsOptions) (*LatencyAnalytics, error)

AnalyticsLatency gets latency analytics.

func (*Client) AnalyticsOverview ¶

func (c *Client) AnalyticsOverview(ctx context.Context, opts *AnalyticsOptions) (*AnalyticsOverview, error)

AnalyticsOverview gets the analytics overview.

func (*Client) AnalyticsStorage ¶

func (c *Client) AnalyticsStorage(ctx context.Context, namespace string) (*StorageAnalytics, error)

AnalyticsStorage gets storage analytics.

func (*Client) AnalyticsThroughput ¶

func (c *Client) AnalyticsThroughput(ctx context.Context, opts *AnalyticsOptions) (*ThroughputAnalytics, error)

AnalyticsThroughput gets throughput analytics.

func (*Client) AutopilotStatus ¶ added in v0.7.2

func (c *Client) AutopilotStatus(ctx context.Context) (*AutoPilotStatusResponse, error)

AutopilotStatus returns the current AutoPilot config and last-run statistics (PILOT-1).

func (*Client) AutopilotTrigger ¶ added in v0.7.2

func (c *Client) AutopilotTrigger(ctx context.Context, action string) (*AutoPilotTriggerResponse, error)

AutopilotTrigger manually triggers an AutoPilot dedup or consolidation cycle (PILOT-3). action must be one of "dedup", "consolidate", or "all".

func (*Client) AutopilotUpdateConfig ¶ added in v0.7.2

func (c *Client) AutopilotUpdateConfig(ctx context.Context, req AutoPilotConfigRequest) (*AutoPilotConfigResponse, error)

AutopilotUpdateConfig updates the AutoPilot configuration at runtime (PILOT-2). All fields in req are optional — nil means "keep current value".

func (*Client) BatchForget ¶ added in v0.7.0

func (c *Client) BatchForget(ctx context.Context, req BatchForgetRequest) (*BatchForgetResponse, error)

BatchForget bulk-deletes memories using filter predicates (CE-2).

Uses DELETE /v1/memories/forget/batch. At least one filter predicate must be set (server safety guard).

Example:

ts := time.Now().Add(-24 * time.Hour).Unix()
resp, err := client.BatchForget(ctx, BatchForgetRequest{
    AgentID: "agent-1",
    Filter:  BatchMemoryFilter{CreatedBefore: &ts},
})

func (*Client) BatchQuery ¶

func (c *Client) BatchQuery(ctx context.Context, namespace string, queries []BatchQuerySpec) ([]SearchResult, error)

BatchQuery executes multiple queries in a single request.

func (*Client) BatchQueryText ¶

func (c *Client) BatchQueryText(ctx context.Context, namespace string, queries []string, opts *BatchTextQueryOptions) (*BatchTextQueryResponse, error)

BatchQueryText executes multiple text queries with automatic embedding in a single request.

func (*Client) BatchRecall ¶ added in v0.7.0

func (c *Client) BatchRecall(ctx context.Context, req BatchRecallRequest) (*BatchRecallResponse, error)

BatchRecall bulk-recalls memories using filter predicates (CE-2).

Uses POST /v1/memories/recall/batch — no embedding required.

Example:

minImp := float32(0.7)
resp, err := client.BatchRecall(ctx, BatchRecallRequest{
    AgentID: "agent-1",
    Filter:  BatchMemoryFilter{MinImportance: &minImp},
    Limit:   50,
})

func (*Client) CacheClear ¶

func (c *Client) CacheClear(ctx context.Context, namespace string) (*StatusResponse, error)

CacheClear clears cache, optionally for a specific namespace.

func (*Client) CacheStats ¶

func (c *Client) CacheStats(ctx context.Context) (*CacheStats, error)

CacheStats gets cache statistics.

func (*Client) ClusterNodes ¶

func (c *Client) ClusterNodes(ctx context.Context) ([]ClusterNode, error)

ClusterNodes gets the cluster nodes.

func (*Client) ClusterStatus ¶

func (c *Client) ClusterStatus(ctx context.Context) (*ClusterStatus, error)

ClusterStatus gets the cluster status.

func (*Client) Compact ¶

func (c *Client) Compact(ctx context.Context, namespace string) (*StatusResponse, error)

Compact triggers compaction for a namespace.

func (*Client) CompressAgent ¶ added in v0.10.0

func (c *Client) CompressAgent(ctx context.Context, agentID string) (*CompressResponse, error)

CompressAgent runs a server-side compression pass on the agent's memory namespace (CE-12). Returns statistics about the compression operation.

func (*Client) ConfigureNamespace ¶ added in v0.6.0

func (c *Client) ConfigureNamespace(ctx context.Context, namespace string, req ConfigureNamespaceRequest) (*ConfigureNamespaceResponse, error)

ConfigureNamespace creates or updates a namespace configuration (upsert semantics — v0.6.0).

Creates the namespace if it does not exist, or updates its distance-metric configuration if it already exists. Dimension changes are rejected by the server to prevent silent data corruption. Requires Write scope.

func (*Client) ConfigureNamespaceExtractor ¶ added in v0.9.5

func (c *Client) ConfigureNamespaceExtractor(ctx context.Context, namespace string, provider string, model string) error

ConfigureNamespaceExtractor sets the default extraction provider for a namespace (EXT-1). PATCH /v1/namespaces/{namespace}/extractor model is optional (empty = server default).

func (*Client) ConfigureNamespaceNer ¶ added in v0.9.0

func (c *Client) ConfigureNamespaceNer(ctx context.Context, namespace string, config NamespaceNerConfig) (map[string]interface{}, error)

ConfigureNamespaceNer configures entity extraction for a namespace (CE-4). PATCH /v1/namespaces/{namespace}/config — requires Write scope.

func (*Client) ConfigureTTL ¶

func (c *Client) ConfigureTTL(ctx context.Context, namespace string, ttlSeconds int, strategy string) (*TtlConfig, error)

ConfigureTTL configures TTL for a namespace.

func (*Client) Consolidate ¶

func (c *Client) Consolidate(ctx context.Context, agentID string, req ConsolidateRequest) (*ConsolidateResponse, error)

Consolidate consolidates memories for an agent.

func (*Client) CreateBackup ¶

func (c *Client) CreateBackup(ctx context.Context, includeData bool) (*BackupInfo, error)

CreateBackup creates a backup.

func (*Client) CreateKey ¶

func (c *Client) CreateKey(ctx context.Context, req CreateKeyRequest) (*ApiKey, error)

CreateKey creates a new API key.

func (*Client) CreateNamespace ¶

func (c *Client) CreateNamespace(ctx context.Context, namespace string, opts *CreateNamespaceOptions) (*NamespaceInfo, error)

CreateNamespace creates a new namespace.

func (*Client) CreateNamespaceKey ¶ added in v0.9.2

func (c *Client) CreateNamespaceKey(ctx context.Context, namespace string, req CreateNamespaceKeyRequest) (*CreateNamespaceKeyResponse, error)

CreateNamespaceKey creates a namespace-scoped API key (SEC-1). POST /v1/namespaces/{namespace}/keys The Key field in the response is shown only once — store it securely.

func (*Client) CrossAgentNetwork ¶ added in v0.5.0

CrossAgentNetwork builds the cross-agent memory similarity network. POST /v1/knowledge/network/cross-agent — requires Admin scope.

func (*Client) DeactivateKey ¶

func (c *Client) DeactivateKey(ctx context.Context, keyID string) (*ApiKey, error)

DeactivateKey deactivates an API key.

func (*Client) DecayConfig ¶ added in v0.7.3

func (c *Client) DecayConfig(ctx context.Context) (*DecayConfigResponse, error)

DecayConfig returns the current decay engine configuration (DECAY-1). Requires Admin scope.

func (*Client) DecayStats ¶ added in v0.7.3

func (c *Client) DecayStats(ctx context.Context) (*DecayStatsResponse, error)

DecayStats returns cumulative decay counters and a last-cycle snapshot (DECAY-2). Requires Admin scope.

func (*Client) DecayUpdateConfig ¶ added in v0.7.3

DecayUpdateConfig updates the decay engine configuration at runtime (DECAY-1). Changes take effect on the next decay cycle — no restart required. All fields in req are optional; omit any to keep its current value. Requires Admin scope.

func (*Client) Deduplicate ¶

func (c *Client) Deduplicate(ctx context.Context, req DeduplicateRequest) (*DeduplicateResponse, error)

Deduplicate deduplicates memories.

func (*Client) Delete ¶

func (c *Client) Delete(ctx context.Context, namespace string, opts DeleteOptions) (*DeleteResponse, error)

Delete removes vectors from a namespace.

func (*Client) DeleteBackup ¶

func (c *Client) DeleteBackup(ctx context.Context, backupID string) error

DeleteBackup deletes a backup.

func (*Client) DeleteKey ¶

func (c *Client) DeleteKey(ctx context.Context, keyID string) error

DeleteKey deletes an API key.

func (*Client) DeleteNamespace ¶

func (c *Client) DeleteNamespace(ctx context.Context, namespace string) error

DeleteNamespace deletes a namespace.

func (*Client) DeleteNamespaceKey ¶ added in v0.9.2

func (c *Client) DeleteNamespaceKey(ctx context.Context, namespace string, keyID string) (*KeySuccessResponse, error)

DeleteNamespaceKey revokes a namespace-scoped API key (SEC-1). DELETE /v1/namespaces/{namespace}/keys/{keyID}

func (*Client) EndSession ¶

func (c *Client) EndSession(ctx context.Context, sessionID string) (*SessionEndResponse, error)

EndSession ends a session and returns the session state and memory count.

func (*Client) ExplainQuery ¶

func (c *Client) ExplainQuery(ctx context.Context, namespace string, req QueryExplainRequest) (*QueryExplainResponse, error)

ExplainQuery explains a query execution plan and returns timing information.

func (*Client) ExportAudit ¶ added in v0.9.5

func (c *Client) ExportAudit(ctx context.Context, format string, agentID string, eventType string, fromTs int64, toTs int64) (*AuditExportResponse, error)

ExportAudit bulk-exports audit log entries (OBS-1). POST /v1/audit/export agentID, eventType, fromTs, and toTs are optional (zero/empty = omitted).

func (*Client) ExportMemories ¶ added in v0.9.5

func (c *Client) ExportMemories(ctx context.Context, format string, agentID string, namespace string, limit int) (*MemoryExportResponse, error)

ExportMemories exports memories in a portable format (DX-1). GET /v1/export format: "mem0", "zep", "jsonl", or "csv". agentID, namespace, and limit are optional (zero/empty = omitted).

func (*Client) ExportVectors ¶

func (c *Client) ExportVectors(ctx context.Context, namespace string, req ExportRequest) (*ExportResponse, error)

ExportVectors exports vectors with pagination.

func (*Client) ExtractEntities ¶ added in v0.9.0

func (c *Client) ExtractEntities(ctx context.Context, text string, entityTypes []string) (*EntityExtractionResponse, error)

ExtractEntities extracts named entities from arbitrary text using GLiNER (CE-4). POST /v1/memories/extract — requires Read scope. entityTypes may be nil to use the server default types.

func (*Client) ExtractText ¶ added in v0.9.5

func (c *Client) ExtractText(ctx context.Context, text string, namespace string, provider string, model string) (*ExtractionResult, error)

ExtractText extracts entities from text using a pluggable provider (EXT-1). POST /v1/extract namespace, provider, and model are optional (empty = server default).

func (*Client) FeedbackMemory ¶ added in v0.9.2

func (c *Client) FeedbackMemory(ctx context.Context, memoryID string, agentID string, signal FeedbackSignal) (*FeedbackResponse, error)

FeedbackMemory submits upvote/downvote/flag feedback on a memory (INT-1).

Signals:

  • FeedbackSignalUpvote: boosts importance ×1.15 (capped at 1.0).
  • FeedbackSignalDownvote: penalises importance ×0.85 (floor 0.0).
  • FeedbackSignalFlag: marks as irrelevant — accelerates decay on next cycle.

func (*Client) Fetch ¶

func (c *Client) Fetch(ctx context.Context, namespace string, ids []string, opts *FetchOptions) ([]Vector, error)

Fetch retrieves vectors by ID from a namespace.

func (*Client) Flush ¶

func (c *Client) Flush(ctx context.Context, namespace string) (*StatusResponse, error)

Flush flushes pending writes for a namespace.

func (*Client) Forget ¶

func (c *Client) Forget(ctx context.Context, agentID, memoryID string) error

Forget deletes a memory.

func (*Client) FullKnowledgeGraph ¶

func (c *Client) FullKnowledgeGraph(ctx context.Context, req FullKnowledgeGraphRequest) (*KnowledgeGraphResponse, error)

FullKnowledgeGraph builds a full knowledge graph for an agent.

func (*Client) FulltextSearch ¶

func (c *Client) FulltextSearch(ctx context.Context, namespace string, query string, opts *FullTextSearchOptions) ([]FullTextSearchResult, error)

FulltextSearch performs a full-text search.

func (*Client) GetAgentFeedbackSummary ¶ added in v0.9.2

func (c *Client) GetAgentFeedbackSummary(ctx context.Context, agentID string) (*AgentFeedbackSummary, error)

GetAgentFeedbackSummary returns aggregate feedback counts and health score for an agent (INT-1).

func (*Client) GetConfig ¶

func (c *Client) GetConfig(ctx context.Context) (map[string]interface{}, error)

GetConfig gets the server configuration.

func (*Client) GetFeedbackHealth ¶ added in v0.9.2

func (c *Client) GetFeedbackHealth(ctx context.Context, agentID string) (*FeedbackHealthResponse, error)

GetFeedbackHealth returns overall feedback health score for an agent (INT-1).

The health score is the mean importance of all non-expired memories (0.0–1.0). A higher score indicates a healthier, more relevant memory store.

func (*Client) GetIndexStats ¶

func (c *Client) GetIndexStats(ctx context.Context, namespace string) (*IndexStats, error)

GetIndexStats returns index statistics for a namespace.

func (*Client) GetKey ¶

func (c *Client) GetKey(ctx context.Context, keyID string) (*ApiKey, error)

GetKey gets an API key by ID.

func (*Client) GetKpis ¶ added in v0.9.12

func (c *Client) GetKpis(ctx context.Context) (*KpiSnapshot, error)

GetKpis returns a point-in-time product KPI snapshot (OBS-2).

Calls GET /v1/kpis. Returns 8 operational metrics covering latency, error rate, and retention. Sub-millisecond — served from in-memory counters. Requires Admin scope.

func (*Client) GetMemory ¶

func (c *Client) GetMemory(ctx context.Context, agentID, memoryID string) (*Memory, error)

GetMemory gets a specific memory.

func (*Client) GetMemoryFeedbackHistory ¶ added in v0.9.2

func (c *Client) GetMemoryFeedbackHistory(ctx context.Context, memoryID string) (*FeedbackHistoryResponse, error)

GetMemoryFeedbackHistory returns the full feedback history for a memory (INT-1).

func (*Client) GetMemoryPolicy ¶ added in v0.9.8

func (c *Client) GetMemoryPolicy(ctx context.Context, namespace string) (*MemoryPolicy, error)

GetMemoryPolicy returns the memory lifecycle policy for a namespace (COG-1).

Sends GET /v1/namespaces/{namespace}/memory_policy.

When no explicit policy has been configured the server returns the COG-1 defaults: working=4 h, episodic=30 d, semantic=365 d, procedural=730 d; exponential/power_law/logarithmic/flat decay curves; SR factor 1.0.

func (*Client) GetNamespace ¶

func (c *Client) GetNamespace(ctx context.Context, namespace string) (*NamespaceInfo, error)

GetNamespace returns information about a specific namespace.

func (*Client) GetQuotas ¶

func (c *Client) GetQuotas(ctx context.Context) (map[string]interface{}, error)

GetQuotas gets quota settings.

func (*Client) GetSession ¶

func (c *Client) GetSession(ctx context.Context, sessionID string) (*Session, error)

GetSession gets session details.

func (*Client) GetWakeUpContext ¶ added in v0.9.14

func (c *Client) GetWakeUpContext(ctx context.Context, agentID string, opts *WakeUpOptions) (*WakeUpResponse, error)

GetWakeUpContext returns top-N wake-up context memories for an agent (DAK-1690).

Calls GET /v1/agents/{agent_id}/wake-up. Returns memories ranked by importance × exp(-ln2 × age / 14d) — no embedding inference, served from the metadata index for sub-millisecond latency.

Requires Read scope on the agent namespace.

func (*Client) Health ¶

func (c *Client) Health(ctx context.Context) (*HealthResponse, error)

Health checks the server health.

func (*Client) HybridSearch ¶

func (c *Client) HybridSearch(ctx context.Context, namespace string, vector []float32, query string, opts *HybridSearchOptions) ([]HybridSearchResult, error)

HybridSearch performs a hybrid search combining vector and full-text.

When vector is nil the server falls back to BM25-only full-text search. When provided, results are blended with vector similarity according to opts.VectorWeight.

func (*Client) ImportMemories ¶ added in v0.9.5

func (c *Client) ImportMemories(ctx context.Context, data interface{}, format string, agentID string, namespace string) (*MemoryImportResponse, error)

ImportMemories imports memories from an external format (DX-1). POST /v1/import format: "mem0", "zep", "jsonl", or "csv". agentID and namespace are optional.

func (*Client) IndexDocuments ¶

func (c *Client) IndexDocuments(ctx context.Context, namespace string, documents []DocumentInput) (*IndexDocumentsResponse, error)

IndexDocuments indexes documents for full-text search.

func (*Client) KeyUsage ¶

func (c *Client) KeyUsage(ctx context.Context, keyID string) (*KeyUsage, error)

KeyUsage gets usage statistics for an API key.

func (*Client) KnowledgeExport ¶ added in v0.9.7

func (c *Client) KnowledgeExport(ctx context.Context, agentID, format string) (*KgExportResponse, error)

KnowledgeExport exports the memory knowledge graph as JSON or GraphML (KG-2). GET /v1/knowledge/export

format is "json" (default) or "graphml". For graphml the server returns application/xml — this method deserializes JSON only.

func (*Client) KnowledgeGraph ¶

func (c *Client) KnowledgeGraph(ctx context.Context, req KnowledgeGraphRequest) (*KnowledgeGraphResponse, error)

KnowledgeGraph builds a knowledge graph from a seed memory.

func (*Client) KnowledgePath ¶ added in v0.9.7

func (c *Client) KnowledgePath(ctx context.Context, agentID, fromID, toID string) (*KgPathResponse, error)

KnowledgePath finds the BFS shortest path between two memory IDs (KG-2). GET /v1/knowledge/path

Returns an error if no path exists between fromID and toID.

func (*Client) KnowledgeQuery ¶ added in v0.9.7

func (c *Client) KnowledgeQuery(
	ctx context.Context,
	agentID string,
	rootID string,
	edgeType string,
	minWeight float64,
	maxDepth int,
	limit int,
) (*KgQueryResponse, error)

KnowledgeQuery queries the memory knowledge graph using a filter DSL (KG-2). GET /v1/knowledge/query

agentID is required. Optional params: rootID (BFS root memory), edgeType (comma-separated, e.g. "related_to,shares_entity"), minWeight (0.0–1.0), maxDepth (1–5, default 3), limit (default 100, max 1000).

func (*Client) LastRateLimitHeaders ¶ added in v0.7.0

func (c *Client) LastRateLimitHeaders() *RateLimitHeaders

LastRateLimitHeaders returns the rate-limit headers from the most recent API response (OPS-1). Returns nil until the first request has been made.

func (*Client) ListAgents ¶

func (c *Client) ListAgents(ctx context.Context) ([]AgentSummary, error)

ListAgents lists all agents.

func (*Client) ListAuditEvents ¶ added in v0.9.5

func (c *Client) ListAuditEvents(ctx context.Context, query AuditQuery) (*AuditListResponse, error)

ListAuditEvents queries the paginated business-event audit log (OBS-1). GET /v1/audit

func (*Client) ListBackups ¶

func (c *Client) ListBackups(ctx context.Context) ([]BackupInfo, error)

ListBackups lists all backups.

func (*Client) ListExtractProviders ¶ added in v0.9.5

func (c *Client) ListExtractProviders(ctx context.Context) ([]ExtractionProviderInfo, error)

ListExtractProviders lists available extraction providers (EXT-1). GET /v1/extract/providers

func (*Client) ListKeys ¶

func (c *Client) ListKeys(ctx context.Context) ([]ApiKey, error)

ListKeys lists all API keys.

func (*Client) ListNamespaceKeys ¶ added in v0.9.2

func (c *Client) ListNamespaceKeys(ctx context.Context, namespace string) (*ListNamespaceKeysResponse, error)

ListNamespaceKeys lists all API keys scoped to a namespace (SEC-1). GET /v1/namespaces/{namespace}/keys

func (*Client) ListNamespaces ¶

func (c *Client) ListNamespaces(ctx context.Context) ([]string, error)

ListNamespaces returns all namespaces.

func (*Client) ListSessions ¶

func (c *Client) ListSessions(ctx context.Context, opts *ListSessionsOptions) ([]Session, error)

ListSessions lists sessions with optional filters.

func (*Client) MemoryEntities ¶ added in v0.9.0

func (c *Client) MemoryEntities(ctx context.Context, memoryID string) (*MemoryEntitiesResponse, error)

MemoryEntities returns the entity tags attached to a stored memory (CE-4). GET /v1/memory/entities/{memoryID} — requires Read scope.

func (*Client) MemoryFeedback ¶

func (c *Client) MemoryFeedback(ctx context.Context, agentID string, req MemoryFeedbackRequest) (*MemoryFeedbackResponse, error)

MemoryFeedback submits feedback on a memory recall.

func (*Client) MemoryGraph ¶ added in v0.9.0

func (c *Client) MemoryGraph(ctx context.Context, memoryID string, opts *GraphOptions) (*MemoryGraph, error)

MemoryGraph traverses the knowledge graph from a memory node.

Requires CE-5 (Memory Knowledge Graph) on the server.

Example:

graph, err := client.MemoryGraph(ctx, "mem-abc", &GraphOptions{Depth: 2})
if err != nil { ... }
fmt.Printf("%d nodes, %d edges\n", len(graph.Nodes), len(graph.Edges))
func (c *Client) MemoryLink(ctx context.Context, sourceID, targetID string, edgeType EdgeType) (*GraphLinkResponse, error)

MemoryLink creates an explicit edge between two memories.

Requires CE-5 (Memory Knowledge Graph) on the server.

func (*Client) MemoryPath ¶ added in v0.9.0

func (c *Client) MemoryPath(ctx context.Context, sourceID, targetID string) (*GraphPath, error)

MemoryPath finds the shortest path between two memories in the knowledge graph.

Requires CE-5 (Memory Knowledge Graph) on the server.

func (*Client) MultiVectorSearch ¶

func (c *Client) MultiVectorSearch(ctx context.Context, namespace string, req MultiVectorSearchRequest) (*MultiVectorSearchResponse, error)

MultiVectorSearch performs a multi-vector search with positive/negative vectors and optional MMR.

func (*Client) NamespaceKeyUsage ¶ added in v0.9.2

func (c *Client) NamespaceKeyUsage(ctx context.Context, namespace string, keyID string) (*NamespaceKeyUsageResponse, error)

NamespaceKeyUsage returns usage statistics for a namespace-scoped API key (SEC-1). GET /v1/namespaces/{namespace}/keys/{keyID}/usage

func (*Client) OdeExtractEntities ¶ added in v0.9.6

func (c *Client) OdeExtractEntities(ctx context.Context, req ExtractEntitiesRequest) (*ExtractEntitiesResponse, error)

OdeExtractEntities extracts named entities from text using the GLiNER sidecar (ODE-2). Calls POST /ode/extract on the dakera-ode sidecar.

Unlike ExtractEntities (CE-4 server-side NER), this method calls the dedicated GLiNER sidecar and returns character offsets, model name, and processing time.

Requires OdeURL to be set in ClientOptions.

func (*Client) OpsMetrics ¶ added in v0.9.3

func (c *Client) OpsMetrics(ctx context.Context) (string, error)

OpsMetrics returns the Prometheus metrics in text exposition format (INFRA-3). Requires Admin scope. Returns the raw Prometheus text exposition format string suitable for scraping by a Prometheus server.

func (*Client) OpsStats ¶ added in v0.8.5

func (c *Client) OpsStats(ctx context.Context) (*OpsStats, error)

OpsStats gets server stats (version, total_vectors, namespace_count, uptime_seconds, timestamp, state). Requires Read scope — works with read-only API keys, unlike ClusterStatus.

func (*Client) OptimizeNamespace ¶

func (c *Client) OptimizeNamespace(ctx context.Context, namespace string) (*StatusResponse, error)

OptimizeNamespace optimizes a namespace.

func (*Client) PatchMemoryImportance ¶ added in v0.9.2

func (c *Client) PatchMemoryImportance(ctx context.Context, memoryID string, agentID string, importance float32) (*FeedbackResponse, error)

PatchMemoryImportance directly overrides a memory's importance score (INT-1).

func (*Client) Query ¶

func (c *Client) Query(ctx context.Context, namespace string, vector []float32, opts *QueryOptions) (*SearchResult, error)

Query searches for similar vectors in a namespace.

func (*Client) QueryText ¶

func (c *Client) QueryText(ctx context.Context, namespace string, text string, opts *TextQueryOptions) (*TextQueryResponse, error)

QueryText queries using natural language text with automatic embedding. The query text is embedded and used for similarity search.

func (*Client) RebuildIndexes ¶

func (c *Client) RebuildIndexes(ctx context.Context, namespace string) (*StatusResponse, error)

RebuildIndexes rebuilds indexes for a namespace.

func (*Client) Recall ¶

func (c *Client) Recall(ctx context.Context, agentID string, req RecallRequest) (*RecallResponse, error)

Recall recalls memories for an agent.

Set req.IncludeAssociated = true to enable COG-2 associative recall — the response will include AssociatedMemories surfaced via KG depth-1 traversal from the primary results.

func (*Client) RestoreBackup ¶

func (c *Client) RestoreBackup(ctx context.Context, backupID string) (*StatusResponse, error)

RestoreBackup restores a backup.

func (*Client) RotateEncryptionKey ¶ added in v0.9.5

func (c *Client) RotateEncryptionKey(ctx context.Context, newKey string, namespace string) (*RotateEncryptionKeyResponse, error)

RotateEncryptionKey re-encrypts all memory content blobs with a new AES-256-GCM key (SEC-3). POST /v1/admin/encryption/rotate-key.

After this call the new key is active in the running process. The operator must update DAKERA_ENCRYPTION_KEY and restart to make the rotation durable.

Requires Admin scope. Pass namespace="" to rotate all namespaces.

func (*Client) RotateKey ¶

func (c *Client) RotateKey(ctx context.Context, keyID string) (*ApiKey, error)

RotateKey rotates an API key.

func (*Client) SearchMemories ¶

func (c *Client) SearchMemories(ctx context.Context, agentID string, req SearchMemoriesRequest) ([]RecalledMemory, error)

SearchMemories searches memories for an agent.

func (*Client) SessionMemories ¶

func (c *Client) SessionMemories(ctx context.Context, sessionID string) ([]RecalledMemory, error)

SessionMemories gets memories for a session.

func (*Client) SetMemoryPolicy ¶ added in v0.9.8

func (c *Client) SetMemoryPolicy(ctx context.Context, namespace string, policy MemoryPolicy) (*MemoryPolicy, error)

SetMemoryPolicy sets the memory lifecycle policy for a namespace (COG-1).

Sends PUT /v1/namespaces/{namespace}/memory_policy.

The policy is persisted in namespace config and applied immediately to the decay engine background task. Only populate the fields you want to override — all have safe server-side defaults.

func (*Client) SlowQueries ¶

func (c *Client) SlowQueries(ctx context.Context, opts *SlowQueryOptions) ([]SlowQuery, error)

SlowQueries gets slow queries.

func (*Client) StartSession ¶

func (c *Client) StartSession(ctx context.Context, req StartSessionRequest) (*Session, error)

StartSession starts a new session.

func (*Client) StoreMemory ¶

func (c *Client) StoreMemory(ctx context.Context, agentID string, req StoreMemoryRequest) (*StoreMemoryResponse, error)

StoreMemory stores a memory for an agent.

func (*Client) StreamAuditEvents ¶ added in v0.9.5

func (c *Client) StreamAuditEvents(ctx context.Context, agentID string, eventType string) (<-chan EventResult, error)

StreamAuditEvents opens a live SSE stream of audit events (OBS-1).

It connects to GET /v1/audit/stream and sends EventResult values to the returned channel. The channel is closed when the server closes the stream or ctx is cancelled.

agentID and eventType are optional filters (empty = no filter).

Requires an Admin-scoped API key.

func (*Client) StreamGlobalEvents ¶ added in v0.4.0

func (c *Client) StreamGlobalEvents(ctx context.Context) (<-chan EventResult, error)

StreamGlobalEvents subscribes to the global SSE event stream (all namespaces).

It opens a long-lived connection to GET /ops/events and sends EventResult values to the returned channel.

Requires an Admin-scoped API key.

func (*Client) StreamMemoryEvents ¶ added in v0.5.0

func (c *Client) StreamMemoryEvents(ctx context.Context) (<-chan MemoryEventResult, error)

StreamMemoryEvents subscribes to memory lifecycle SSE events.

It opens a long-lived connection to GET /v1/events/stream and sends MemoryEventResult values to the returned channel. The channel is closed when the server closes the stream or ctx is cancelled.

Requires a Read-scoped API key.

func (*Client) StreamNamespaceEvents ¶ added in v0.4.0

func (c *Client) StreamNamespaceEvents(ctx context.Context, namespace string) (<-chan EventResult, error)

StreamNamespaceEvents subscribes to namespace-scoped SSE events.

It opens a long-lived connection to GET /v1/namespaces/{namespace}/events and sends EventResult values to the returned channel. The channel is closed when the server closes the stream or ctx is cancelled.

Requires a Read-scoped API key.

Example:

ch, err := client.StreamNamespaceEvents(ctx, "my-ns")
if err != nil {
    log.Fatal(err)
}
for result := range ch {
    if result.Err != nil {
        log.Println("stream error:", result.Err)
        break
    }
    fmt.Printf("event: %s\n", result.Event.Type)
}

func (*Client) SubscribeAgentMemories ¶ added in v0.9.0

func (c *Client) SubscribeAgentMemories(ctx context.Context, agentID string, tags []string) (<-chan MemoryEventResult, error)

SubscribeAgentMemories subscribes to real-time memory lifecycle events for a specific agent.

It wraps Client.StreamMemoryEvents, filtering events by agentID and an optional tags list. When tags is non-empty, only events whose tags have at least one element in common with the filter are forwarded. The connection is re-established automatically on error until ctx is cancelled.

The returned channel is closed when ctx is cancelled or the parent context is done.

Requires a Read-scoped API key.

Example:

ch, err := client.SubscribeAgentMemories(ctx, "my-bot", []string{"important"})
if err != nil {
    log.Fatal(err)
}
for result := range ch {
    if result.Err != nil {
        log.Println("stream error:", result.Err)
        continue
    }
    fmt.Printf("%s: %v\n", result.Event.EventType, result.Event.MemoryID)
}

func (*Client) Summarize ¶

func (c *Client) Summarize(ctx context.Context, req SummarizeRequest) (*SummarizeResponse, error)

Summarize summarizes memories.

func (*Client) UnifiedQuery ¶

func (c *Client) UnifiedQuery(ctx context.Context, namespace string, req UnifiedQueryRequest) (*UnifiedQueryResponse, error)

UnifiedQuery performs a unified query combining vector and text search.

func (*Client) UpdateConfig ¶

func (c *Client) UpdateConfig(ctx context.Context, config map[string]interface{}) (map[string]interface{}, error)

UpdateConfig updates the server configuration.

func (*Client) UpdateImportance ¶

func (c *Client) UpdateImportance(ctx context.Context, agentID string, req UpdateImportanceRequest) error

UpdateImportance updates the importance of memories.

func (*Client) UpdateMemory ¶

func (c *Client) UpdateMemory(ctx context.Context, agentID, memoryID string, req UpdateMemoryRequest) (*StoreMemoryResponse, error)

UpdateMemory updates an existing memory.

func (*Client) UpdateQuotas ¶

func (c *Client) UpdateQuotas(ctx context.Context, quotas map[string]interface{}) (map[string]interface{}, error)

UpdateQuotas updates quota settings.

func (*Client) Upsert ¶

func (c *Client) Upsert(ctx context.Context, namespace string, vectors []VectorInput) (*UpsertResponse, error)

Upsert inserts or updates vectors in a namespace.

func (*Client) UpsertColumns ¶

func (c *Client) UpsertColumns(ctx context.Context, namespace string, req ColumnUpsertRequest) (*UpsertResponse, error)

UpsertColumns performs a column-format upsert for efficient bulk operations.

func (*Client) UpsertText ¶

func (c *Client) UpsertText(ctx context.Context, namespace string, documents []TextDocument, opts *TextUpsertOptions) (*TextUpsertResponse, error)

UpsertText upserts text documents with automatic embedding generation. The text is embedded using the specified model (default: MiniLM) and stored as vectors.

func (*Client) WarmCache ¶

func (c *Client) WarmCache(ctx context.Context, namespace string, req WarmCacheRequest) (*WarmCacheResponse, error)

WarmCache warms the cache for vectors in a namespace.

type ClientOptions ¶

type ClientOptions struct {
	// BaseURL is the Dakera server URL.
	BaseURL string

	// APIKey is the optional API key for authentication.
	APIKey string

	// Timeout is the request timeout duration. Defaults to 30s.
	Timeout time.Duration

	// ConnectTimeout is the TCP connection establishment timeout.
	// Defaults to Timeout when not set.
	ConnectTimeout time.Duration

	// MaxRetries is the maximum number of retries. Deprecated: use RetryBackoff.
	// When both are set, RetryBackoff takes precedence.
	MaxRetries int

	// RetryBackoff allows fine-grained retry configuration.
	// When set, MaxRetries is ignored.
	RetryBackoff *RetryConfig

	// Headers are additional HTTP headers to include in requests.
	Headers map[string]string

	// OdeURL is the base URL of the dakera-ode sidecar (e.g. "http://localhost:8080").
	// Required to call Client.ExtractEntities.
	OdeURL string
}

ClientOptions represents options for the Dakera client.

type ClusterNode ¶

type ClusterNode struct {
	ID      string `json:"id"`
	Address string `json:"address"`
	Status  string `json:"status"`
	Role    string `json:"role,omitempty"`
}

ClusterNode represents a cluster node.

type ClusterStatus ¶

type ClusterStatus struct {
	Status  string `json:"status"`
	Nodes   int    `json:"nodes"`
	Healthy bool   `json:"healthy"`
	Version string `json:"version,omitempty"`
	// RedisHealthy indicates Redis connectivity (OPS-3).
	RedisHealthy *bool `json:"redis_healthy,omitempty"`
}

ClusterStatus represents the cluster status response.

type ColumnUpsertRequest ¶

type ColumnUpsertRequest struct {
	IDs        []string                 `json:"ids"`
	Vectors    [][]float32              `json:"vectors"`
	Attributes map[string][]interface{} `json:"attributes,omitempty"`
	TTLSeconds *int                     `json:"ttl_seconds,omitempty"`
	Dimension  *int                     `json:"dimension,omitempty"`
}

ColumnUpsertRequest represents a column-format upsert request for efficient bulk operations.

type CompressResponse ¶ added in v0.10.0

type CompressResponse struct {
	// AgentID is the agent whose namespace was compressed.
	AgentID string `json:"agent_id"`
	// MemoriesBefore is the number of memories before compression.
	MemoriesBefore int64 `json:"memories_before"`
	// MemoriesAfter is the number of memories after compression.
	MemoriesAfter int64 `json:"memories_after"`
	// RemovedCount is the number of memories removed during compression.
	RemovedCount int64 `json:"removed_count"`
	// DurationMs is the wall-clock duration of the compression pass in
	// milliseconds. May be zero if the server does not report it.
	DurationMs float64 `json:"duration_ms,omitempty"`
}

CompressResponse is returned by POST /v1/agents/{agent_id}/compress (CE-12).

Contains compression statistics for the agent's memory namespace after the server runs the compression pass.

type ConfigureNamespaceRequest ¶ added in v0.6.0

type ConfigureNamespaceRequest struct {
	// Dimension is the vector dimension. Required on first creation;
	// must match the existing dimension on subsequent calls.
	Dimension int `json:"dimension"`
	// Distance is the distance metric. Defaults to cosine when omitted.
	Distance DistanceMetric `json:"distance,omitempty"`
}

ConfigureNamespaceRequest is the request body for PUT /v1/namespaces/:namespace.

Uses upsert semantics: creates the namespace if it does not exist, or updates its configuration if it already exists (v0.6.0).

type ConfigureNamespaceResponse ¶ added in v0.6.0

type ConfigureNamespaceResponse struct {
	// Namespace is the namespace name.
	Namespace string `json:"namespace"`
	// Dimension is the vector dimension.
	Dimension int `json:"dimension"`
	// Distance is the distance metric in use.
	Distance DistanceMetric `json:"distance"`
	// Created is true if the namespace was newly created; false if it already existed.
	Created bool `json:"created"`
}

ConfigureNamespaceResponse is the response from PUT /v1/namespaces/:namespace.

type ConnectionError ¶

type ConnectionError struct {
	DakeraError
}

ConnectionError is raised when unable to connect to Dakera server.

func NewConnectionError ¶

func NewConnectionError(message string) *ConnectionError

func (*ConnectionError) Error ¶

func (e *ConnectionError) Error() string

type ConsolidateRequest ¶

type ConsolidateRequest struct {
	AgentID    string   `json:"agent_id,omitempty"`
	MemoryType string   `json:"memory_type,omitempty"`
	Threshold  *float32 `json:"threshold,omitempty"`
	DryRun     bool     `json:"dry_run,omitempty"`
	// Config selects the DBSCAN clustering algorithm and tunes its parameters (CE-6).
	Config *ConsolidationConfig `json:"config,omitempty"`
}

ConsolidateRequest represents a request to consolidate memories.

type ConsolidateResponse ¶

type ConsolidateResponse struct {
	MemoriesRemoved    int      `json:"memories_removed"`
	SourceMemoryIDs    []string `json:"source_memory_ids"`
	ConsolidatedMemory *Memory  `json:"consolidated_memory,omitempty"`
	// Log is the step-by-step consolidation log (CE-6, may be nil).
	Log []ConsolidationLogEntry `json:"log,omitempty"`
}

ConsolidateResponse represents the response from consolidation.

type ConsolidationConfig ¶ added in v0.9.5

type ConsolidationConfig struct {
	// Algorithm selects the clustering algorithm: "dbscan" (default) or "greedy".
	Algorithm  string   `json:"algorithm,omitempty"`
	MinSamples *int     `json:"min_samples,omitempty"`
	Eps        *float32 `json:"eps,omitempty"`
}

ConsolidationConfig is the optional algorithm config for DBSCAN adaptive consolidation (CE-6).

type ConsolidationLogEntry ¶ added in v0.9.5

type ConsolidationLogEntry struct {
	Step           string  `json:"step"`
	MemoriesBefore int     `json:"memories_before"`
	MemoriesAfter  int     `json:"memories_after"`
	DurationMs     float64 `json:"duration_ms"`
}

ConsolidationLogEntry is one step in the consolidation execution log (CE-6).

type ConsolidationResultSnapshot ¶ added in v0.7.2

type ConsolidationResultSnapshot struct {
	NamespacesProcessed  int `json:"namespaces_processed"`
	MemoriesScanned      int `json:"memories_scanned"`
	ClustersMerged       int `json:"clusters_merged"`
	MemoriesConsolidated int `json:"memories_consolidated"`
}

ConsolidationResultSnapshot is the result from a consolidation cycle.

type CreateKeyRequest ¶

type CreateKeyRequest struct {
	Name        string   `json:"name"`
	Permissions []string `json:"permissions,omitempty"`
	ExpiresAt   string   `json:"expires_at,omitempty"`
}

CreateKeyRequest represents a request to create an API key.

type CreateNamespaceKeyRequest ¶ added in v0.9.2

type CreateNamespaceKeyRequest struct {
	Name          string `json:"name"`
	ExpiresInDays *int   `json:"expires_in_days,omitempty"`
}

CreateNamespaceKeyRequest is the request body for POST /v1/namespaces/:ns/keys (SEC-1).

type CreateNamespaceKeyResponse ¶ added in v0.9.2

type CreateNamespaceKeyResponse struct {
	KeyID     string `json:"key_id"`
	Key       string `json:"key"`
	Name      string `json:"name"`
	Namespace string `json:"namespace"`
	CreatedAt int64  `json:"created_at"`
	ExpiresAt *int64 `json:"expires_at,omitempty"`
	Warning   string `json:"warning"`
}

CreateNamespaceKeyResponse is returned by POST /v1/namespaces/:ns/keys (SEC-1). The Key field is shown only once — store it securely.

type CreateNamespaceOptions ¶

type CreateNamespaceOptions struct {
	Dimensions int                    `json:"dimensions,omitempty"`
	IndexType  string                 `json:"index_type,omitempty"`
	Metadata   map[string]interface{} `json:"metadata,omitempty"`
}

CreateNamespaceOptions represents options for creating a namespace.

type CrossAgentNetworkRequest ¶ added in v0.5.0

type CrossAgentNetworkRequest struct {
	// Specific agent IDs to include. nil or empty means all agents.
	AgentIDs []string `json:"agent_ids,omitempty"`
	// Minimum cosine similarity for a cross-agent edge (default 0.3).
	MinSimilarity float32 `json:"min_similarity,omitempty"`
	// Maximum memories per agent, by descending importance (default 50).
	MaxNodesPerAgent int `json:"max_nodes_per_agent,omitempty"`
	// Minimum importance score for a memory to be included (default 0.0).
	MinImportance float32 `json:"min_importance,omitempty"`
	// Maximum cross-agent edges to return (default 200).
	MaxCrossEdges int `json:"max_cross_edges,omitempty"`
}

CrossAgentNetworkRequest configures the cross-agent similarity graph query. All fields are optional; zero values use server defaults.

type CrossAgentNetworkResponse ¶ added in v0.5.0

type CrossAgentNetworkResponse struct {
	Agents    []AgentNetworkInfo `json:"agents"`
	Nodes     []AgentNetworkNode `json:"nodes"`
	Edges     []AgentNetworkEdge `json:"edges"`
	Stats     AgentNetworkStats  `json:"stats"`
	NodeCount int                `json:"node_count"` // Total memory nodes in the network (server v0.6.2+).
}

CrossAgentNetworkResponse is returned by CrossAgentNetwork.

type DakeraError ¶

type DakeraError struct {
	Message      string
	StatusCode   int
	Code         ErrorCode
	ResponseBody interface{}
}

DakeraError is the base error type for all Dakera errors.

func (*DakeraError) Error ¶

func (e *DakeraError) Error() string

type DakeraEvent ¶ added in v0.4.0

type DakeraEvent struct {
	Type string `json:"type"`

	// connected
	Timestamp int64 `json:"timestamp,omitempty"`
	// namespace_created / namespace_deleted / vectors_mutated / operation_progress / job_progress
	Namespace string `json:"namespace,omitempty"`
	// namespace_created
	Dimension int `json:"dimension,omitempty"`
	// operation_progress
	OperationID string `json:"operation_id,omitempty"`
	OpType      string `json:"op_type,omitempty"`
	Progress    int    `json:"progress,omitempty"`
	Status      string `json:"status,omitempty"`
	Message     string `json:"message,omitempty"`
	UpdatedAt   int64  `json:"updated_at,omitempty"`
	// job_progress
	JobID   string `json:"job_id,omitempty"`
	JobType string `json:"job_type,omitempty"`
	// vectors_mutated
	Op    VectorMutationOp `json:"op,omitempty"`
	Count int              `json:"count,omitempty"`
	// stream_lagged
	Dropped int64  `json:"dropped,omitempty"`
	Hint    string `json:"hint,omitempty"`
}

DakeraEvent is an event received from a Dakera SSE stream.

The Type field identifies the event variant; only the fields relevant to that variant will be populated.

  • "connected" → Timestamp (connection confirmed, emitted on subscribe)
  • "namespace_created" → Namespace, Dimension
  • "namespace_deleted" → Namespace
  • "operation_progress" → OperationID, Namespace, OpType, Progress, Status, Message, UpdatedAt
  • "job_progress" → JobID, JobType, Namespace, Progress, Status
  • "vectors_mutated" → Namespace, Op, Count
  • "stream_lagged" → Dropped, Hint

type DecayConfigResponse ¶ added in v0.7.3

type DecayConfigResponse struct {
	// Strategy is the decay strategy: "exponential", "linear", or "step".
	Strategy string `json:"strategy"`
	// HalfLifeHours is the half-life in hours.
	HalfLifeHours float64 `json:"half_life_hours"`
	// MinImportance is the minimum importance threshold; memories below are
	// hard-deleted on the next decay cycle.
	MinImportance float32 `json:"min_importance"`
}

DecayConfigResponse is returned by GET /v1/admin/decay/config (DECAY-1).

type DecayConfigUpdateRequest ¶ added in v0.7.3

type DecayConfigUpdateRequest struct {
	// Strategy is the decay strategy: "exponential", "linear", or "step".
	Strategy *string `json:"strategy,omitempty"`
	// HalfLifeHours must be > 0.
	HalfLifeHours *float64 `json:"half_life_hours,omitempty"`
	// MinImportance must be 0.0–1.0.
	MinImportance *float32 `json:"min_importance,omitempty"`
}

DecayConfigUpdateRequest is the request for PUT /v1/admin/decay/config (DECAY-1). All fields are optional — omit any to keep its current value.

type DecayConfigUpdateResponse ¶ added in v0.7.3

type DecayConfigUpdateResponse struct {
	Success bool                `json:"success"`
	Config  DecayConfigResponse `json:"config"`
	Message string              `json:"message"`
}

DecayConfigUpdateResponse is returned by PUT /v1/admin/decay/config (DECAY-1).

type DecayStatsResponse ¶ added in v0.7.3

type DecayStatsResponse struct {
	// TotalDecayed is the all-time count of memories whose importance was lowered.
	TotalDecayed uint64 `json:"total_decayed"`
	// TotalDeleted is the all-time count of memories hard-deleted by decay or TTL.
	TotalDeleted uint64 `json:"total_deleted"`
	// LastRunAt is the Unix timestamp of the last decay cycle (nil if never run).
	LastRunAt *uint64 `json:"last_run_at,omitempty"`
	// CyclesRun is the number of decay cycles completed since startup.
	CyclesRun uint64 `json:"cycles_run"`
	// LastCycle holds stats from the most recent decay cycle (nil if never run).
	LastCycle *LastDecayCycleStats `json:"last_cycle,omitempty"`
}

DecayStatsResponse is returned by GET /v1/admin/decay/stats (DECAY-2).

type DedupResultSnapshot ¶ added in v0.7.2

type DedupResultSnapshot struct {
	NamespacesProcessed int `json:"namespaces_processed"`
	MemoriesScanned     int `json:"memories_scanned"`
	DuplicatesRemoved   int `json:"duplicates_removed"`
}

DedupResultSnapshot is the result from a deduplication cycle.

type DeduplicateRequest ¶

type DeduplicateRequest struct {
	AgentID    string   `json:"agent_id"`
	Threshold  *float32 `json:"threshold,omitempty"`
	MemoryType string   `json:"memory_type,omitempty"`
	DryRun     bool     `json:"dry_run,omitempty"`
}

DeduplicateRequest represents a request to deduplicate memories.

type DeduplicateResponse ¶

type DeduplicateResponse struct {
	DuplicatesFound int        `json:"duplicates_found"`
	RemovedCount    int        `json:"removed_count"`
	Groups          [][]string `json:"groups"`
}

DeduplicateResponse represents the response from deduplication.

type DeleteOptions ¶

type DeleteOptions struct {
	IDs       []string               `json:"ids,omitempty"`
	Filter    map[string]interface{} `json:"filter,omitempty"`
	DeleteAll bool                   `json:"delete_all,omitempty"`
}

DeleteOptions represents options for delete operations.

type DeleteResponse ¶

type DeleteResponse struct {
	DeletedCount int `json:"deletedCount"`
}

DeleteResponse represents the response from a delete operation.

type DistanceMetric ¶ added in v0.6.0

type DistanceMetric string

DistanceMetric represents the distance metric for similarity search. Valid values: "cosine", "euclidean", "dot_product".

const (
	DistanceMetricCosine     DistanceMetric = "cosine"
	DistanceMetricEuclidean  DistanceMetric = "euclidean"
	DistanceMetricDotProduct DistanceMetric = "dot_product"
)

type Document ¶

type Document struct {
	ID       string                 `json:"id"`
	Content  string                 `json:"content"`
	Metadata map[string]interface{} `json:"metadata,omitempty"`
}

Document represents a document for full-text indexing.

type DocumentInput ¶

type DocumentInput struct {
	ID       string                 `json:"id"`
	Content  string                 `json:"content"`
	Metadata map[string]interface{} `json:"metadata,omitempty"`
}

DocumentInput represents input for indexing a document.

type EdgeType ¶ added in v0.9.0

type EdgeType string

EdgeType classifies a relationship edge in the memory knowledge graph.

  • EdgeTypeRelatedTo: cosine similarity ≥ 0.85 — semantically similar memories.
  • EdgeTypeSharesEntity: both memories share a named entity (CE-4 tags).
  • EdgeTypePrecedes: temporal ordering — source was created before target.
  • EdgeTypeLinkedBy: explicit user/agent-created link.
const (
	// EdgeTypeRelatedTo indicates two memories are semantically similar (cosine ≥ 0.85).
	EdgeTypeRelatedTo EdgeType = "related_to"
	// EdgeTypeSharesEntity indicates both memories reference the same named entity.
	EdgeTypeSharesEntity EdgeType = "shares_entity"
	// EdgeTypePrecedes indicates source was created before target (temporal ordering).
	EdgeTypePrecedes EdgeType = "precedes"
	// EdgeTypeLinkedBy indicates an explicit user/agent-created link.
	EdgeTypeLinkedBy EdgeType = "linked_by"
)

type EmbeddingModel ¶

type EmbeddingModel string

EmbeddingModel represents supported embedding models for text-based operations.

const (
	// EmbeddingModelBGELarge is the BGE-large model - Best quality, server default (1024 dimensions).
	EmbeddingModelBGELarge EmbeddingModel = "bge-large"
	// EmbeddingModelMiniLM is the MiniLM-L6 model - Fast, good quality (384 dimensions).
	EmbeddingModelMiniLM EmbeddingModel = "minilm"
	// EmbeddingModelBGESmall is the BGE-small model - Balanced performance (384 dimensions).
	EmbeddingModelBGESmall EmbeddingModel = "bge-small"
	// EmbeddingModelE5Small is the E5-small model - High quality (384 dimensions).
	EmbeddingModelE5Small EmbeddingModel = "e5-small"
)

type EntityExtractionResponse ¶ added in v0.9.0

type EntityExtractionResponse struct {
	Entities []ExtractedEntity `json:"entities"`
}

EntityExtractionResponse is returned by ExtractEntities.

type ErrorCode ¶ added in v0.6.1

type ErrorCode string

ErrorCode represents a typed server error code from the Dakera API.

const (
	ErrorCodeNamespaceNotFound      ErrorCode = "NAMESPACE_NOT_FOUND"
	ErrorCodeVectorNotFound         ErrorCode = "VECTOR_NOT_FOUND"
	ErrorCodeDimensionMismatch      ErrorCode = "DIMENSION_MISMATCH"
	ErrorCodeEmptyVector            ErrorCode = "EMPTY_VECTOR"
	ErrorCodeInvalidRequest         ErrorCode = "INVALID_REQUEST"
	ErrorCodeStorageError           ErrorCode = "STORAGE_ERROR"
	ErrorCodeInternalError          ErrorCode = "INTERNAL_ERROR"
	ErrorCodeQuotaExceeded          ErrorCode = "QUOTA_EXCEEDED"
	ErrorCodeServiceUnavailable     ErrorCode = "SERVICE_UNAVAILABLE"
	ErrorCodeAuthenticationRequired ErrorCode = "AUTHENTICATION_REQUIRED"
	ErrorCodeInvalidApiKey          ErrorCode = "INVALID_API_KEY"
	ErrorCodeApiKeyExpired          ErrorCode = "API_KEY_EXPIRED"
	ErrorCodeInsufficientScope      ErrorCode = "INSUFFICIENT_SCOPE"
	ErrorCodeNamespaceAccessDenied  ErrorCode = "NAMESPACE_ACCESS_DENIED"
	ErrorCodeUnknown                ErrorCode = "UNKNOWN"
)

type EventResult ¶ added in v0.4.0

type EventResult struct {
	Event *DakeraEvent
	Err   error
}

EventResult wraps a DakeraEvent or an error from the SSE stream.

type ExportRequest ¶

type ExportRequest struct {
	Cursor         string                 `json:"cursor,omitempty"`
	Limit          *int                   `json:"limit,omitempty"`
	Filter         map[string]interface{} `json:"filter,omitempty"`
	IncludeVectors bool                   `json:"include_vectors,omitempty"`
}

ExportRequest represents a request to export vectors.

type ExportResponse ¶

type ExportResponse struct {
	Vectors    []ExportedVector `json:"vectors"`
	NextCursor string           `json:"next_cursor,omitempty"`
	HasMore    bool             `json:"has_more"`
}

ExportResponse represents the response from vector export.

type ExportedVector ¶

type ExportedVector struct {
	ID       string                 `json:"id"`
	Values   []float32              `json:"values,omitempty"`
	Metadata map[string]interface{} `json:"metadata,omitempty"`
}

ExportedVector represents a single exported vector.

type ExtractEntitiesRequest ¶ added in v0.9.6

type ExtractEntitiesRequest struct {
	// Content is the text to extract entities from.
	Content string `json:"content"`
	// AgentID is the agent context for the extraction.
	AgentID string `json:"agent_id"`
	// MemoryID is an optional memory ID to associate with the extraction.
	MemoryID string `json:"memory_id,omitempty"`
	// EntityTypes is an optional list of entity type labels to extract.
	// When omitted the ODE sidecar uses its default set.
	EntityTypes []string `json:"entity_types,omitempty"`
}

ExtractEntitiesRequest is the body for POST /ode/extract (ODE-2).

type ExtractEntitiesResponse ¶ added in v0.9.6

type ExtractEntitiesResponse struct {
	// Entities are extracted entities ordered by their start offset.
	Entities []OdeEntity `json:"entities"`
	// Model is the GLiNER model variant used for extraction.
	Model string `json:"model"`
	// ProcessingTimeMs is the wall-clock time taken by the ODE sidecar in milliseconds.
	ProcessingTimeMs int `json:"processing_time_ms"`
}

ExtractEntitiesResponse is returned by POST /ode/extract on the ODE sidecar (ODE-2).

type ExtractedEntity ¶ added in v0.9.0

type ExtractedEntity struct {
	EntityType string  `json:"entity_type"`
	Value      string  `json:"value"`
	Score      float64 `json:"score"`
}

ExtractedEntity is a single entity extracted by GLiNER or the rule-based pipeline.

type ExtractionProviderInfo ¶ added in v0.9.5

type ExtractionProviderInfo struct {
	Name      string   `json:"name"`
	Available bool     `json:"available"`
	Models    []string `json:"models,omitempty"`
}

ExtractionProviderInfo describes an available extraction provider (EXT-1).

type ExtractionResult ¶ added in v0.9.5

type ExtractionResult struct {
	Entities   []map[string]interface{} `json:"entities"`
	Provider   string                   `json:"provider"`
	Model      string                   `json:"model,omitempty"`
	DurationMs float64                  `json:"duration_ms"`
}

ExtractionResult is returned by POST /v1/extract (EXT-1).

type FeedbackHealthResponse ¶ added in v0.9.2

type FeedbackHealthResponse struct {
	AgentID       string  `json:"agent_id"`
	HealthScore   float32 `json:"health_score"`
	MemoryCount   int     `json:"memory_count"`
	AvgImportance float32 `json:"avg_importance"`
}

FeedbackHealthResponse is returned by GetFeedbackHealth (INT-1).

type FeedbackHistoryEntry ¶ added in v0.9.2

type FeedbackHistoryEntry struct {
	Signal        FeedbackSignal `json:"signal"`
	Timestamp     uint64         `json:"timestamp"`
	OldImportance float32        `json:"old_importance"`
	NewImportance float32        `json:"new_importance"`
}

FeedbackHistoryEntry is a single recorded feedback event stored in memory metadata (INT-1).

type FeedbackHistoryResponse ¶ added in v0.9.2

type FeedbackHistoryResponse struct {
	MemoryID string                 `json:"memory_id"`
	Entries  []FeedbackHistoryEntry `json:"entries"`
}

FeedbackHistoryResponse is returned by GetMemoryFeedbackHistory (INT-1).

type FeedbackResponse ¶ added in v0.9.2

type FeedbackResponse struct {
	MemoryID      string         `json:"memory_id"`
	NewImportance float32        `json:"new_importance"`
	Signal        FeedbackSignal `json:"signal"`
}

FeedbackResponse is returned by FeedbackMemory and PatchMemoryImportance (INT-1).

type FeedbackSignal ¶ added in v0.9.2

type FeedbackSignal string

FeedbackSignal is the signal type for memory active learning (INT-1).

  • "upvote": Boost importance ×1.15, capped at 1.0.
  • "downvote": Penalise importance ×0.85, floor 0.0.
  • "flag": Mark as irrelevant — sets decay_flag=true, no immediate importance change.
  • "positive": Backward-compatible alias for "upvote".
  • "negative": Backward-compatible alias for "downvote".
const (
	FeedbackSignalUpvote   FeedbackSignal = "upvote"
	FeedbackSignalDownvote FeedbackSignal = "downvote"
	FeedbackSignalFlag     FeedbackSignal = "flag"
	FeedbackSignalPositive FeedbackSignal = "positive"
	FeedbackSignalNegative FeedbackSignal = "negative"
)

type FetchOptions ¶

type FetchOptions struct {
	IncludeValues   bool `json:"include_values,omitempty"`
	IncludeMetadata bool `json:"include_metadata,omitempty"`
}

FetchOptions represents options for fetch operations.

type FullKnowledgeGraphRequest ¶

type FullKnowledgeGraphRequest struct {
	AgentID          string   `json:"agent_id"`
	MaxNodes         *int     `json:"max_nodes,omitempty"`
	MinSimilarity    *float32 `json:"min_similarity,omitempty"`
	ClusterThreshold *float32 `json:"cluster_threshold,omitempty"`
	MaxEdgesPerNode  *int     `json:"max_edges_per_node,omitempty"`
}

FullKnowledgeGraphRequest represents a request to build a full knowledge graph.

type FullTextSearchOptions ¶

type FullTextSearchOptions struct {
	TopK   int                    `json:"top_k,omitempty"`
	Filter map[string]interface{} `json:"filter,omitempty"`
}

FullTextSearchOptions represents options for full-text search.

type FullTextSearchResult ¶

type FullTextSearchResult struct {
	ID       string                 `json:"id"`
	Score    float32                `json:"score"`
	Content  string                 `json:"content,omitempty"`
	Metadata map[string]interface{} `json:"metadata,omitempty"`
}

FullTextSearchResult represents a full-text search result.

type FulltextReindexNamespaceResult ¶ added in v0.11.51

type FulltextReindexNamespaceResult struct {
	// Namespace that was scanned.
	Namespace string `json:"namespace"`
	// VectorsScanned is the total number of vectors examined.
	VectorsScanned int `json:"vectors_scanned"`
	// NewlyIndexed is the number of memories added to the BM25 index.
	NewlyIndexed int `json:"newly_indexed"`
	// AlreadyIndexed is the number of memories already in the BM25 index.
	AlreadyIndexed int `json:"already_indexed"`
	// ParseFailures is the number of memories that could not be parsed.
	ParseFailures int `json:"parse_failures"`
}

FulltextReindexNamespaceResult is the per-namespace breakdown from POST /admin/fulltext/reindex (CE-54).

type FulltextReindexResponse ¶ added in v0.11.51

type FulltextReindexResponse struct {
	// NamespacesProcessed is the number of namespaces scanned.
	NamespacesProcessed int `json:"namespaces_processed"`
	// TotalIndexed is the total memories newly added to BM25 across all namespaces.
	TotalIndexed int `json:"total_indexed"`
	// TotalSkipped is the total memories already in the BM25 index (skipped).
	TotalSkipped int `json:"total_skipped"`
	// Details is the per-namespace breakdown.
	Details []FulltextReindexNamespaceResult `json:"details"`
}

FulltextReindexResponse is returned by POST /admin/fulltext/reindex (CE-54).

Returned by Client.AdminFulltextReindex.

type FusionStrategy ¶ added in v0.11.0

type FusionStrategy string

FusionStrategy controls how vector and BM25 scores are combined during hybrid recall (CE-14). FusionStrategyMinMax (server default since v0.11.2) uses weighted min-max normalization.

const (
	// FusionStrategyRRF uses Reciprocal Rank Fusion (Cormack et al., SIGIR 2009).
	FusionStrategyRRF FusionStrategy = "rrf"
	// FusionStrategyMinMax uses weighted min-max normalization — server default since v0.11.2.
	FusionStrategyMinMax FusionStrategy = "minmax"
)

type GraphEdge ¶ added in v0.9.0

type GraphEdge struct {
	// ID is the unique edge identifier.
	ID string `json:"id"`
	// SourceID is the source memory ID.
	SourceID string `json:"source_id"`
	// TargetID is the target memory ID.
	TargetID string `json:"target_id"`
	// EdgeType is the relationship type between the two memories.
	EdgeType EdgeType `json:"edge_type"`
	// Weight is the edge weight (0.0–1.0). For RelatedTo this is the cosine similarity score.
	Weight float64 `json:"weight"`
	// CreatedAt is the Unix timestamp of edge creation.
	CreatedAt int64 `json:"created_at"`
}

GraphEdge is a directed edge in the memory knowledge graph.

type GraphExport ¶ added in v0.9.0

type GraphExport struct {
	// AgentID is the agent whose graph was exported.
	AgentID string `json:"agent_id"`
	// Format is the export format: "json", "graphml", or "csv".
	Format string `json:"format"`
	// Data is the serialised graph in the requested format.
	Data string `json:"data"`
	// NodeCount is the total number of memory nodes in the export.
	NodeCount int64 `json:"node_count"`
	// EdgeCount is the total number of edges in the export.
	EdgeCount int64 `json:"edge_count"`
}

GraphExport is the agent graph export from GET /v1/agents/{id}/graph/export.

type GraphLinkRequest ¶ added in v0.9.0

type GraphLinkRequest struct {
	// TargetID is the target memory ID to link to.
	TargetID string `json:"target_id"`
	// EdgeType is the edge type — must be EdgeTypeLinkedBy for explicit links.
	EdgeType EdgeType `json:"edge_type"`
}

GraphLinkRequest is the request body for POST /v1/memories/{id}/links.

type GraphLinkResponse ¶ added in v0.9.0

type GraphLinkResponse struct {
	// Edge is the newly created edge.
	Edge GraphEdge `json:"edge"`
}

GraphLinkResponse is the response from POST /v1/memories/{id}/links.

type GraphNode ¶ added in v0.9.0

type GraphNode struct {
	// MemoryID is the memory identifier.
	MemoryID string `json:"memory_id"`
	// ContentPreview is the first 200 characters of memory content.
	ContentPreview string `json:"content_preview"`
	// Importance is the memory importance score.
	Importance float64 `json:"importance"`
	// Depth is the traversal depth from the root node (root = 0).
	Depth int `json:"depth"`
}

GraphNode is a memory node in the knowledge graph traversal result.

type GraphOptions ¶ added in v0.9.0

type GraphOptions struct {
	// Depth is the maximum traversal depth (default: 1, max: 3).
	Depth int
	// Types filters by edge types. nil or empty returns all types.
	Types []EdgeType
}

GraphOptions holds options for the MemoryGraph method.

type GraphPath ¶ added in v0.9.0

type GraphPath struct {
	// SourceID is the starting memory ID.
	SourceID string `json:"source_id"`
	// TargetID is the destination memory ID.
	TargetID string `json:"target_id"`
	// Path is the ordered list of memory IDs from source to target (inclusive).
	Path []string `json:"path"`
	// Hops is the number of edges traversed (len(Path) - 1). -1 if no path exists.
	Hops int `json:"hops"`
	// Edges are the edges along the path, in traversal order.
	Edges []GraphEdge `json:"edges"`
}

GraphPath is the shortest path between two memories from GET /v1/memories/{id}/path.

type HealthResponse ¶

type HealthResponse struct {
	Status  string `json:"status"`
	Version string `json:"version,omitempty"`
}

HealthResponse represents the server health check response.

type HybridSearchOptions ¶

type HybridSearchOptions struct {
	TopK         int                    `json:"top_k,omitempty"`
	VectorWeight float32                `json:"vector_weight,omitempty"`
	Filter       map[string]interface{} `json:"filter,omitempty"`
}

HybridSearchOptions represents options for hybrid search.

type HybridSearchResult ¶

type HybridSearchResult struct {
	ID          string                 `json:"id"`
	Score       float32                `json:"score"`
	VectorScore float32                `json:"vectorScore,omitempty"`
	TextScore   float32                `json:"textScore,omitempty"`
	Values      []float32              `json:"values,omitempty"`
	Content     string                 `json:"content,omitempty"`
	Metadata    map[string]interface{} `json:"metadata,omitempty"`
}

HybridSearchResult represents a hybrid search result.

type IndexDocumentsResponse ¶

type IndexDocumentsResponse struct {
	IndexedCount int `json:"indexedCount"`
}

IndexDocumentsResponse represents the response from indexing documents.

type IndexStats ¶

type IndexStats struct {
	Namespace    string  `json:"namespace"`
	VectorCount  int64   `json:"vectorCount"`
	IndexedCount int64   `json:"indexedCount"`
	Dimensions   int     `json:"dimensions"`
	IndexType    string  `json:"indexType"`
	SizeBytes    int64   `json:"sizeBytes,omitempty"`
	Utilization  float64 `json:"utilization,omitempty"`
}

IndexStats represents statistics about an index.

type KeySuccessResponse ¶ added in v0.9.2

type KeySuccessResponse struct {
	Success bool   `json:"success"`
	Message string `json:"message"`
}

KeySuccessResponse is returned by key deletion and deactivation endpoints.

type KeyUsage ¶

type KeyUsage struct {
	KeyID              string           `json:"key_id"`
	TotalRequests      int64            `json:"total_requests"`
	LastUsed           string           `json:"last_used,omitempty"`
	RequestsByEndpoint map[string]int64 `json:"requests_by_endpoint,omitempty"`
}

KeyUsage represents usage statistics for an API key.

type KgExportResponse ¶ added in v0.9.7

type KgExportResponse struct {
	// AgentID is the agent whose graph was exported.
	AgentID string `json:"agent_id"`
	// Format is the export format used ("json" when this struct is returned).
	Format string `json:"format"`
	// NodeCount is the total number of unique memory node IDs in the export.
	NodeCount int `json:"node_count"`
	// EdgeCount is the total number of edges in the export.
	EdgeCount int `json:"edge_count"`
	// Edges contains all graph edges for the agent.
	Edges []GraphEdge `json:"edges"`
}

KgExportResponse is returned by GET /v1/knowledge/export with format=json (KG-2).

type KgPathResponse ¶ added in v0.9.7

type KgPathResponse struct {
	// AgentID is the agent whose graph was traversed.
	AgentID string `json:"agent_id"`
	// FromID is the source memory ID.
	FromID string `json:"from_id"`
	// ToID is the target memory ID.
	ToID string `json:"to_id"`
	// HopCount is the number of edges in the shortest path (0 if source == target).
	HopCount int `json:"hop_count"`
	// Path is the ordered list of memory IDs from source to target (inclusive).
	Path []string `json:"path"`
}

KgPathResponse is returned by GET /v1/knowledge/path (KG-2).

type KgQueryResponse ¶ added in v0.9.7

type KgQueryResponse struct {
	// AgentID is the agent whose graph was queried.
	AgentID string `json:"agent_id"`
	// NodeCount is the number of unique memory node IDs referenced by the returned edges.
	NodeCount int `json:"node_count"`
	// EdgeCount is the number of edges returned.
	EdgeCount int `json:"edge_count"`
	// Edges contains the matching edges, up to the requested limit.
	Edges []GraphEdge `json:"edges"`
}

KgQueryResponse is returned by GET /v1/knowledge/query (KG-2).

type KnowledgeEdge ¶

type KnowledgeEdge struct {
	Source       string  `json:"source"`
	Target       string  `json:"target"`
	Similarity   float32 `json:"similarity"`
	Relationship string  `json:"relationship,omitempty"`
}

KnowledgeEdge represents an edge in the knowledge graph.

type KnowledgeGraphRequest ¶

type KnowledgeGraphRequest struct {
	AgentID       string   `json:"agent_id"`
	MemoryID      string   `json:"memory_id,omitempty"`
	Depth         *int     `json:"depth,omitempty"`
	MinSimilarity *float32 `json:"min_similarity,omitempty"`
}

KnowledgeGraphRequest represents a request to build a knowledge graph.

type KnowledgeGraphResponse ¶

type KnowledgeGraphResponse struct {
	Nodes    []KnowledgeNode `json:"nodes"`
	Edges    []KnowledgeEdge `json:"edges"`
	Clusters [][]string      `json:"clusters,omitempty"`
}

KnowledgeGraphResponse represents the response from knowledge graph operations.

type KnowledgeNode ¶

type KnowledgeNode struct {
	ID         string                 `json:"id"`
	Content    string                 `json:"content"`
	MemoryType string                 `json:"memory_type,omitempty"`
	Importance *float32               `json:"importance,omitempty"`
	Metadata   map[string]interface{} `json:"metadata,omitempty"`
}

KnowledgeNode represents a node in the knowledge graph.

type KpiSnapshot ¶ added in v0.9.12

type KpiSnapshot struct {
	// RecallLatencyP50Ms is the median recall latency across all namespaces
	// over the last minute (ms).
	RecallLatencyP50Ms float64 `json:"recall_latency_p50_ms"`
	// RecallLatencyP99Ms is the 99th-percentile recall latency across all
	// namespaces over the last minute (ms).
	RecallLatencyP99Ms float64 `json:"recall_latency_p99_ms"`
	// StoreLatencyP50Ms is the median store latency across all namespaces
	// over the last minute (ms).
	StoreLatencyP50Ms float64 `json:"store_latency_p50_ms"`
	// ApiErrorRate5xxPct is the 5xx error rate as a percentage of total API
	// requests over the last minute.
	ApiErrorRate5xxPct float64 `json:"api_error_rate_5xx_pct"`
	// ActiveAgentsCount is the number of distinct agent identifiers that stored
	// or recalled a memory in the last 24 hours.
	ActiveAgentsCount uint64 `json:"active_agents_count"`
	// SessionCountWeek is the total sessions created in the rolling 7-day window.
	SessionCountWeek uint64 `json:"session_count_week"`
	// CrossAgentNetworkNodeCount is the current number of nodes in the
	// cross-agent knowledge graph.
	CrossAgentNetworkNodeCount uint64 `json:"cross_agent_network_node_count"`
	// MemoryRetention7dPct is the percentage of memories created 7 days ago
	// that are still active (not decayed or deleted).
	MemoryRetention7dPct float64 `json:"memory_retention_7d_pct"`
}

KpiSnapshot is a point-in-time product KPI snapshot returned by GET /v1/kpis (OBS-2).

All latency values are in milliseconds. Rate/percentage values are in the range 0.0–100.0. Integer counts are unsigned.

Requires Admin scope.

type LastDecayCycleStats ¶ added in v0.7.3

type LastDecayCycleStats struct {
	NamespacesProcessed int `json:"namespaces_processed"`
	MemoriesProcessed   int `json:"memories_processed"`
	MemoriesDecayed     int `json:"memories_decayed"`
	MemoriesDeleted     int `json:"memories_deleted"`
}

LastDecayCycleStats holds per-cycle statistics from a single decay run.

type LatencyAnalytics ¶

type LatencyAnalytics struct {
	Period      string                      `json:"period"`
	AvgMs       float64                     `json:"avg_ms"`
	P50Ms       float64                     `json:"p50_ms"`
	P95Ms       float64                     `json:"p95_ms"`
	P99Ms       float64                     `json:"p99_ms"`
	MaxMs       float64                     `json:"max_ms"`
	ByOperation map[string]OperationLatency `json:"by_operation,omitempty"`
}

LatencyAnalytics represents latency analytics response.

type ListNamespaceKeysResponse ¶ added in v0.9.2

type ListNamespaceKeysResponse struct {
	Namespace string             `json:"namespace"`
	Keys      []NamespaceKeyInfo `json:"keys"`
	Total     int                `json:"total"`
}

ListNamespaceKeysResponse is returned by GET /v1/namespaces/:ns/keys (SEC-1).

type ListSessionsOptions ¶

type ListSessionsOptions struct {
	AgentID    string `json:"agent_id,omitempty"`
	ActiveOnly *bool  `json:"active_only,omitempty"`
	Limit      *int   `json:"limit,omitempty"`
	Offset     *int   `json:"offset,omitempty"`
}

ListSessionsOptions represents options for listing sessions.

type Memory ¶

type Memory struct {
	ID             string                 `json:"id"`
	Content        string                 `json:"content"`
	AgentID        string                 `json:"agent_id,omitempty"`
	MemoryType     string                 `json:"memory_type"`
	Importance     float32                `json:"importance"`
	Tags           []string               `json:"tags,omitempty"`
	Metadata       map[string]interface{} `json:"metadata,omitempty"`
	CreatedAt      int64                  `json:"created_at,omitempty"`
	LastAccessedAt int64                  `json:"last_accessed_at,omitempty"`
	AccessCount    *int                   `json:"access_count,omitempty"`
}

Memory represents a stored memory.

type MemoryEntitiesResponse ¶ added in v0.9.0

type MemoryEntitiesResponse struct {
	MemoryID string            `json:"memory_id"`
	Entities []ExtractedEntity `json:"entities"`
}

MemoryEntitiesResponse is returned by MemoryEntities.

type MemoryEvent ¶ added in v0.5.0

type MemoryEvent struct {
	EventType  string   `json:"event_type"`
	AgentID    string   `json:"agent_id"`
	Timestamp  int64    `json:"timestamp"`
	MemoryID   *string  `json:"memory_id,omitempty"`
	Content    *string  `json:"content,omitempty"`
	Importance *float32 `json:"importance,omitempty"`
	Tags       []string `json:"tags,omitempty"`
	SessionID  *string  `json:"session_id,omitempty"`
}

MemoryEvent is a memory lifecycle event from GET /v1/events/stream.

EventType values:

  • "connected" — emitted on subscribe to confirm the stream is live; AgentID will be ""
  • "stored" — memory stored (Content, Importance, Tags present)
  • "recalled" — memory recalled
  • "forgotten" — memory deleted
  • "consolidated" — memories merged
  • "importance_updated" — importance changed
  • "session_started" / "session_ended" — agent session lifecycle
  • "stream_lagged" — consumer fell behind; some events were dropped

type MemoryEventResult ¶ added in v0.5.0

type MemoryEventResult struct {
	Event *MemoryEvent
	Err   error
}

MemoryEventResult wraps a MemoryEvent or an error from the memory event SSE stream.

type MemoryExportResponse ¶ added in v0.9.5

type MemoryExportResponse struct {
	Data   []map[string]interface{} `json:"data"`
	Format string                   `json:"format"`
	Count  int                      `json:"count"`
}

MemoryExportResponse is returned by GET /v1/export (DX-1).

type MemoryFeedbackBodyRequest ¶ added in v0.9.2

type MemoryFeedbackBodyRequest struct {
	AgentID string         `json:"agent_id"`
	Signal  FeedbackSignal `json:"signal"`
}

MemoryFeedbackBodyRequest is the request body for POST /v1/memories/:id/feedback (INT-1).

type MemoryFeedbackRequest ¶

type MemoryFeedbackRequest struct {
	MemoryID       string   `json:"memory_id"`
	Feedback       string   `json:"feedback"`
	RelevanceScore *float32 `json:"relevance_score,omitempty"`
}

MemoryFeedbackRequest represents a request for memory feedback.

type MemoryFeedbackResponse ¶

type MemoryFeedbackResponse struct {
	Status            string   `json:"status"`
	UpdatedImportance *float32 `json:"updated_importance,omitempty"`
}

MemoryFeedbackResponse represents the response from feedback.

type MemoryGraph ¶ added in v0.9.0

type MemoryGraph struct {
	// RootID is the root memory ID from which traversal started.
	RootID string `json:"root_id"`
	// Depth is the maximum traversal depth used.
	Depth int `json:"depth"`
	// Nodes contains all memory nodes reachable within the requested depth.
	Nodes []GraphNode `json:"nodes"`
	// Edges contains all edges connecting the returned nodes.
	Edges []GraphEdge `json:"edges"`
}

MemoryGraph is the graph traversal result from GET /v1/memories/{id}/graph.

type MemoryImportResponse ¶ added in v0.9.5

type MemoryImportResponse struct {
	ImportedCount int      `json:"imported_count"`
	SkippedCount  int      `json:"skipped_count"`
	Errors        []string `json:"errors,omitempty"`
}

MemoryImportResponse is returned by POST /v1/import (DX-1).

type MemoryImportancePatchRequest ¶ added in v0.9.2

type MemoryImportancePatchRequest struct {
	AgentID    string  `json:"agent_id"`
	Importance float32 `json:"importance"`
}

MemoryImportancePatchRequest is the request body for PATCH /v1/memories/:id/importance (INT-1).

type MemoryPolicy ¶ added in v0.9.8

type MemoryPolicy struct {

	// WorkingTTLSeconds is the default TTL for working memories in seconds
	// (server default: 14 400 = 4 h).
	WorkingTTLSeconds *int64 `json:"working_ttl_seconds,omitempty"`
	// EpisodicTTLSeconds is the default TTL for episodic memories in seconds
	// (server default: 2 592 000 = 30 d).
	EpisodicTTLSeconds *int64 `json:"episodic_ttl_seconds,omitempty"`
	// SemanticTTLSeconds is the default TTL for semantic memories in seconds
	// (server default: 31 536 000 = 365 d).
	SemanticTTLSeconds *int64 `json:"semantic_ttl_seconds,omitempty"`
	// ProceduralTTLSeconds is the default TTL for procedural memories in
	// seconds (server default: 63 072 000 = 730 d).
	ProceduralTTLSeconds *int64 `json:"procedural_ttl_seconds,omitempty"`

	// WorkingDecay is the decay strategy for working memories
	// (server default: "exponential").
	WorkingDecay *string `json:"working_decay,omitempty"`
	// EpisodicDecay is the decay strategy for episodic memories
	// (server default: "power_law").
	EpisodicDecay *string `json:"episodic_decay,omitempty"`
	// SemanticDecay is the decay strategy for semantic memories
	// (server default: "logarithmic").
	SemanticDecay *string `json:"semantic_decay,omitempty"`
	// ProceduralDecay is the decay strategy for procedural memories
	// (server default: "flat" — no decay).
	ProceduralDecay *string `json:"procedural_decay,omitempty"`

	// SpacedRepetitionFactor is the TTL extension multiplier per recall hit.
	// Extension = access_count × factor × base_interval_seconds.
	// Set to 0 to disable. (server default: 1.0)
	SpacedRepetitionFactor *float64 `json:"spaced_repetition_factor,omitempty"`
	// SpacedRepetitionBaseIntervalSeconds is the base interval in seconds for
	// spaced repetition TTL extension (server default: 86 400 = 1 d).
	SpacedRepetitionBaseIntervalSeconds *int64 `json:"spaced_repetition_base_interval_seconds,omitempty"`

	// ConsolidationEnabled enables background DBSCAN deduplication for this
	// namespace. When true the server merges semantically near-duplicate
	// memories every ConsolidationIntervalHours hours. (server default: false)
	ConsolidationEnabled *bool `json:"consolidation_enabled,omitempty"`
	// ConsolidationThreshold is the DBSCAN epsilon — cosine-similarity
	// threshold to consider two memories duplicates. Higher values only merge
	// very close neighbours. (server default: 0.92)
	ConsolidationThreshold *float64 `json:"consolidation_threshold,omitempty"`
	// ConsolidationIntervalHours is how often (in hours) the background
	// consolidation job runs for this namespace. (server default: 24)
	ConsolidationIntervalHours *uint32 `json:"consolidation_interval_hours,omitempty"`
	// ConsolidatedCount is the lifetime count of memories merged by the
	// consolidation engine. Read-only — the server manages this field; any
	// value sent via SetMemoryPolicy is silently ignored.
	ConsolidatedCount *uint64 `json:"consolidated_count,omitempty"`

	// RateLimitEnabled enables per-namespace store/recall rate limiting.
	// (server default: false)
	RateLimitEnabled *bool `json:"rate_limit_enabled,omitempty"`
	// RateLimitStoresPerMinute sets the max store operations per minute for
	// this namespace. nil = unlimited (server default).
	RateLimitStoresPerMinute *uint32 `json:"rate_limit_stores_per_minute,omitempty"`
	// RateLimitRecallsPerMinute sets the max recall operations per minute for
	// this namespace. nil = unlimited (server default).
	RateLimitRecallsPerMinute *uint32 `json:"rate_limit_recalls_per_minute,omitempty"`

	// DedupOnStore enables similarity deduplication at store time (CE-10).
	// When true the server computes a similarity check before persisting a new
	// memory and drops it if a near-duplicate already exists (threshold
	// controlled by DedupThreshold). (server default: false)
	DedupOnStore *bool `json:"dedup_on_store,omitempty"`
	// DedupThreshold is the cosine-similarity threshold for store-time
	// deduplication (server default: 0.92). Memories with similarity ≥ this
	// value are considered duplicates and the incoming memory is dropped. Only
	// active when DedupOnStore is true.
	DedupThreshold *float32 `json:"dedup_threshold,omitempty"`
}

MemoryPolicy is the per-namespace memory lifecycle policy (COG-1).

Controls type-specific TTLs, decay curves, and spaced repetition behaviour. All fields are optional (pointer types); nil values use the server-side COG-1 defaults. Only set the fields you want to override.

Used by Client.GetMemoryPolicy and Client.SetMemoryPolicy.

type MultiVectorSearchRequest ¶

type MultiVectorSearchRequest struct {
	Positive        [][]float32            `json:"positive"`
	Negative        [][]float32            `json:"negative,omitempty"`
	TopK            int                    `json:"top_k,omitempty"`
	Filter          map[string]interface{} `json:"filter,omitempty"`
	IncludeMetadata bool                   `json:"include_metadata,omitempty"`
	IncludeVectors  bool                   `json:"include_vectors,omitempty"`
	MmrLambda       *float32               `json:"mmr_lambda,omitempty"`
	MmrPrefetchK    *int                   `json:"mmr_prefetch_k,omitempty"`
}

MultiVectorSearchRequest represents a multi-vector search request with positive/negative vectors.

type MultiVectorSearchResponse ¶

type MultiVectorSearchResponse struct {
	Results      []MultiVectorSearchResult `json:"results"`
	SearchTimeMs *int64                    `json:"search_time_ms,omitempty"`
	Strategy     string                    `json:"strategy,omitempty"`
}

MultiVectorSearchResponse represents the response from multi-vector search.

type MultiVectorSearchResult ¶

type MultiVectorSearchResult struct {
	ID       string                 `json:"id"`
	Score    float32                `json:"score"`
	Values   []float32              `json:"values,omitempty"`
	Metadata map[string]interface{} `json:"metadata,omitempty"`
}

MultiVectorSearchResult represents a single result from multi-vector search.

type NamespaceInfo ¶

type NamespaceInfo struct {
	Name        string                 `json:"namespace"`
	VectorCount int64                  `json:"vector_count"`
	Dimension   int                    `json:"dimension,omitempty"`
	Distance    string                 `json:"distance,omitempty"`
	IndexType   string                 `json:"indexType,omitempty"`
	Metadata    map[string]interface{} `json:"metadata,omitempty"`
	CreatedAt   *time.Time             `json:"createdAt,omitempty"`
	UpdatedAt   *time.Time             `json:"updatedAt,omitempty"`
}

NamespaceInfo represents information about a namespace.

type NamespaceKeyInfo ¶ added in v0.9.2

type NamespaceKeyInfo struct {
	KeyID     string `json:"key_id"`
	Name      string `json:"name"`
	Namespace string `json:"namespace"`
	CreatedAt int64  `json:"created_at"`
	Active    bool   `json:"active"`
	ExpiresAt *int64 `json:"expires_at,omitempty"`
}

NamespaceKeyInfo holds namespace-scoped API key metadata (no secret) — SEC-1.

type NamespaceKeyUsageResponse ¶ added in v0.9.2

type NamespaceKeyUsageResponse struct {
	KeyID              string  `json:"key_id"`
	Namespace          string  `json:"namespace"`
	TotalRequests      uint64  `json:"total_requests"`
	SuccessfulRequests uint64  `json:"successful_requests"`
	FailedRequests     uint64  `json:"failed_requests"`
	BytesTransferred   uint64  `json:"bytes_transferred"`
	AvgLatencyMs       float64 `json:"avg_latency_ms"`
}

NamespaceKeyUsageResponse is returned by GET /v1/namespaces/:ns/keys/:key_id/usage (SEC-1).

type NamespaceNerConfig ¶ added in v0.9.0

type NamespaceNerConfig struct {
	ExtractEntities bool     `json:"extract_entities"`
	EntityTypes     []string `json:"entity_types,omitempty"`
}

NamespaceNerConfig holds entity extraction configuration for a namespace (CE-4).

type NamespaceStorage ¶

type NamespaceStorage struct {
	Bytes       uint64 `json:"bytes"`
	VectorCount uint64 `json:"vector_count"`
}

NamespaceStorage represents storage info for a specific namespace.

type NotFoundError ¶

type NotFoundError struct {
	DakeraError
}

NotFoundError is raised when a requested resource is not found.

func NewNotFoundError ¶

func NewNotFoundError(message string, statusCode int, body interface{}, code ErrorCode) *NotFoundError

func (*NotFoundError) Error ¶

func (e *NotFoundError) Error() string

type OdeEntity ¶ added in v0.9.6

type OdeEntity struct {
	// Text is the span text as it appears in the input.
	Text string `json:"text"`
	// Label is the entity type label (e.g. "person", "organization").
	Label string `json:"label"`
	// Start is the start character offset (inclusive) within the input text.
	Start int `json:"start"`
	// End is the end character offset (exclusive) within the input text.
	End int `json:"end"`
	// Score is the confidence score in the range [0, 1].
	Score float64 `json:"score"`
}

OdeEntity is a single entity extracted by the GLiNER model (ODE-2).

type OpStatus ¶ added in v0.4.0

type OpStatus string

OpStatus is the operation status for OperationProgress events.

const (
	OpStatusPending   OpStatus = "pending"
	OpStatusRunning   OpStatus = "running"
	OpStatusCompleted OpStatus = "completed"
	OpStatusFailed    OpStatus = "failed"
)

type OperationLatency ¶

type OperationLatency struct {
	AvgMs float64 `json:"avg_ms"`
	P95Ms float64 `json:"p95_ms"`
	Count uint64  `json:"count"`
}

OperationLatency represents latency stats for a specific operation.

type OpsStats ¶ added in v0.8.5

type OpsStats struct {
	Version        string `json:"version"`
	TotalVectors   int64  `json:"total_vectors"`
	NamespaceCount int64  `json:"namespace_count"`
	UptimeSeconds  int64  `json:"uptime_seconds"`
	Timestamp      int64  `json:"timestamp"`
	State          string `json:"state"`
}

OpsStats represents the ops stats response — Read-scoped; works with read-only API keys.

type QueryExplainRequest ¶

type QueryExplainRequest struct {
	Vector          []float32              `json:"vector"`
	TopK            int                    `json:"top_k,omitempty"`
	Filter          map[string]interface{} `json:"filter,omitempty"`
	IncludeMetadata bool                   `json:"include_metadata,omitempty"`
}

QueryExplainRequest represents a request to explain a query execution plan.

type QueryExplainResponse ¶

type QueryExplainResponse struct {
	Plan           map[string]interface{}   `json:"plan"`
	Steps          []map[string]interface{} `json:"steps,omitempty"`
	TotalTimeMs    *float64                 `json:"total_time_ms,omitempty"`
	Results        []QueryResult            `json:"results,omitempty"`
	IndexType      string                   `json:"index_type,omitempty"`
	VectorsScanned *int64                   `json:"vectors_scanned,omitempty"`
}

QueryExplainResponse represents the response from query explain.

type QueryOptions ¶

type QueryOptions struct {
	TopK            int                    `json:"top_k,omitempty"`
	Filter          map[string]interface{} `json:"filter,omitempty"`
	IncludeValues   bool                   `json:"include_values,omitempty"`
	IncludeMetadata bool                   `json:"include_metadata,omitempty"`
}

QueryOptions represents options for vector queries.

type QueryResult ¶

type QueryResult struct {
	ID       string                 `json:"id"`
	Score    float32                `json:"score"`
	Values   []float32              `json:"values,omitempty"`
	Metadata map[string]interface{} `json:"metadata,omitempty"`
}

QueryResult represents a single query match.

type RateLimitError ¶

type RateLimitError struct {
	DakeraError
	RetryAfter int
}

RateLimitError is raised when rate limit is exceeded.

func NewRateLimitError ¶

func NewRateLimitError(message string, statusCode int, body interface{}, code ErrorCode, retryAfter int) *RateLimitError

func (*RateLimitError) Error ¶

func (e *RateLimitError) Error() string

type RateLimitHeaders ¶ added in v0.7.0

type RateLimitHeaders struct {
	// Limit is X-RateLimit-Limit — max requests allowed in the current window (0 = not present).
	Limit int64
	// Remaining is X-RateLimit-Remaining — requests left in the current window (0 = not present).
	Remaining int64
	// Reset is X-RateLimit-Reset — Unix timestamp (seconds) when the window resets (0 = not present).
	Reset int64
	// QuotaUsed is X-Quota-Used — namespace vectors / storage consumed (0 = not present).
	QuotaUsed int64
	// QuotaLimit is X-Quota-Limit — namespace quota ceiling (0 = not present).
	QuotaLimit int64
}

RateLimitHeaders holds rate-limit and quota headers from an API response.

Fields are zero when the server does not include the header (e.g. non-namespaced endpoints where quota does not apply).

type RecallRequest ¶

type RecallRequest struct {
	AgentID       string   `json:"agent_id,omitempty"`
	Query         string   `json:"query"`
	TopK          int      `json:"top_k,omitempty"`
	MemoryType    string   `json:"memory_type,omitempty"`
	MinImportance *float32 `json:"min_importance,omitempty"`
	// COG-2: traverse KG from recalled memories and include
	// associatively linked memories in the response (default: false)
	IncludeAssociated bool `json:"include_associated,omitempty"`
	// COG-2: max associated memories to return (default: 10, max: 10)
	AssociatedMemoriesCap *int `json:"associated_memories_cap,omitempty"`
	// KG-3: traversal depth 1–3 (default: 1); requires IncludeAssociated
	AssociatedMemoriesDepth *int `json:"associated_memories_depth,omitempty"`
	// KG-3: minimum edge weight for KG traversal (default: 0.0)
	AssociatedMemoriesMinWeight *float32 `json:"associated_memories_min_weight,omitempty"`
	// CE-7: only recall memories created at or after this ISO-8601 timestamp
	Since *string `json:"since,omitempty"`
	// CE-7: only recall memories created at or before this ISO-8601 timestamp
	Until *string `json:"until,omitempty"`
	// CE-10: retrieval routing mode. nil uses the server default ("auto").
	Routing *RoutingMode `json:"routing,omitempty"`
	// CE-13: cross-encoder reranking. nil uses server default (true for recall).
	// Set to pointer-to-false to disable on latency-sensitive paths.
	Rerank *bool `json:"rerank,omitempty"`
	// CE-14: fusion strategy for hybrid recall. nil uses server default (FusionStrategyMinMax since v0.11.2).
	Fusion *FusionStrategy `json:"fusion,omitempty"`
	// CE-17: explicit vector/BM25 weight for Hybrid routing (0.0–1.0).
	// When set, overrides the adaptive heuristic from QueryClassifier.
	// Omit for adaptive defaults (recommended). Only effective when Routing = RoutingModeHybrid.
	VectorWeight *float32 `json:"vector_weight,omitempty"`
	// CE-23: pseudo-relevance feedback (PRF) passes for BM25 routing (1–3, default: 1).
	// Pass pointer-to-2 or pointer-to-3 for multi-hop or temporal queries.
	// Only effective when Routing = RoutingModeBm25.
	Iterations *uint8 `json:"iterations,omitempty"`
	// v0.11.0: session-adjacent memory enrichment (±5 min). nil uses server default (true).
	// Set to pointer-to-false to disable on latency-sensitive paths.
	Neighborhood *bool `json:"neighborhood,omitempty"`
}

RecallRequest represents a request to recall memories.

type RecallResponse ¶ added in v0.9.8

type RecallResponse struct {
	Memories           []RecalledMemory `json:"memories"`
	AssociatedMemories []RecalledMemory `json:"associated_memories,omitempty"`
}

RecallResponse is the response from the recall endpoint. Use associated_memories (COG-2 / KG-3) by setting IncludeAssociated on the request. Each associated memory includes a Depth field (KG-3).

type RecalledMemory ¶

type RecalledMemory struct {
	ID         string                 `json:"id"`
	Content    string                 `json:"content"`
	MemoryType string                 `json:"memory_type"`
	Importance float32                `json:"importance"`
	Score      float32                `json:"score"`
	Metadata   map[string]interface{} `json:"metadata,omitempty"`
	CreatedAt  int64                  `json:"created_at,omitempty"`
	// KG-3: hop depth at which this memory was found (only set on associated memories)
	Depth *int `json:"depth,omitempty"`
}

RecalledMemory represents a recalled memory with similarity score.

type RetryConfig ¶ added in v0.7.0

type RetryConfig struct {
	// MaxRetries is the maximum number of attempts (including the initial one).
	// Defaults to 3.
	MaxRetries int

	// BaseDelay is the initial backoff duration. Defaults to 100ms.
	BaseDelay time.Duration

	// MaxDelay is the upper bound on backoff duration. Defaults to 60s.
	MaxDelay time.Duration

	// Jitter, when true, randomises the delay ±50%. Defaults to true.
	Jitter bool
}

RetryConfig holds exponential-backoff retry parameters.

func DefaultRetryConfig ¶ added in v0.7.0

func DefaultRetryConfig() RetryConfig

DefaultRetryConfig returns a RetryConfig with sensible defaults.

type RotateEncryptionKeyRequest ¶ added in v0.9.5

type RotateEncryptionKeyRequest struct {
	// NewKey is the new passphrase or 64-char hex key to rotate to.
	NewKey string `json:"new_key"`
	// Namespace, if set, restricts rotation to memories in that namespace.
	// Omit (empty string) to rotate all namespaces.
	Namespace string `json:"namespace,omitempty"`
}

RotateEncryptionKeyRequest is the body for POST /v1/admin/encryption/rotate-key (SEC-3).

type RotateEncryptionKeyResponse ¶ added in v0.9.5

type RotateEncryptionKeyResponse struct {
	Rotated    int      `json:"rotated"`
	Skipped    int      `json:"skipped"`
	Namespaces []string `json:"namespaces"`
}

RotateEncryptionKeyResponse is returned by POST /v1/admin/encryption/rotate-key (SEC-3).

type RoutingMode ¶ added in v0.10.0

type RoutingMode string

RoutingMode controls which retrieval index the server uses for recall and search (CE-10). RoutingModeAuto (default) lets the server pick the best strategy based on the query.

const (
	// RoutingModeAuto lets the server pick the best retrieval strategy (default).
	RoutingModeAuto RoutingMode = "auto"
	// RoutingModeVector forces ANN vector search (HNSW).
	RoutingModeVector RoutingMode = "vector"
	// RoutingModeBM25 forces BM25 full-text search.
	RoutingModeBM25 RoutingMode = "bm25"
	// RoutingModeHybrid fuses ANN and BM25 scores (RRF).
	RoutingModeHybrid RoutingMode = "hybrid"
)

type SearchMemoriesRequest ¶

type SearchMemoriesRequest struct {
	AgentID       string   `json:"agent_id,omitempty"`
	Query         string   `json:"query"`
	TopK          int      `json:"top_k,omitempty"`
	MemoryType    string   `json:"memory_type,omitempty"`
	MinImportance *float32 `json:"min_importance,omitempty"`
	// CE-10: retrieval routing mode. nil uses the server default ("auto").
	Routing *RoutingMode `json:"routing,omitempty"`
	// CE-13: cross-encoder reranking. nil uses server default (false for search).
	// Set to pointer-to-true to enable reranking on search queries.
	Rerank *bool `json:"rerank,omitempty"`
}

SearchMemoriesRequest represents a request to search memories.

type SearchResult ¶

type SearchResult struct {
	Results       []QueryResult `json:"results"`
	TotalSearched int           `json:"totalSearched,omitempty"`
}

SearchResult represents the result of a vector query.

type ServerError ¶

type ServerError struct {
	DakeraError
}

ServerError is raised when the server returns a 5xx error.

func NewServerError ¶

func NewServerError(message string, statusCode int, body interface{}, code ErrorCode) *ServerError

func (*ServerError) Error ¶

func (e *ServerError) Error() string

type Session ¶

type Session struct {
	ID          string                 `json:"id"`
	AgentID     string                 `json:"agent_id"`
	StartedAt   int64                  `json:"started_at,omitempty"`
	EndedAt     *int64                 `json:"ended_at,omitempty"`
	Summary     string                 `json:"summary,omitempty"`
	Metadata    map[string]interface{} `json:"metadata,omitempty"`
	MemoryCount int                    `json:"memory_count"`
}

Session represents a session.

type SessionEndResponse ¶ added in v0.9.13

type SessionEndResponse struct {
	Session     Session `json:"session"`
	MemoryCount int     `json:"memory_count"`
}

SessionEndResponse is the response from POST /v1/sessions/{id}/end.

type SessionStartResponse ¶ added in v0.9.13

type SessionStartResponse struct {
	Session Session `json:"session"`
}

SessionStartResponse is the response from POST /v1/sessions/start.

type SlowQuery ¶

type SlowQuery struct {
	Query      string  `json:"query"`
	DurationMs float64 `json:"duration_ms"`
	Timestamp  string  `json:"timestamp"`
	Namespace  string  `json:"namespace,omitempty"`
}

SlowQuery represents a slow query entry.

type SlowQueryOptions ¶

type SlowQueryOptions struct {
	Limit         int `json:"limit,omitempty"`
	MinDurationMs int `json:"min_duration_ms,omitempty"`
}

SlowQueryOptions represents options for querying slow queries.

type StartSessionRequest ¶

type StartSessionRequest struct {
	AgentID  string                 `json:"agent_id"`
	Metadata map[string]interface{} `json:"metadata,omitempty"`
}

StartSessionRequest represents a request to start a session.

type StatusResponse ¶

type StatusResponse struct {
	Status string `json:"status"`
}

StatusResponse represents a generic status response.

type StorageAnalytics ¶

type StorageAnalytics struct {
	TotalBytes  uint64                      `json:"total_bytes"`
	IndexBytes  uint64                      `json:"index_bytes"`
	DataBytes   uint64                      `json:"data_bytes"`
	ByNamespace map[string]NamespaceStorage `json:"by_namespace,omitempty"`
}

StorageAnalytics represents storage analytics response.

type StoreMemoryRequest ¶

type StoreMemoryRequest struct {
	AgentID    string                 `json:"agent_id,omitempty"`
	Content    string                 `json:"content"`
	MemoryType string                 `json:"memory_type,omitempty"`
	Importance *float32               `json:"importance,omitempty"`
	Metadata   map[string]interface{} `json:"metadata,omitempty"`
	// TTLSeconds is an optional TTL in seconds. The memory is hard-deleted after
	// this many seconds from creation.
	TTLSeconds *int `json:"ttl_seconds,omitempty"`
	// ExpiresAt is an optional explicit expiry Unix timestamp (seconds). Takes
	// precedence over TTLSeconds when both are set. The memory is hard-deleted
	// by the decay engine on expiry (DECAY-3).
	ExpiresAt *int64    `json:"expires_at,omitempty"`
	SessionID string    `json:"session_id,omitempty"`
	Embedding []float32 `json:"embedding,omitempty"`
}

StoreMemoryRequest represents a request to store a memory.

type StoreMemoryResponse ¶

type StoreMemoryResponse struct {
	Memory          *Memory `json:"memory"`
	EmbeddingTimeMs *int64  `json:"embedding_time_ms,omitempty"`
}

StoreMemoryResponse represents the response from storing a memory.

The server wraps the created memory in a nested "memory" object:

{"memory": {"id": "...", "agent_id": "...", ...}, "embedding_time_ms": N}

type SummarizeRequest ¶

type SummarizeRequest struct {
	AgentID    string   `json:"agent_id"`
	MemoryIDs  []string `json:"memory_ids,omitempty"`
	TargetType string   `json:"target_type,omitempty"`
	DryRun     bool     `json:"dry_run,omitempty"`
}

SummarizeRequest represents a request to summarize memories.

type SummarizeResponse ¶

type SummarizeResponse struct {
	Summary     string `json:"summary"`
	SourceCount int    `json:"source_count"`
	NewMemoryID string `json:"new_memory_id,omitempty"`
}

SummarizeResponse represents the response from summarization.

type TextDocument ¶

type TextDocument struct {
	ID         string                 `json:"id"`
	Text       string                 `json:"text"`
	Metadata   map[string]interface{} `json:"metadata,omitempty"`
	TTLSeconds *int                   `json:"ttl_seconds,omitempty"`
}

TextDocument represents input for upserting a text document with automatic embedding.

type TextQueryOptions ¶

type TextQueryOptions struct {
	TopK           int                    `json:"top_k,omitempty"`
	Filter         map[string]interface{} `json:"filter,omitempty"`
	IncludeText    bool                   `json:"include_text,omitempty"`
	IncludeVectors bool                   `json:"include_vectors,omitempty"`
	Model          EmbeddingModel         `json:"model,omitempty"`
}

TextQueryOptions represents options for text query operations.

type TextQueryResponse ¶

type TextQueryResponse struct {
	Results         []TextSearchResult `json:"results"`
	Model           EmbeddingModel     `json:"model"`
	EmbeddingTimeMs int64              `json:"embedding_time_ms"`
	SearchTimeMs    int64              `json:"search_time_ms"`
}

TextQueryResponse represents the response from a text query operation.

type TextSearchResult ¶

type TextSearchResult struct {
	ID       string                 `json:"id"`
	Score    float32                `json:"score"`
	Text     string                 `json:"text,omitempty"`
	Metadata map[string]interface{} `json:"metadata,omitempty"`
	Vector   []float32              `json:"vector,omitempty"`
}

TextSearchResult represents a single text search result.

type TextUpsertOptions ¶

type TextUpsertOptions struct {
	Model EmbeddingModel `json:"model,omitempty"`
}

TextUpsertOptions represents options for text upsert operations.

type TextUpsertResponse ¶

type TextUpsertResponse struct {
	UpsertedCount   int            `json:"upserted_count"`
	TokensProcessed int            `json:"tokens_processed"`
	Model           EmbeddingModel `json:"model"`
	EmbeddingTimeMs int64          `json:"embedding_time_ms"`
}

TextUpsertResponse represents the response from a text upsert operation.

type ThroughputAnalytics ¶

type ThroughputAnalytics struct {
	Period              string            `json:"period"`
	TotalOperations     uint64            `json:"total_operations"`
	OperationsPerSecond float64           `json:"operations_per_second"`
	ByOperation         map[string]uint64 `json:"by_operation,omitempty"`
}

ThroughputAnalytics represents throughput analytics response.

type TimeoutError ¶

type TimeoutError struct {
	DakeraError
}

TimeoutError is raised when a request times out.

func NewTimeoutError ¶

func NewTimeoutError(message string) *TimeoutError

func (*TimeoutError) Error ¶

func (e *TimeoutError) Error() string

type TtlConfig ¶

type TtlConfig struct {
	Namespace  string `json:"namespace"`
	TtlSeconds int    `json:"ttl_seconds"`
	Strategy   string `json:"strategy,omitempty"`
}

TtlConfig represents TTL configuration for a namespace.

type UnifiedQueryRequest ¶

type UnifiedQueryRequest struct {
	Vector          []float32              `json:"vector,omitempty"`
	Text            string                 `json:"text,omitempty"`
	TopK            int                    `json:"top_k,omitempty"`
	Filter          map[string]interface{} `json:"filter,omitempty"`
	IncludeMetadata bool                   `json:"include_metadata,omitempty"`
	IncludeVectors  bool                   `json:"include_vectors,omitempty"`
	VectorWeight    *float32               `json:"vector_weight,omitempty"`
	TextWeight      *float32               `json:"text_weight,omitempty"`
	FusionMethod    string                 `json:"fusion_method,omitempty"`
	Rerank          bool                   `json:"rerank,omitempty"`
}

UnifiedQueryRequest represents a unified query combining vector and text search.

type UnifiedQueryResponse ¶

type UnifiedQueryResponse struct {
	Results      []UnifiedSearchResult `json:"results"`
	SearchTimeMs *int64                `json:"search_time_ms,omitempty"`
	FusionMethod string                `json:"fusion_method,omitempty"`
}

UnifiedQueryResponse represents the response from unified query.

type UnifiedSearchResult ¶

type UnifiedSearchResult struct {
	ID          string                 `json:"id"`
	Score       float32                `json:"score"`
	VectorScore *float32               `json:"vector_score,omitempty"`
	TextScore   *float32               `json:"text_score,omitempty"`
	Values      []float32              `json:"values,omitempty"`
	Content     string                 `json:"content,omitempty"`
	Metadata    map[string]interface{} `json:"metadata,omitempty"`
}

UnifiedSearchResult represents a single result from unified query.

type UpdateImportanceRequest ¶

type UpdateImportanceRequest struct {
	AgentID    string   `json:"agent_id,omitempty"`
	MemoryIDs  []string `json:"memory_ids"`
	Importance float32  `json:"importance"`
}

UpdateImportanceRequest represents a request to update memory importance.

type UpdateMemoryRequest ¶

type UpdateMemoryRequest struct {
	Content    *string                `json:"content,omitempty"`
	Metadata   map[string]interface{} `json:"metadata,omitempty"`
	MemoryType *string                `json:"memory_type,omitempty"`
}

UpdateMemoryRequest represents a request to update a memory.

type UpsertResponse ¶

type UpsertResponse struct {
	UpsertedCount int `json:"upsertedCount"`
}

UpsertResponse represents the response from an upsert operation.

type ValidationError ¶

type ValidationError struct {
	DakeraError
}

ValidationError is raised when request validation fails.

func NewValidationError ¶

func NewValidationError(message string, statusCode int, body interface{}, code ErrorCode) *ValidationError

func (*ValidationError) Error ¶

func (e *ValidationError) Error() string

type Vector ¶

type Vector struct {
	ID       string                 `json:"id"`
	Values   []float32              `json:"values,omitempty"`
	Metadata map[string]interface{} `json:"metadata,omitempty"`
}

Vector represents a stored vector with its metadata.

type VectorInput ¶

type VectorInput struct {
	ID       string                 `json:"id"`
	Values   []float32              `json:"values"`
	Metadata map[string]interface{} `json:"metadata,omitempty"`
}

VectorInput represents input for upserting a vector.

type VectorMutationOp ¶ added in v0.4.0

type VectorMutationOp string

VectorMutationOp is the mutation type for VectorsMutated events.

const (
	VectorMutationUpserted VectorMutationOp = "upserted"
	VectorMutationDeleted  VectorMutationOp = "deleted"
)

type WakeUpOptions ¶ added in v0.9.14

type WakeUpOptions struct {
	// TopN is the maximum number of memories to return (default 20, max 100).
	TopN *int
	// MinImportance filters out memories below this importance threshold (default 0.0).
	MinImportance *float32
}

WakeUpOptions contains optional parameters for GetWakeUpContext.

type WakeUpResponse ¶ added in v0.9.14

type WakeUpResponse struct {
	// AgentID is the agent whose memories are returned.
	AgentID string `json:"agent_id"`
	// Memories are the top-N memories ranked by recency-weighted importance.
	Memories []Memory `json:"memories"`
	// TotalAvailable is the total number of memories available before the
	// top_n cap was applied.
	TotalAvailable int64 `json:"total_available"`
}

WakeUpResponse is returned by GET /v1/agents/{agent_id}/wake-up (DAK-1690).

Contains top-N memories ranked by importance × exp(-ln2 × age / 14d) for fast agent start-up context loading. No embedding inference — served from the metadata index for sub-millisecond latency.

Requires Read scope on the agent namespace.

type WarmCacheRequest ¶

type WarmCacheRequest struct {
	VectorIDs      []string `json:"vector_ids,omitempty"`
	Priority       string   `json:"priority,omitempty"`
	TargetTier     string   `json:"target_tier,omitempty"`
	Background     bool     `json:"background,omitempty"`
	TTLHintSeconds *int     `json:"ttl_hint_seconds,omitempty"`
	AccessPattern  string   `json:"access_pattern,omitempty"`
	MaxVectors     *int     `json:"max_vectors,omitempty"`
}

WarmCacheRequest represents a request to warm the cache.

type WarmCacheResponse ¶

type WarmCacheResponse struct {
	Status        string `json:"status"`
	EntriesWarmed int    `json:"entries_warmed"`
	TimeTakenMs   *int64 `json:"time_taken_ms,omitempty"`
}

WarmCacheResponse represents the response from cache warming.

Directories ¶

Path Synopsis
examples
advanced command
Example: Dakera Go SDK — Text Search, Hybrid Search & Admin Operations
Example: Dakera Go SDK — Text Search, Hybrid Search & Admin Operations
basic command
Example: Basic Dakera Go SDK usage
Example: Basic Dakera Go SDK usage
memory command
Example: Dakera Go SDK — Memory & Session Operations
Example: Dakera Go SDK — Memory & Session Operations

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL