---
title: Remediate with AI
description: >-
  Turn a Cloud Security misconfiguration finding into a code fix with Bits Code,
  Cursor, or the coding agent you already use.
breadcrumbs: >-
  Docs > Datadog Security > Cloud Security > Review and Remediate > Remediate
  with AI
---

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

# Remediate with AI
Available for:
{% icon name="icon-cloud-security-management" /%}
 Cloud Security Misconfigurations 
## Overview{% #overview %}

A misconfiguration finding tells you what is wrong with a cloud resource. **Remediate with AI** turns that finding into a code change: Datadog builds a prompt that describes the finding, the affected resource, and the fix. From there, you can hand it off to [Bits Code](https://docs.datadoghq.com/bits_ai/bits_code.md) to open a pull request, open Cursor with the prompt ready to run, or copy the prompt into the coding agent you already use.

{% image
   source="https://docs.dd-static.net/images/security/csm/remediate_with_ai_button.9402ec644af8054c6d54a4440d5dbd5b.png?auto=format&fit=max&w=850 1x, https://docs.dd-static.net/images/security/csm/remediate_with_ai_button.9402ec644af8054c6d54a4440d5dbd5b.png?auto=format&fit=max&w=850&dpr=2 2x"
   alt="The Next Steps section of a finding side panel, showing a Remediate with AI button under Remediation" /%}

## Prerequisites{% #prerequisites %}

Copying a fix prompt for your own coding agent requires no setup. To have Bits Code generate the fix, you need:

- The [`Bits Code Write` (`bits_dev_write`) permission](https://docs.datadoghq.com/account_management/rbac/permissions.md#bits-ai) in Datadog.
- Bits Code [set up](https://docs.datadoghq.com/bits_ai/bits_code/setup.md) for your source control provider.

Bits Code resolves fixes most reliably when Datadog knows where the affected resource is defined in your code. See [Code Locations](https://docs.datadoghq.com/security/cloud_security_management/code_locations.md) for how that mapping is established.

Bits Code usage is billed through [AI Credits](https://docs.datadoghq.com/account_management/billing/ai_credits.md).

## Remediate a finding{% #remediate-a-finding %}

1. Navigate to the [Misconfigurations findings](https://app.datadoghq.com/security/csm/misconfigurations-and-attack-paths) page.
1. Search for `@code_location.filename:*` to limit the results to findings with a resolved [code location](https://docs.datadoghq.com/security/cloud_security_management/code_locations.md). The fix is generated from that code location, so start from one of these findings.
1. Select a finding to open its side panel.
1. Under **Next Steps** > **Remediation**, click **Remediate with AI**.
1. Do one of the following:
   - On the **Coding agent** tab, click either button:
     - **Fix with Cursor**: Click **Open** to open Cursor with a prompt tailored to the finding, so you can run the fix without copying anything.
     - **Copy fix prompt**: Click **Copy**, then paste the prompt into the coding agent you already use. The prompt describes the finding and the change required, so the agent can make the fix in your repository.
   - On the **Bits Code** tab, click either button:
     - **Fix with Bits**: Bits Code starts a [session](https://docs.datadoghq.com/bits_ai/bits_code.md#sessions), locates the code that defines the resource, generates the fix, and opens a pull or merge request in your source control provider for review.
     - **Create Automation**: Bits Code fixes similar findings for you as they appear, without you opening each one. For more information, see [Bits Code Automations](https://docs.datadoghq.com/bits_ai/bits_code/automations.md).

{% image
   source="https://docs.dd-static.net/images/security/csm/remediate_with_ai_coding_agent_with_cursor.498fe256c2a1c29b21a9ec130de4d9d4.png?auto=format&fit=max&w=850 1x, https://docs.dd-static.net/images/security/csm/remediate_with_ai_coding_agent_with_cursor.498fe256c2a1c29b21a9ec130de4d9d4.png?auto=format&fit=max&w=850&dpr=2 2x"
   alt="The Remediate with AI dialog on the Coding agent tab, showing Fix with Cursor and Copy fix prompt options" /%}

{% image
   source="https://docs.dd-static.net/images/security/csm/remediate_with_ai_bits_code.db7e86fa45383bb8f1b4218270a31ccc.png?auto=format&fit=max&w=850 1x, https://docs.dd-static.net/images/security/csm/remediate_with_ai_bits_code.db7e86fa45383bb8f1b4218270a31ccc.png?auto=format&fit=max&w=850&dpr=2 2x"
   alt="The Remediate with AI dialog on the Bits Code tab, showing a Fix with Bits button and a Create Automation button" /%}

## Further reading{% #further-reading %}

Additional helpful documentation, links, and articles:

- [Code Locations](https://docs.datadoghq.com/security/cloud_security_management/code_locations.md)
- [Bits Code](https://docs.datadoghq.com/bits_ai/bits_code.md)
- [Create Bits Code Automations](https://docs.datadoghq.com/bits_ai/bits_code/automations.md)
- [Automate remediation with Workflow Automation](https://docs.datadoghq.com/security/cloud_security_management/review_remediate/workflows.md)
