ArkMemory

ArkMemory gives AI agents persistent memory across tasks using in-context, Redis, or vector store backends.

API: arkonis.dev/v1alpha1 Kind: ArkMemory Scope: Namespaced

By default, each agent task starts fresh — no knowledge of previous interactions. ArkMemory gives agents durable memory that persists across tasks and pod restarts. It declares where and how memory is stored, and ArkAgent claims it by name via spec.memoryRef.


How it works

The operator injects memory configuration into agent pods as environment variables. The agent runtime connects to the configured backend before polling the task queue.

During a task, the runtime:

  1. Queries the memory backend for relevant past context and prepends it to the prompt
  2. Writes the task result back to the memory backend after completion

The LLM never calls the memory backend directly — the runtime handles all reads and writes.

If the memory backend is unreachable at pod startup, the agent logs the error and continues without memory. Memory writes are best-effort and do not affect task delivery guarantees.


Backends

in-context

No external dependency. Memory is carried forward within a single task’s context window only. Once the task ends, the memory is gone. Use for stateless agents or prototyping.

redis

Short-term memory backed by Redis. Entries expire via a configurable TTL. Use for session-scoped context, recent interaction history, or deduplication state.

apiVersion: arkonis.dev/v1alpha1
kind: ArkMemory
metadata:
  name: research-memory
  namespace: default
spec:
  backend: redis
  redis:
    secretRef:
      name: redis-credentials   # must contain REDIS_URL
    ttlSeconds: 3600
    maxEntries: 500

vector-store

Long-term semantic memory backed by a vector database (Qdrant, Pinecone, or Weaviate). Past results are embedded and stored as vectors. At task start, the runtime performs a similarity search and retrieves the most relevant past context.

apiVersion: arkonis.dev/v1alpha1
kind: ArkMemory
metadata:
  name: research-memory-vector
  namespace: default
spec:
  backend: vector-store
  vectorStore:
    provider: qdrant
    endpoint: http://qdrant.agent-infra.svc.cluster.local:6333
    collection: agent-memories
    secretRef:
      name: qdrant-credentials
    ttlSeconds: 86400

Backend comparison

BackendBest forNotes
in-contextStateless agents, prototypingNo external dependency.
redisShort-term memory, session stateFast reads and writes. Entries expire via TTL.
vector-storeLong-term semantic memory, RAGSimilarity search. Requires a running vector database.

Attaching memory to an agent

apiVersion: arkonis.dev/v1alpha1
kind: ArkMemory
metadata:
  name: research-memory
  namespace: default
spec:
  backend: redis
  redis:
    secretRef:
      name: redis-credentials
    ttlSeconds: 7200
---
apiVersion: arkonis.dev/v1alpha1
kind: ArkAgent
metadata:
  name: research-agent
  namespace: default
spec:
  model: llama3.2
  systemPrompt: "You are a research agent."
  memoryRef:
    name: research-memory

The same ArkMemory can be referenced by multiple ArkAgent resources in the same namespace.


Spec reference

spec

FieldTypeRequiredDescription
backendstringyesin-context, redis, or vector-store.
redisRedisMemoryConfigconditionalRequired when backend is redis.
vectorStoreVectorStoreMemoryConfigconditionalRequired when backend is vector-store.

spec.redis

FieldTypeDefaultDescription
secretRef.namestringrequiredName of a Secret in the same namespace. Must contain a REDIS_URL key.
ttlSecondsint3600How long memory entries are retained. 0 means no expiry.
maxEntriesint0 (unlimited)Maximum entries per agent instance. Oldest entries are evicted when the limit is reached.

spec.vectorStore

FieldTypeDefaultDescription
providerstringrequiredqdrant, pinecone, or weaviate.
endpointstringrequiredBase URL of the vector database.
collectionstringagent-memoriesCollection or index name.
secretRef.namestringnoSecret containing a VECTOR_STORE_API_KEY key. Required for hosted providers.
ttlSecondsint0How long entries are retained. 0 means no expiry.

status

FieldTypeDescription
conditions[]ConditionReady=True when the spec is valid and accepted.
observedGenerationint64The .metadata.generation this status reflects.

Environment variables injected

VariableDescription
AGENT_MEMORY_BACKENDin-context, redis, or vector-store
AGENT_MEMORY_REDIS_URLFrom the referenced Secret
AGENT_MEMORY_REDIS_TTLTTL in seconds
AGENT_MEMORY_REDIS_MAX_ENTRIESEntry cap
AGENT_MEMORY_VECTOR_STORE_PROVIDERqdrant, pinecone, or weaviate
AGENT_MEMORY_VECTOR_STORE_ENDPOINTBase URL
AGENT_MEMORY_VECTOR_STORE_COLLECTIONCollection name
AGENT_MEMORY_VECTOR_STORE_API_KEYFrom the referenced Secret (if set)
AGENT_MEMORY_VECTOR_STORE_TTLTTL in seconds

See also