Overview
AgentDoor uses a pluggable storage interface (AgentStore) to persist agent records, challenges, and metadata. Multiple backends are provided out of the box.
Available Backends
Memory Store (Default)
In-memory storage using JavaScript Maps. Suitable for development and testing.- Zero setup required
- Fast performance
- No external dependencies
- Data lost on process restart
- Not suitable for production
- Cannot scale horizontally
- Development environments
- Testing
- Serverless functions with ephemeral state
SQLite Store
File-based SQL database usingbetter-sqlite3. Suitable for single-process deployments.
- Persistent storage
- No external database required
- Excellent performance
- Automatic schema initialization
- WAL mode enabled by default
- Single-process only
- Not suitable for distributed systems
- Edge deployments
- Local-first applications
- Single-server production apps
Postgres Store
PostgreSQL adapter using thepg library. Suitable for production deployments.
- Multi-process support
- Horizontal scalability
- ACID guarantees
- Rich querying capabilities
- Compatible with managed services (Neon, Supabase, RDS)
- Requires external database
- Higher latency than SQLite
- More complex setup
- Production deployments
- Multi-instance applications
- High-availability setups
- Serverless with connection pooling
Storage Interface
All storage backends implement theAgentStore interface:
Agent Data Structure
Challenge Data Structure
Custom Storage Backend
You can implement custom storage backends by implementing theAgentStore interface:
Example: Redis Store
Cleanup and Maintenance
Expired Challenges
Periodically clean up expired challenges to prevent storage bloat:Graceful Shutdown
Close database connections on shutdown:Migration Guide
From Memory to SQLite
From SQLite to Postgres
Performance Tips
- Use connection pooling for Postgres in production
- Enable WAL mode for SQLite (enabled by default)
- Index frequently queried fields (public_key, api_key_hash)
- Run cleanup jobs during off-peak hours
- Monitor database size and archive old records
- Use read replicas for high-traffic deployments