Installation
Configuration
LibSQLStore supports both local file-based databases and remote Turso databases.Local File Database
Remote Turso Database
In-Memory Database
For testing purposes:Configuration Options
Unique identifier for the storage instance
Database URL. Can be:
file:./path/to/db.db- Local file databasefile::memory:- In-memory databaselibsql://your-db.turso.io- Remote Turso database
Authentication token for remote Turso databases
Maximum retries for write operations on SQLITE_BUSY errors
Initial backoff time in milliseconds for retries (doubles with each retry)
Disable automatic table initialization. Useful for CI/CD pipelines where you want to control when migrations run
Usage Examples
Access Storage Domains
Environment-Based Configuration
Manual Migration Control
Vector Store Support
LibSQL also provides vector storage capabilities:Storage Domains
LibSQL storage supports all Mastra storage domains:memory- Thread-based conversation persistenceworkflows- Workflow execution snapshotsobservability- Telemetry and loggingagents- Agent configurationsdatasets- Training and evaluation datasetsexperiments- Evaluation experiment resultspromptBlocks- Reusable prompt templatesscorerDefinitions- Evaluation scorer configurationsmcpClients- MCP client configurationsmcpServers- MCP server configurationsworkspaces- Workspace metadataskills- Agent skill definitionsblobs- Binary large object storage
Performance Considerations
WAL Mode
LibSQL automatically enables WAL (Write-Ahead Logging) mode for file-based databases to improve concurrency:Retry Strategy
Write operations automatically retry on SQLITE_BUSY errors with exponential backoff:Best Practices
Local Development
Use file-based databases for local development:
Production Deployment
Use Turso for production with edge replication:
Testing
Use in-memory databases for tests:
Related Resources
PostgreSQL Storage
Alternative SQL storage with advanced features
MongoDB Storage
Document-based NoSQL storage
Turso Documentation
Official Turso database documentation
LibSQL GitHub
LibSQL open-source repository