---
title: AI guardrails and ABAC
description: Learn how service policies act as AI guardrails in Unity Catalog ABAC and how they relate to GRANT, DENY, row filter, and column mask policies.
canonical_url: https://docs.databricks.com/gcp/en/data-governance/unity-catalog/abac/ai-guardrails
---

# AI guardrails and ABAC

> [!NOTE]
> **Beta**
>
> This feature is in [Beta](https://docs.databricks.com/gcp/en/release-notes/release-types.md). Workspace admins can control access to this feature from the **Previews** page by opting into the **Unity Gateway Service Policies** preview. See [ Manage workspace-level previews](https://docs.databricks.com/gcp/en/admin/workspace-settings/manage-previews.md#workspace).

Attribute-based access control (ABAC) also provides service policies, which act as AI guardrails. A service policy checks each request to an AI service registered in Unity Catalog, and each response, and allows it, denies it, or holds it for approval. AI guardrails apply to model services, model provider services, and MCP services, and you set them up in Unity Gateway. This page explains how AI guardrails relate to the other ABAC policies and to Unity Catalog privileges. To set up a guardrail, see [Guardrails for AI services](https://docs.databricks.com/gcp/en/data-governance/unity-catalog/service-policies/index.md).

## <a id="policy-families" />How AI guardrails relate to other ABAC policies

ABAC policies answer different questions, as the following table shows:

| Policies                                                                                                                 | What they decide                                                                                                                                   | When they apply                                                                                      | Where they apply                                                                                |
| ------------------------------------------------------------------------------------------------------------------------ | -------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------- |
| [GRANT policies](https://docs.databricks.com/gcp/en/data-governance/unity-catalog/abac/grant-policies.md)                | Which privileges a principal gets on securable objects whose governed tags match, such as `EXECUTE` to call a service.                             | When Unity Catalog checks access.                                                                    | Supported securable types, including model services, model provider services, and MCP services. |
| [DENY policies](https://docs.databricks.com/gcp/en/data-governance/unity-catalog/abac/deny-policies.md) (Beta)           | Who can't manage permissions on a securable object. They deny only `MANAGE ACCESS CONTROL`, so they don't stop a principal from calling a service. | When Unity Catalog checks access.                                                                    | Supported securable types, including model services, model provider services, and MCP services. |
| [Row filter and column mask policies](https://docs.databricks.com/gcp/en/data-governance/unity-catalog/abac/policies.md) | Which rows and column values a principal sees in a table.                                                                                          | When a query reads the table.                                                                        | Tables and views.                                                                               |
| Service policies (AI guardrails)                                                                                         | Whether a request to an AI service, or its response, can proceed, based on its content and on who is calling.                                      | On each call, before Databricks invokes the service (input) and after the service responds (output). | Model services, model provider services, and MCP services.                                      |

GRANT policies can grant the privilege to call a service. DENY policies only restrict who can manage a service's permissions. See [What does it mean to deny MANAGE ACCESS CONTROL?](https://docs.databricks.com/gcp/en/data-governance/unity-catalog/abac/deny-policies.md#deny-manage-access-control). Like a row filter or column mask policy, a custom service policy can reference a Unity Catalog function that contains the governance logic.

## <a id="how-service-policies-complement-uc-grants" />How service policies complement Unity Catalog grants

Unity Catalog privileges and service policies address different governance questions and operate at different enforcement points.

| Aspect            | Unity Catalog privileges                  | Service policies                                                                                              |
| ----------------- | ----------------------------------------- | ------------------------------------------------------------------------------------------------------------- |
| Question answered | Can this principal call this service?     | How must this interaction proceed?                                                                            |
| Inputs            | Principal identity and granted privileges | Request content, response content, request tags, tool annotations, and actor context                          |
| Enforcement point | Before the request reaches the service    | Before the service is invoked (input phase, ON CALL) and after the service responds (output phase, ON RESULT) |
| Granularity       | Per principal, per securable              | Per request, based on content and context                                                                     |

Service policies don't replace Unity Catalog grants. A principal must first have the appropriate Unity Catalog privileges to call a service. Service policies then evaluate the content of each interaction to enforce additional governance rules.

## <a id="govern-ai-services-at-scale" />Govern AI services at scale

To control who can call AI services across a schema, use ABAC GRANT policies. A GRANT policy grants a privilege, such as `EXECUTE`, on every model, model service, model provider service, or MCP service whose governed tags match its condition, so a service is covered as soon as it's tagged. See [Govern models and MCPs with GRANT policies](https://docs.databricks.com/gcp/en/ai-gateway/govern-access-to-models-with-grant-policies.md).

You attach a service policy to one service at a time, through the Unity Gateway UI, and it applies to all account users on that service. Attaching service policies at the catalog or schema level, with ABAC conditions, or to specific principals isn't available. See [Limitations](https://docs.databricks.com/gcp/en/data-governance/unity-catalog/service-policies/index.md#limitations).

## <a id="set-up-ai-guardrails" />Set up AI guardrails in Unity Gateway

The guides, tutorials, and references for AI guardrails are in the Unity Gateway documentation:

| Resource                                                                                                                                | Description                                                                                                |
| --------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------- |
| [Guardrails for AI services](https://docs.databricks.com/gcp/en/data-governance/unity-catalog/service-policies/index.md)                | The three types of guardrails, how they decide, and where they run.                                        |
| [Built-in guardrails](https://docs.databricks.com/gcp/en/data-governance/unity-catalog/service-policies/built-in-guardrails.md)         | Checks that Databricks manages for unsafe content, jailbreak attempts, hallucinations, and sensitive data. |
| [Create a custom guardrail](https://docs.databricks.com/gcp/en/data-governance/unity-catalog/service-policies/create-service-policy.md) | Rules that you write as a prompt for an LLM judge or as a function.                                        |
| [Enforce an external guardrail](https://docs.databricks.com/gcp/en/data-governance/unity-catalog/service-policies/external-policies.md) | Decisions from a guardrail vendor that you already use.                                                    |
