Skip to main content
DatabaseContextProvider gives agents read/write access to any SQL database via SQLAlchemy. Two tools: query_database for reads, update_database for writes.

Prerequisites

Example

Both engines are required. The read sub-agent uses readonly_engine exclusively. Even if the model tries to run a write query, the database connection physically cannot execute it.

Provider Params

Tools Exposed

Privilege Separation

The read and write sub-agents use separate database connections:
This is infrastructure-level protection. The read sub-agent’s connection cannot execute writes regardless of what SQL the model generates.

Multiple Databases

Use different id values to expose multiple databases:

Read-only Mode

Cookbook

Database Context Provider

Read/write with separate engines