StorageDriver Interface
All storage implementations conform to the same interface:() => Promise<void>
Optional. Postgres and Mongo call this to create tables/indexes. SQLite and in-memory no-op. Agentium calls it for you when memory starts.
(namespace, key) => Promise<T | null>
Retrieves a value by namespace and key. Returns
null if not found.(namespace, key, value) => Promise<void>
Stores a value. Values are JSON-serialized automatically.
(namespace, key) => Promise<void>
Removes a key from the namespace.
(namespace, prefix?) => Promise<Array<{key, value}>>
Lists all keys in a namespace, optionally filtered by prefix.
() => Promise<void>
Closes connections and releases resources.
Choosing a Driver
Development & Testing
Use InMemoryStorage—no setup, no dependencies. Data is lost on restart.
Single-Node Production
Use SqliteStorage or PostgresStorage for durable, file-based or relational persistence.
Distributed / Scale
Use PostgresStorage or MongoDBStorage for multi-instance deployments.
Document-Oriented
Use MongoDBStorage if you already run MongoDB or prefer document storage.
Comparison Table
Clients are optional peer dependencies. Importing
Agent does not install them. Only the driver you construct needs its client.
Namespaces
Storage uses namespaces to isolate data. Agentium reserves namespaces such as:memory:short— Short-term conversation messagesmemory:long— Long-term summariessession:*— Session metadata
Quick Example
Next Steps
- In-Memory Storage — Zero-config, ephemeral storage
- SQLite Storage — File-based persistence with
better-sqlite3 - PostgreSQL Storage — Production-grade relational storage
- MongoDB Storage — Document-based storage for scale