---
title: Bits Guardrails
description: >-
  Define which remediation actions Bits can take, where they apply, and who must
  approve them.
breadcrumbs: Docs > Bits AI > Bits Remediation > Bits Guardrails
---

> For the complete documentation index, see [llms.txt](https://docs.datadoghq.com/llms.txt).

# Bits Guardrails

{% callout %}
# Important note for users on the following Datadog sites: app.ddog-gov.com, us2.ddog-gov.com

{% alert level="danger" %}
This product is not supported for your selected [Datadog site](https://docs.datadoghq.com/getting_started/site.md). ({% placeholder "user-datadog-site-name" /%}).
{% /alert %}

{% /callout %}

{% callout %}
# Important note for users on the following Datadog sites: app.datadoghq.com, us3.datadoghq.com, us5.datadoghq.com, app.datadoghq.eu, ap1.datadoghq.com, ap2.datadoghq.com, uk1.datadoghq.com

{% callout %}
##### Join the Preview!

Bits Guardrails are in Preview.Request Access
{% /callout %}

{% /callout %}

Guardrails let admins define which remediation actions Bits can take, where those actions apply, and who needs to approve them. For example, an Ask guardrail for `rollbackDeployment` scoped to `service:checkout` notifies predefined approvers before Bits rolls back a deployment for the checkout service.

Bits can take a remediation action only when a guardrail covers both the action and the resource it targets. If no guardrail covers an action, Bits can recommend the action but can't run it. For more information about how to enable Bits to take action on your infrastructure, see [Infrastructure Actions](https://docs.datadoghq.com/bits_ai/bits_remediation/infrastructure_actions.md).

Guardrails authorize actions through [Execution Policies](https://docs.datadoghq.com/actions/execution_policies.md). When you create an Ask guardrail, Datadog automatically creates a matching `[Bits Guardrail]` execution policy.

## Requirements{% #requirements %}

- Creating guardrails requires the `guardrails_read` and `guardrails_write` permissions. Enable them in [Organization Settings > Roles](https://app.datadoghq.com/organization-settings/roles).
- To approve actions covered by guardrails, approvers need the `bits_investigations_write` and `guardrails_read` permissions in their role. Approvers must also be named on the Ask guardrail, as a user or through a team or role.

## Create a guardrail{% #create-a-guardrail %}

To create a guardrail:

1. Go to [Bits Guardrails](https://app.datadoghq.com/bits-ai/guardrails) and click Create Guardrail.
1. Select the type of infrastructure to target.
1. Select one or more available actions for the guardrail to target. For example, for a Kubernetes integration, you can select actions such as rolling back deployments and patching or deleting Kubernetes objects.
1. Add tags that identify the resources the guardrail applies to, such as `service:checkout`. For information about how multiple tags work together, see the About targeting resources with tags section.
1. For the selected actions and scope, decide when Bits can take action:
   - Ask: Requires user approval before Bits executes actions. Choose at least one team, role, or individual who can approve.
   - Deny: Bits can recommend an action but cannot take it.
1. (Optional) For an Ask guardrail, turn on Notify when approval is needed, and select the Slack workspace and channel where Bits posts approval requests. This requires the [Slack integration](https://docs.datadoghq.com/integrations/slack.md). For a private channel, invite the Datadog app to the channel first. To approve from Slack, each approver must link their Slack account to Datadog.
1. In the review step, enter a name for the guardrail, then save it.

## About targeting resources with tags{% #about-targeting-resources-with-tags %}

The tags you add to a guardrail define its scope.

Tags for guardrails have the following requirements:

- Tags must exactly match the resource's tags in Datadog. If the tags don't match exactly, then the target resource isn't covered by the guardrail.
- Wildcards aren't supported.

When you add two or more tags, Bits uses the following logic to target resources:

- If the tags have the same key but different values, then the guardrail applies to resources that have *any* of the values. For example, if you include the tags `env:staging` and `env:prod`, then the guardrail applies to resources in either `staging` or `prod`.
- If the tags have different keys, then the guardrail applies only to resources that have *all* the tags. For example, if you include the tags `service:checkout` and `kube_deployment:checkout`, then the guardrail applies only to resources that have both tags.

## About overlapping guardrails{% #about-overlapping-guardrails %}

If more than one guardrail covers the same action and resource, the more restrictive guardrail applies. Deny takes precedence over Ask. If more than one Ask guardrail covers the same action and resource, any approver named on any of those guardrails can approve the action.

For example, suppose one Deny guardrail is scoped to `env:prod`, and one Ask guardrail is scoped to `service:checkout` and `env:prod`. For `checkout` resources in `prod`, the Deny guardrail applies.
