Configure context store
This guide explains how to configure the context store for maintaining conversation state across connections.
Context store options
Section titled “Context store options”Omnia supports two context store backends:
| Backend | Use Case | Persistence |
|---|---|---|
| Memory | Development, testing | Pod lifetime only |
| Redis | Production, multi-replica | Persistent |
Using in-memory context store
Section titled “Using in-memory context store”In-memory storage is the default and requires no additional configuration:
apiVersion: omnia.altairalabs.ai/v1alpha1kind: AgentRuntimemetadata: name: my-agentspec: # ... other config context: type: memory ttl: 1hNote: Context is lost when the pod restarts. Not suitable for production with multiple replicas.
Using Redis context store
Section titled “Using Redis context store”For production deployments, use Redis:
Step 1: deploy Redis
Section titled “Step 1: deploy Redis”kubectl create namespace redishelm install redis bitnami/redis -n redis \ --set auth.password=your-redis-passwordStep 2: create Redis secret
Section titled “Step 2: create Redis secret”apiVersion: v1kind: Secretmetadata: name: redis-credentialstype: OpaquestringData: url: "redis://:your-redis-password@redis-master.redis.svc:6379"Step 3: configure AgentRuntime
Section titled “Step 3: configure AgentRuntime”apiVersion: omnia.altairalabs.ai/v1alpha1kind: AgentRuntimemetadata: name: my-agentspec: # ... other config context: type: redis ttl: 24h storeRef: name: redis-credentials key: urlContext TTL
Section titled “Context TTL”The ttl field controls how long context remains valid after the last activity:
context: ttl: 1h # Context expires after 1 hour of inactivitySupported formats:
30m- 30 minutes1h- 1 hour24h- 24 hours168h- 1 week
Resuming sessions
Section titled “Resuming sessions”Clients can resume existing sessions by providing the session ID:
{ "type": "message", "session_id": "existing-session-id", "content": "Continue our conversation..."}If the session exists and hasn’t expired, the conversation history is preserved.
Session data
Section titled “Session data”Each session stores:
- Conversation messages
- Agent state
- Custom metadata
Access session data programmatically using the session ID returned in the connected message:
{"type": "connected", "session_id": "sess-abc123"}