Skip to main content
Turso provides SQLite-compatible databases at the edge with embedded replicas, delivering microsecond reads and global distribution for your AI agents.
The user shares a preference; Turso edge storage persists it for fast reads on the next turn.

How It Works

Quick Start

1

Get Turso Credentials

  1. Install Turso CLI: curl -sSfL https://get.tur.so/install.sh | bash
  2. Create database: turso db create mydb
  3. Get credentials:
Set environment variables:
2

Create Edge Agent

3

Test Edge Performance


Installation


Connection Modes

Local SQLite file syncs with remote Turso server:

Remote Only

Direct connection to Turso edge:

Local Only

Pure local SQLite for development:

Configuration Options


Usage Patterns

Using Convenience Class

Multi-Region Setup

Full Lifecycle with Edge Performance


Turso-Specific Features

Manual Sync Control

Control when local replica syncs to remote:

Database Scaling

Turso automatically scales to handle traffic:

Global Replication

Create replicas in multiple regions:

Best Practices

Use embedded replicas for fastest reads:
Embedded replicas continue working during network outages:
Local replicas grow with conversation history:
Separate different data types for optimal performance:

Environment Variables


Performance Comparison


Troubleshooting

Sync Failures

If replica sync fails:

Token Expiration

Turso tokens can expire. Regenerate them:

Replica File Permissions

Ensure local replica file is writable:

Cloud Databases Overview

Compare all cloud database providers

Local SQLite

Pure local SQLite for development