> ## Documentation Index
> Fetch the complete documentation index at: https://agno-v2.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# Redshift

> The RedshiftTools toolkit enables an Agent to interact with Amazon Redshift data warehouses.

**RedshiftTools** enable an Agent to interact with Amazon Redshift data warehouses.

## Prerequisites

The following example requires the `redshift_connector` and `openai` libraries.

```shell theme={null}
uv pip install -U redshift-connector openai
```

You will also need an Amazon Redshift cluster or Redshift Serverless endpoint. For IAM authentication, ensure your AWS credentials are configured.

## Example

The following agent will list all tables in the database.

```python cookbook/91_tools/redshift_tools.py theme={null}
from agno.agent import Agent
from agno.tools.redshift import RedshiftTools

# Initialize RedshiftTools with connection details
redshift_tools = RedshiftTools(
    host="your-cluster.abc123.us-east-1.redshift.amazonaws.com",
    database="dev",
    user="your-username",
    password="your-password",
    table_schema="public",
)

# Create an agent with the RedshiftTools
agent = Agent(tools=[redshift_tools])

# Example: Ask the agent to list tables
agent.print_response(
    "List the tables in the database and describe the sales table"
)
```

## Toolkit Params

| Parameter | Type | Default | Description |
| - | - | - | - |
| `host` | `Optional[str]` | `None` | Redshift cluster endpoint. Uses `REDSHIFT_HOST`. |
| `port` | `int` | `5439` | Port for the database connection. |
| `database` | `Optional[str]` | `None` | Database name. Uses `REDSHIFT_DATABASE`. |
| `user` | `Optional[str]` | `None` | Username for standard authentication. |
| `password` | `Optional[str]` | `None` | Password for standard authentication. |
| `iam` | `bool` | `False` | Enable IAM authentication. |
| `cluster_identifier` | `Optional[str]` | `None` | Cluster identifier for IAM auth. Uses `REDSHIFT_CLUSTER_IDENTIFIER`. |
| `region` | `Optional[str]` | `None` | AWS region for IAM auth. Uses `AWS_REGION` or `AWS_DEFAULT_REGION`. |
| `db_user` | `Optional[str]` | `None` | Database user for IAM auth. Uses `REDSHIFT_DB_USER`. |
| `access_key_id` | `Optional[str]` | `None` | AWS access key for IAM auth. Uses `AWS_ACCESS_KEY_ID`. |
| `secret_access_key` | `Optional[str]` | `None` | AWS secret key for IAM auth. Uses `AWS_SECRET_ACCESS_KEY`. |
| `session_token` | `Optional[str]` | `None` | AWS session token for IAM auth. Uses `AWS_SESSION_TOKEN`. |
| `profile` | `Optional[str]` | `None` | AWS profile for IAM auth. Uses `AWS_PROFILE`. |
| `ssl` | `bool` | `True` | Enable SSL for the connection. |
| `table_schema` | `str` | `public` | Schema name to search for tables. |

## Toolkit Functions

| Function | Description |
| - | - |
| `show_tables` | Retrieves and displays a list of tables in the configured schema. Returns the list of tables. |
| `describe_table` | Describes the structure of a specified table by returning its columns, data types, and nullability. Parameters include `table` (str) to specify the table name. Returns the table description. |
| `summarize_table` | Summarizes a table by computing aggregates such as min, max, average, standard deviation, and non-null counts for numeric columns, or unique values and average length for text columns. Parameters include `table` (str) to specify the table name. Returns the summary of the table. |
| `inspect_query` | Inspects an SQL query by returning the query plan using EXPLAIN. Parameters include `query` (str) to specify the SQL query. Returns the query plan. |
| `run_query` | Executes a SQL query and returns the result (not restricted to read-only). Parameters include `query` (str) to specify the SQL query. Returns the result of the query execution. |
| `export_table_to_path` | Exports a specified table in CSV format to a given path. Parameters include `table` (str) to specify the table name and `path` (str) to specify where to save the file. Returns the result of the export operation. |

You can use `include_tools` or `exclude_tools` to modify the list of tools the agent has access to. Learn more about [selecting tools](https://agno-v2.mintlify.site/tools/selecting-tools.md).

## Developer Resources

* [Tools Source](https://github.com/agno-agi/agno/blob/main/libs/agno/agno/tools/redshift.py)
* [Example](https://github.com/agno-agi/agno/blob/main/cookbook/91_tools/redshift_tools.py)


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.