Skip to main content
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.
AI agents need databases to store context, track state, and maintain memory across executions. Turso Database offers two powerful approaches:
  • 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.
Benefit from zero network latency, full offline capability, complete data privacy, and simple single-file deployment.
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.
💡 Persistent memory across restarts, multi-agent coordination via shared state, cloud backup and durability, with fast local reads and background sync.
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.
💡 Agents coordinating work through shared task queues or a common knowledge base.

Pattern 3: Hub-and-Spoke

A central synced database with agents pushing results and pulling new tasks.
💡 Many worker agents feeding results to a central coordinator for monitoring or aggregation with unidirectional data flow.

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: