ArkMemory
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:
- Queries the memory backend for relevant past context and prepends it to the prompt
- 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
| Backend | Best for | Notes |
|---|---|---|
in-context | Stateless agents, prototyping | No external dependency. |
redis | Short-term memory, session state | Fast reads and writes. Entries expire via TTL. |
vector-store | Long-term semantic memory, RAG | Similarity 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
| Field | Type | Required | Description |
|---|---|---|---|
backend | string | yes | in-context, redis, or vector-store. |
redis | RedisMemoryConfig | conditional | Required when backend is redis. |
vectorStore | VectorStoreMemoryConfig | conditional | Required when backend is vector-store. |
spec.redis
| Field | Type | Default | Description |
|---|---|---|---|
secretRef.name | string | required | Name of a Secret in the same namespace. Must contain a REDIS_URL key. |
ttlSeconds | int | 3600 | How long memory entries are retained. 0 means no expiry. |
maxEntries | int | 0 (unlimited) | Maximum entries per agent instance. Oldest entries are evicted when the limit is reached. |
spec.vectorStore
| Field | Type | Default | Description |
|---|---|---|---|
provider | string | required | qdrant, pinecone, or weaviate. |
endpoint | string | required | Base URL of the vector database. |
collection | string | agent-memories | Collection or index name. |
secretRef.name | string | no | Secret containing a VECTOR_STORE_API_KEY key. Required for hosted providers. |
ttlSeconds | int | 0 | How long entries are retained. 0 means no expiry. |
status
| Field | Type | Description |
|---|---|---|
conditions | []Condition | Ready=True when the spec is valid and accepted. |
observedGeneration | int64 | The .metadata.generation this status reflects. |
Environment variables injected
| Variable | Description |
|---|---|
AGENT_MEMORY_BACKEND | in-context, redis, or vector-store |
AGENT_MEMORY_REDIS_URL | From the referenced Secret |
AGENT_MEMORY_REDIS_TTL | TTL in seconds |
AGENT_MEMORY_REDIS_MAX_ENTRIES | Entry cap |
AGENT_MEMORY_VECTOR_STORE_PROVIDER | qdrant, pinecone, or weaviate |
AGENT_MEMORY_VECTOR_STORE_ENDPOINT | Base URL |
AGENT_MEMORY_VECTOR_STORE_COLLECTION | Collection name |
AGENT_MEMORY_VECTOR_STORE_API_KEY | From the referenced Secret (if set) |
AGENT_MEMORY_VECTOR_STORE_TTL | TTL in seconds |
See also
- ArkAgent —
spec.memoryReffield