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

Deprecated import. from praisonai.db.adapter import TursoDB and the top-level from praisonai import DB / PraisonAIDB / PraisonDB now emit DeprecationWarning — as of PR #4595 the top-level aliases route through praisonai.db so the warning fires consistently. Use the db(...) factory instead:
3

Test Edge Performance


Installation


Connection Modes

praisonai persistence doctor auto-detects libsql://… URLs as the turso backend — no --*-backend flag needed. See Backend Auto-Detection.
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 the db Factory

Legacy import. from praisonai.db.adapter import TursoDB still works but now emits DeprecationWarning (PR #4595). Prefer the db(...) factory above.

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