> ## 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.

# Amazon Redshift Tools Example

> Use Amazon Redshift tools with Agno agents.

```python redshift_tools.py theme={null}
"""
Amazon Redshift Tools Example

For IAM authentication with environment variables, set:
export AWS_ACCESS_KEY_ID="your-access-key"
export AWS_SECRET_ACCESS_KEY="your-secret-key"
export AWS_SESSION_TOKEN="your-session-token"
export REDSHIFT_HOST="your-workgroup.123456789.us-east-1.redshift-serverless.amazonaws.com"
export REDSHIFT_DATABASE="dev"
"""

from agno.agent import Agent
from agno.tools.redshift import RedshiftTools

# ---------------------------------------------------------------------------
# Create Agent
# ---------------------------------------------------------------------------


# Example 1: Standard username/password authentication
agent = Agent(
    tools=[
        RedshiftTools(
            user="your-username",
            password="your-password",
        )
    ]
)

# Example 2: IAM authentication with environment variables (Serverless)
agent_iam = Agent(
    tools=[
        RedshiftTools(
            iam=True,
        )
    ]
)

# ---------------------------------------------------------------------------
# Run Agent
# ---------------------------------------------------------------------------
if __name__ == "__main__":
    agent.print_response(
        "List the tables in the database and describe one of the tables", markdown=True
    )

    agent_iam.print_response("Run a query to select 1 + 1 as result", markdown=True)
```

## Run the Example

<Snippet file="create-venv-step.mdx" />

**1. Install dependencies**

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

**2. Export environment variables**

```bash Mac/Linux theme={null}
export AWS_ACCESS_KEY_ID="your_aws_access_key_id_here"
export AWS_SECRET_ACCESS_KEY="your_aws_secret_access_key_here"
export OPENAI_API_KEY="your_openai_api_key_here"
export REDSHIFT_DATABASE="your_redshift_database_here"
export REDSHIFT_HOST="your_redshift_host_here"
```

```bash Windows theme={null}
$Env:AWS_ACCESS_KEY_ID="your_aws_access_key_id_here"
$Env:AWS_SECRET_ACCESS_KEY="your_aws_secret_access_key_here"
$Env:OPENAI_API_KEY="your_openai_api_key_here"
$Env:REDSHIFT_DATABASE="your_redshift_database_here"
$Env:REDSHIFT_HOST="your_redshift_host_here"
```

**3. Run the example**

Save the code above as `redshift_tools.py`, then run:

```bash theme={null}
python redshift_tools.py
```

Full source: [cookbook/91\_tools/redshift\_tools.py](https://github.com/agno-agi/agno/blob/v3.0.4/cookbook/91_tools/redshift_tools.py)


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