> ## Documentation Index
> Fetch the complete documentation index at: https://developer.onetrust.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Install the SDK

The AI Guard SDK is a Python package that you import into your AI application. It provides classification, redaction, and streaming capabilities.

## Requirements

* **Python 3.13** or higher
* **pip** package manager

## Installation Methods

### Install from PyPI (Recommended)

```shell
pip install "ai-guard-sdk @ git+https://github.com/onetrust-oss/ai-guard-sdk.git"
```

### Install from Source

If you need to install from the source repository:

```shell
git clone <repo-url>
cd ai-guard
python -m venv .venv
source .venv/bin/activate
pip install .
```

> 📘 Source Repository
>
> The AI Guard SDK source is also available on [GitHub](https://gitlab.com/onetrust/daig/ai-guard-sdk).

## Verify Installation

After installation, verify the SDK is available:

```python
python -c "from ai_guard import AIGuardClient; print('AI Guard SDK installed successfully')"
```

## Quick Start

Here is a minimal example to verify end-to-end connectivity with your AI Guard service:

```python
from ai_guard import AIGuardClient
from ai_guard.api import (
    AIPlatform,
    ClassificationRequest,
    ClassifierDescriptionDefault,
)

# Initialize the client
client = AIGuardClient(
    "https://ai-guard.example.com:4443",
    token="your-api-key",
    agent_id="my-agent",
    platform=AIPlatform.AMAZON_BEDROCK,
)

# Classify sample text
request = ClassificationRequest(
    context={"actor": "user"},
    classifier_description=ClassifierDescriptionDefault(),
    text="Call me at 321-507-0525",
)

response = client.classify(request)

for match in response.matches:
    print(f"{match.classifier}: '{match.text}' (confidence: {match.confidence})")
# Expected output:
# US_PHONE_NUMBER: '321-507-0525' (confidence: 100)
```

If you see classification results, your installation and connectivity are working correctly.

## Dependencies

The SDK installs the following dependencies automatically:

| Package         | Version  | Purpose                               |
| --------------- | -------- | ------------------------------------- |
| `cryptography`  | ≥ 43.0.0 | TLS certificate pinning support       |
| `python-dotenv` | ≥ 1.0.0  | Environment variable management       |
| `requests`      | ≥ 2.25.0 | HTTP client for service communication |

## Virtual Environment (Recommended)

We recommend using a Python virtual environment to isolate AI Guard SDK dependencies:

```bash
# Create a virtual environment
python -m venv .venv

# Activate it
source .venv/bin/activate    # macOS/Linux
.venv\Scripts\activate       # Windows

# Install the SDK
pip install ai-guard-sdk
```

## What's Next?

* [Initialize the Client](https://developer.onetrust.com/onetrust/docs/ai-guard-initializing-the-client) — Configure the SDK and connect to your AI Guard service
* [Classify Text](https://developer.onetrust.com/onetrust/docs/ai-guard-classification) — Start classifying text for sensitive data
* [Redact Sensitive Data](https://developer.onetrust.com/onetrust/docs/ai-guard-redaction) — Apply redaction policies to classification results