Skip to main content
RedshiftTools enable an Agent to interact with Amazon Redshift data warehouses.

Prerequisites

The following example requires the redshift_connector library.
pip install -U redshift-connector
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.
redshift_tools.py
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

ParameterTypeDefaultDescription
hostOptional[str]NoneRedshift cluster endpoint. Uses REDSHIFT_HOST.
portint5439Port for the database connection.
databaseOptional[str]NoneDatabase name. Uses REDSHIFT_DATABASE.
userOptional[str]NoneUsername for standard authentication.
passwordOptional[str]NonePassword for standard authentication.
iamboolFalseEnable IAM authentication.
cluster_identifierOptional[str]NoneCluster identifier for IAM auth. Uses REDSHIFT_CLUSTER_IDENTIFIER.
regionOptional[str]NoneAWS region for IAM auth. Uses AWS_REGION.
db_userOptional[str]NoneDatabase user for IAM auth. Uses REDSHIFT_DB_USER.
access_key_idOptional[str]NoneAWS access key for IAM auth. Uses AWS_ACCESS_KEY_ID.
secret_access_keyOptional[str]NoneAWS secret key for IAM auth. Uses AWS_SECRET_ACCESS_KEY.
session_tokenOptional[str]NoneAWS session token for IAM auth. Uses AWS_SESSION_TOKEN.
profileOptional[str]NoneAWS profile for IAM auth. Uses AWS_PROFILE.
sslboolTrueEnable SSL for the connection.
table_schemastrpublicSchema name to search for tables.

Toolkit Functions

FunctionDescription
show_tablesRetrieves and displays a list of tables in the configured schema. Returns the list of tables.
describe_tableDescribes 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_tableSummarizes 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_queryInspects an SQL query by returning the query plan using EXPLAIN. Parameters include query (str) to specify the SQL query. Returns the query plan.
run_queryExecutes a read-only SQL query and returns the result. Parameters include query (str) to specify the SQL query. Returns the result of the query execution.
export_table_to_pathExports 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.

Developer Resources