Skip to main content
Set db on an agent, team, or workflow to persist its sessions and runs. Database implementations can also back memories, learnings, evaluations, knowledge content, traces, and schedules. Supported tables vary by provider.
  • Chat history. Include previous messages in context for multi-turn conversations.
  • Session persistence. Store session information and conversation history across requests.
  • State management. Store session state across runs.
  • Context control. Store session summaries and the runs used to build model context.
  • Memory and knowledge. Store user memories, learned knowledge, and knowledge content metadata.
  • Tracing and evaluation. Store detailed traces for debugging, monitoring, and building evaluation datasets.
  • Data access. Query records in the database you configure and use them to build evaluation datasets or review run quality.

Quick Start

The agent now persists sessions and includes the last 3 runs in every request. Database storage overview

Guides

Chat History

Include previous messages in context for multi-turn conversations.

Session Storage

Store and retrieve session data from your database.

Session Summaries

Condense long conversations to manage token costs.

Storage Control

Choose what gets persisted to your database.

Works With Teams and Workflows

Agents, teams, and workflows all accept the db parameter:

Supported Databases

Use SQLite for local development or choose a networked provider for a deployed application. See the database index.

Async Support

For async applications, use the async database classes:

Troubleshooting

You’re using a synchronous engine with an async database class. Use create_async_engine from sqlalchemy.ext.asyncio.
You’re using an async engine with a synchronous database class. Use create_engine from sqlalchemy.