Looking for a complete agent state management solution? Check out AgentFS - our specialized SDK designed specifically for AI agents, offering filesystem operations, key-value storage, and automatic tool call tracking in a single database file.
- Embedded Databases for local-first agent processing, and
- Turso Sync for distributed agent coordination with cloud persistence.
Embedded Databases (Local-First)
Use embedded databases for agents that process data locally within a single workflow, need offline-capable access, or work with temporary data without sharing state with other agents. Local data pipelines, on-device processing of sensitive data, development/testing workflows, and single-agent analysis tasks.Data is isolated to this agent instance with no built-in multi-agent collaboration or cross-session persistence (unless you manage the file yourself).
Turso Sync (Cloud-Connected)
Use Turso Sync for agents that need persistent memory across sessions, coordinate with other agents, or require cloud-backed durability for long-running workflows. 💡 Conversational agents with session memory, multi-agent coordination systems, long-running workflows with recovery needs, and agents reporting to central systems.Sync modes:
sync (bidirectional), pull (cloud → agent), push (agent → cloud).Multi-Agent Architectures
Pattern 1: Isolated Agent Databases
Each agent gets its own embedded database. Best for independent agents with no shared state.Independent agents performing separate tasks with no coordination needs and maximum isolation.
Pattern 2: Shared Database with Sync
Multiple agents connect to the same synced database. Best for coordinated agent systems.Pattern 3: Hub-and-Spoke
A central synced database with agents pushing results and pulling new tasks.Database-Per-Agent Pattern
For systems managing many agents, you can create individual databases for each agent using the Platform API:Complete isolation between agents, independent scaling per agent, improved security (compromised agent only affects one database), and easy cleanup when agents are retired.
Examples
Explore these examples to see agent database patterns in action:- sync-node — Node.js with bidirectional sync to Turso Cloud
- sync-wasm-vite — Browser (WASM) with bidirectional sync to Turso Cloud
- database-node — Node.js, local file database (no sync)
- database-wasm-vite — Browser (WASM), local database in the browser