---
title: "SQL Agent"
description: "Use SQL Agent to run queries against relational databases"
---

import { Callout } from "nextra/components";

## What is SQL Agent and how to use it?

The built-in SQL agent is a skill that you can leverage to run real-time analytics and queries against a real relational database. The agent can do all of the following:

- `list-databases`: View its current connections and sources it can leverage.
- `list-tables`: View all of the available tables within a database.
- `check-table-schema`: Check the available columns of a table for types and possible value stores.
- `query`: Run a valid SQL query on a database to product a set of `rows` that will later be used in your answer.

<Callout type="warning" emoji="️🔧">
  **Caution!**

You should use the SQL agent with a <b>read-only</b> database user. While the agent is instructed to not provide anything other than SELECT statements, this does not prevent it from running other SQL commands that could modify your data!

</Callout>

_Example 1:_ <br/>
`@agent can you summarize all of the sales volume for May 2024 in the backend-office DB?`

_Example 2:_ (_assuming you have the `save-file` skill enabled_)<br/>
`@agent can you grab the emails of the most recent 10 customers and save that to customer.csv?`
