Skip to content

Session Management

Status: stable | Score: 100% | Last Tested: 2026-07-14

Robust session persistence, client-side authentication, and contextual memory management for AI agent interactions. This allows agents to maintain cohesive state across distinct execution boundaries, share sessions via standardized bundles, and restore structured histories instantly.

Sessions are assigned random UUIDs and persisted in a thread-safe database layout. The session system includes support for exportable SessionBundle structures to transfer history across devices. Context restores utilize the “Context Virtualization Turn Pack” allowing varying tiers of history restoration (shallow, medium, or deep) based on active token budgets.

  • src/session/ (session storage, UUID bindings, and lifecycle management)
  • src/domain/memory/ (session context builders and WorkingMemory integration)
  • Create Sessions with UUID: Unique session identifier provisioning.
  • Persist Session State: Durable persistence of message exchanges and entity bindings.
  • Session TTL & Expiration: Clean security boundaries with automated TTL-based token invalidations.
  • Session Cleanup/Eviction: Garbage collection routines for expired or dangling threads.
  • Multi-instance Session Sharing: Sharing and migrating sessions between local nodes using SessionBundle.
  • Session bundle import/export integration tests.
  • Turn-based virtualization and memory budget calculation unit tests.
  • Integrated securely with the fallback complete chain.
  • Virtualization turns are optimized to ensure no high O(N) allocation overheads occur when compiling large historical text blocks.

Create a persistent chat session and bundle session state for transfer:

Terminal window
# Create a new session
curl -X POST "http://localhost:8006/v1/sessions" \
-H "X-Xavier-Token: $XAVIER_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"title": "Agent Session 1"
}'
# Export the entire session bundle
curl -H "X-Xavier-Token: $XAVIER_TOKEN" \
"http://localhost:8006/v1/sessions/export?id=session_abc123" \
-o session_bundle.json