OneTrust AI Guard SDK Guide
Overview
OneTrust AI Guard helps organizations improve visibility into AI applications throughout the development and production lifecycle and protect sensitive information.
AI Guard has two main components to provide visibility and protection: AI Guard SDK (the client) and AI Guard Service, primarily used for quick classification of prompts and responses.
AI Guard (SDK and Service) acts as an inspection layer between users and AI applications. It helps organizations identify sensitive information in AI interactions, apply protective actions, and associate AI activity with the appropriate AI agent in OneTrust AI Governance.
AI Guard supports Python-based environments and runs within the customer environment through either a OneTrust lightweight worker node or a standalone AI Guard deployment.
Performance Note: The AI Guard Classification service can classify over 300 requests per second, with an average wait of 75 milliseconds per request, using 1 vCPU and a 200-character payload.
Features
AI Guard provides capabilities that help organizations register AI agents, identify sensitive information, protect AI interactions, and monitor AI activity.
Agent registration
Use the AI Guard SDK to register AI agents with OneTrust AI Governance. Agent registration provides visibility into AI agents right from development and go-live and helps organizations extend governance activities across their AI agent inventory.
Sensitive information discovery
Use AI Guard SDK in conjunction with AI Guard Service to identify sensitive information in user prompts and AI responses. AI Guard supports more than 300 built-in classifiers for detecting PII, secrets, proprietary code, and other sensitive information.
Organizations can use the classification results to monitor sensitive information in AI interactions.
Redaction and blocking
Use AI Guard classification results to protect sensitive content before it continues through the application. Redaction removes or masks sensitive information, while blocking prevents content that meets the configured conditions from continuing.
Observability
AI Guard provides metrics that help organizations monitor AI agent activity and sensitive information classification. AI Guard also supports OpenTelemetry metrics and traces to help monitor AI application activity. In AI Governance, you can review metrics such as prompt and response PII counts for an AI Agent.
AI Guard Registration Service Deployment Options
AI Guard Service supports the following deployment options.
Lightweight deployed worker node
Supports: agent registration, data classification, and observability.
Deploy AI Guard service through a OneTrust lightweight worker node. The worker node provides the local runtime for classification and secure communication with OneTrust Cloud.
Use this option when your organization uses the OneTrust lightweight worker node deployment model. The AI Guard SDK connects to the worker node to support agent registration and sensitive information discovery.
Standalone AI Guard Docker deployment
Supports: agent registration, data classification, and observability.
Deploy AI Guard as a standalone service using the Docker Image in a customer-managed environment. This option is intended for organizations that want to run AI Guard using their own container infrastructure or locally on a developer machine.
The standalone deployment can run classification, OpenTelemetry (OTLP) collection, or both. OTLP collection can receive telemetry from the AI Guard SDK or from any OTLP-compliant producer.
The Docker Image supports customer-managed environments such as Kubernetes, ECS, Nomad, Docker Swarm, and Docker. Your organization manages the deployment environment, image access, certificates, and operational configuration.
Data handling
Both deployment options support processing within the customer environment. OneTrust AI Governance Cloud acts as the control plane for defining classification behavior and receives classification metrics from AI Guard. OneTrust AI Governance Cloud does not collect prompts or responses.
For detailed deployment requirements, see developer's AI Guard SDK Guide.
Prerequisites
-
OneTrust AI Governance subscription
-
OneTrust API key with the DATA DISCOVERY and AI_GOVERNANCE scope
-
One of the following deployment options:
-
Deployed OneTrust lightweight worker node
-
Standalone AI Guard on-premises deployment
-
-
Python 3.13 or later when using the Python SDK
-
TLS certificate and private key in PEM format for secure deployments
-
Required network access:
-
Port 4443 for AI Guard classification
-
Port 4317 when using the OpenTelemetry collector
-
-
For standalone deployment, access to the
docker.onetrust.dev/ai-guard-onpremimage is required. Customers may pull the image directly from the private OneTrust Docker registry or mirror the approved image into their own private registry before deployment. The image supports Linuxamd64andarm64platforms.
Solution Flow
-
Create API keys within the OneTrust AI Governance solution.
-
Deploy AI Guard using either the OneTrust lightweight worker node or the standalone AI Guard Docker image in a customer-managed environment.
-
Embed the OneTrust AI Guard SDK in your business AI application, such as an AI agent. Initialize the SDK with the required environmental parameters and API key.
Configuration
1. Create API Key
-
Refer to Managing OAuth 2.0 API Keys to create an API key to authorize the SDK.
-
Ensure the API key’s scope is DATA DISCOVERY and AI_GOVERNANCE.
2. For worker node deployment:
-
Deploy a lightweight worker node. Refer to Lightweight Worker Node Deployment for AI Automations to create and deploy the lightweight worker node.
The lightweight worker node serves as the classification service and a secure communication link between the AI Guard SDK and OneTrust Cloud. AI Guard is one of the many supported feature sets of the lightweight worker node.
3. For standalone deployment:
-
Docker image - pull the AI Guard on-premises Docker image and deploy it to your supported container platform.
-
Registry credentials - configure the read-only credentials required to pull the image from the OneTrust container registry. If your organization uses a mirrored image in its own registry, use your registry's authentication method instead.
-
TLS certificates - provide TLS certificates to secure connections to AI Guard. You can use certificates issued by your organization's certificate authority or by a publicly trusted one.
-
Authentication tokens - create and configure OAuth client credentials or an API key to authenticate AI Guard with OneTrust.
4. Import the SDK
-
Go to the OneTrust Developer Portal and search for AI Guard under SDKs. You can also visit our GitHub and search for AI guard.
-
Copy or download the SDK.
-
Follow the instructions here to leverage the SDK.
5. Classification Verification
Using the steps outlined in the SDK, developers should be able to classify information being received from users or from AI systems and take actions such as redact or block information. Examples below are for illustrative purposes only.
-
Example of PII Redaction in action
-
Example of PII Block in action
6. Changing Classification Profile
Classification actions are carried out inside the lightweight worker node (referred to as the AI Guard Classification service) and use classification profiles. OneTrust supports more than 300+ classification profiles.
The AI Guard Classification Service uses the default Classification Profile as defined within the OneTrust Platform. While the default classification profile can be changed for a specific customer tenant by the OneTrust admin, this is not recommended. OneTrust recommends instead to leverage specific classification profiles. This way, you can use AI Guard SDK to reference specific classification profiles by name.
Custom classification profiles are not currently supported for AI Guard operations.
Managing AI Guard Agent and Metrics
AI Agents being developed or running in production can leverage the AI Guard SDK, allowing developers to register the agent to the OneTrust platform and ensuring visibility into the Agent lifecycle. To verify Agent registration via AI Guard SDK, navigate to AI Agents and select the source type as AI Guard.
To verify that the AI Guard SDK and the Lightweight Worker Node are producing classification results, navigate to the specific Agent created and in the details section, navigate to Attribute Group Sensitive Data Classification. The AI Guard - Prompt PII Count and AI Guard - Response PII Count metrics are available.
Data displayed reflects the 24 hours since the last sync.
Monitoring and Enforcing Thresholds
To monitor and enforce thresholds for metrics reported, it is highly encouraged to set up custom policies and track individual metrics or groups of metrics against an organizationally defined threshold. A breach in these thresholds results in policy violations and allows to surface deviations in a large agent inventory.
For more information on creating custom policies, see AI Policies Feature Guide.
Avoiding Duplicate AI Agents
The same AI agent can enter the OneTrust inventory from several sources: an assessment or manual entry, the AI Guard SDK, and discovery by the lightweight worker node. If these sources don't share an identity, each one creates its own record, and the agent's risk, metrics, and evidence end up split across duplicates.
To prevent duplicates:
-
Declare a stable entity key for the agent through the supported SDK integration (for example,
agent:support:triage). The key must remain unchanged across the agent's lifecycle. -
Use the same key in the agent code, its deployment association, and its telemetry.
-
Where supported, make the key available on the deployed runtime. For example, the SDK can stamp the key as a runtime tag for Amazon Bedrock AgentCore. If a platform cannot be tagged, use an explicit mapping or runtime telemetry.
-
Keep the key unchanged when the same agent is deployed on multiple platforms.
-
For a platform without a native connector, carry the key through the SDK and use SDK-based metrics or an existing telemetry system such as Datadog or OpenTelemetry.
-
Follow up on any discovered runtime that has no valid key, as it is treated as shadow infrastructure.