Configure Session Storage
This guide explains how to configure session storage for maintaining conversation state across connections.
Session Storage Options
Section titled “Session Storage Options”Omnia supports two session storage backends:
| Backend | Use Case | Persistence |
|---|---|---|
| Memory | Development, testing | Pod lifetime only |
| Redis | Production, multi-replica | Persistent |
Using In-Memory Sessions
Section titled “Using In-Memory Sessions”In-memory storage is the default and requires no additional configuration:
apiVersion: omnia.altairalabs.ai/v1alpha1kind: AgentRuntimemetadata: name: my-agentspec: # ... other config session: type: memory ttl: 1hNote: Sessions are lost when the pod restarts. Not suitable for production with multiple replicas.
Using Redis Sessions
Section titled “Using Redis Sessions”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 session: type: redis ttl: 24h storeRef: name: redis-credentials key: urlSession TTL
Section titled “Session TTL”The ttl field controls how long sessions remain valid after the last activity:
session: ttl: 1h # Sessions expire 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"}