---
title: Bits Code
description: Datadog, the leading service for cloud-scale monitoring.
breadcrumbs: Docs > Bits AI > Bits Code
---

# Bits Code

{% 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 %}

## Overview{% #overview %}

Bits Code is a generative AI coding assistant that uses Datadog observability data to automatically diagnose and fix issues in your code. It integrates with GitHub to create production-ready pull requests, then iterates on changes using CI logs and developer feedback.

{% image
   source="https://docs.dd-static.net/images/bits_ai/dev_agent/sessions_overview.787ec3c28c0618ce63345a7e64a60c8c.png?auto=format&fit=max&w=850 1x, https://docs.dd-static.net/images/bits_ai/dev_agent/sessions_overview.787ec3c28c0618ce63345a7e64a60c8c.png?auto=format&fit=max&w=850&dpr=2 2x"
   alt="A tab titled 'Sessions' shows a text field with suggestions underneath" /%}

Each time Bits Code investigates an issue or generates a fix, it creates a session, which captures the agent's analysis, actions, and any resulting code changes across supported Datadog products. Set up [automations](https://docs.datadoghq.com/bits_ai/bits_ai_dev_agent/automations.md) to have Bits Code run sessions on a schedule or in response to signals from other Datadog products, such as a new APM Recommendation or flaky test.

To get started with Bits Code, [set up the GitHub integration](https://docs.datadoghq.com/bits_ai/bits_ai_dev_agent/setup.md) and complete any additional configuration. Then, start your first session.

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

## Sessions{% #sessions %}

A session captures a segment of work with Bits Code, including its analysis and code changes. Start, view, and manage your sessions at **Bits AI** > **Bits Code** > [**Sessions**](https://app.datadoghq.com/code).

{% image
   source="https://docs.dd-static.net/images/bits_ai/dev_agent/code_fix.7c8b10895a7ad4726c58a7fd3e65f3ed.png?auto=format&fit=max&w=850 1x, https://docs.dd-static.net/images/bits_ai/dev_agent/code_fix.7c8b10895a7ad4726c58a7fd3e65f3ed.png?auto=format&fit=max&w=850&dpr=2 2x"
   alt="A session showing a Bits AI summary and task list on the left and a code diff on the right" /%}

### Start a session{% #start-a-session %}

After [completing setup](https://docs.datadoghq.com/bits_ai/bits_ai_dev_agent/setup.md), do one of the following to start a Bits Code session:

- Enter a freeform prompt at [**Sessions**](https://app.datadoghq.com/code): enter a custom prompt or generate one by clicking a suggested prompt card
- Invoke Bits Code in a supported Datadog product
- Set up a Bits Code [automation](https://docs.datadoghq.com/bits_ai/bits_ai_dev_agent/automations.md)

A session can also be created when another Bits AI agent (like [Bits Chat](https://docs.datadoghq.com/bits_ai/bits_chat.md) or [Bits Investigation](https://docs.datadoghq.com/bits_ai/bits_ai_sre.md)) hands off a coding task to Bits Code.

### View and manage sessions{% #view-and-manage-sessions %}

On **[Sessions](https://app.datadoghq.com/code)**, view your past sessions in the **My Sessions** panel. A session appears here if you initiated it or interacted with it in some way, like participating in the conversation or creating an associated PR.

Click a session to view its details and continue working with Bits Code. To remove a session from your **My Sessions** list, click 
{% icon name="icon-archive-wui" /%}
 (**Archive for everyone**) or 
{% icon name="icon-eye-slashed-wui" /%}
 (**Unwatch session**).

## Supported Datadog products{% #supported-datadog-products %}

Bits Code can suggest code improvements within several Datadog products, including the following:

| Product                                                                 | Capabilities                                                                                                                                                                                                                                                                                                                                                            |
| ----------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| [APM](https://docs.datadoghq.com/tracing.md)                            | Proposes code changes for relevant [APM Recommendations](https://docs.datadoghq.com/tracing/recommendations.md)                                                                                                                                                                                                                                                         |
| [Bits Investigation](https://docs.datadoghq.com/bits_ai/bits_ai_sre.md) | Generates code remediations based on Bits Investigations                                                                                                                                                                                                                                                                                                                |
| [Bits Chat](https://docs.datadoghq.com/bits_ai/bits_chat.md)            | Suggests code changes arising from Bits Chat conversations                                                                                                                                                                                                                                                                                                              |
| [Cloud Cost](https://docs.datadoghq.com/cloud_cost_management.md)       | Generates code changes for [Cloud Cost Recommendations](https://docs.datadoghq.com/cloud_cost_management/recommendations.md)                                                                                                                                                                                                                                            |
| [Error Tracking](https://docs.datadoghq.com/error_tracking.md)          | Diagnoses issues and generates code fixes on-demand or autonomously                                                                                                                                                                                                                                                                                                     |
| [Code Security](https://docs.datadoghq.com/security/code_security.md)   | Remediates [SAST vulnerabilities](https://docs.datadoghq.com/security/code_security/static_analysis/ai_enhanced_sast.md#remediation), [IaC vulnerabilities](https://docs.datadoghq.com/security/code_security/iac_security.md), and [SCA vulnerabilities](https://docs.datadoghq.com/security/code_security/software_composition_analysis.md) (individually or in bulk) |
| [Test Optimization](https://docs.datadoghq.com/tests.md)                | Provides code fixes for [flaky tests](https://docs.datadoghq.com/tests/flaky_management.md#bits-ai-powered-flaky-test-fixes) and verifies that tests remain stable                                                                                                                                                                                                      |
| [Continuous Profiler](https://docs.datadoghq.com/profiler.md)           | Provides code changes for [Automated Analysis](https://docs.datadoghq.com/profiler/automated_analysis.md) insights                                                                                                                                                                                                                                                      |
| [Containers](https://docs.datadoghq.com/containers.md)                  | Provides code changes for [Kubernetes Remediations](https://docs.datadoghq.com/containers/bits_ai_kubernetes_remediation.md)                                                                                                                                                                                                                                            |

## Key capabilities{% #key-capabilities %}

### Code fixes and optimizations surfaced by Datadog products{% #code-fixes-and-optimizations-surfaced-by-datadog-products %}

Across supported Datadog products, use Bits Code to implement optimizations and fixes—for example, [Cloud Cost Recommendations](https://docs.datadoghq.com/cloud_cost_management/recommendations.md), [Error Tracking](https://docs.datadoghq.com/error_tracking.md) issues, and [SAST vulnerabilities](https://docs.datadoghq.com/security/code_security/static_analysis/ai_enhanced_sast.md#remediation). In certain products, [Bits Chat](https://docs.datadoghq.com/bits_ai/bits_chat.md) explores and investigates issues, then hands off its findings to Bits Code to implement a code change.

{% image
   source="https://docs.dd-static.net/images/bits_ai/dev_agent/fix_with_bits.915c98612b21e0891fe5e5819efacbb8.png?auto=format&fit=max&w=850 1x, https://docs.dd-static.net/images/bits_ai/dev_agent/fix_with_bits.915c98612b21e0891fe5e5819efacbb8.png?auto=format&fit=max&w=850&dpr=2 2x"
   alt="A button labeled with the text 'Fix with Bits.'" /%}

You can manually prompt Bits Code to implement changes for a certain finding, or configure an [automation](https://docs.datadoghq.com/bits_ai/bits_ai_dev_agent/automations.md) so that it does so autonomously.

### General coding tasks{% #general-coding-tasks %}

Use the freeform prompt field at [**Sessions**](https://app.datadoghq.com/code) to work with Bits Code on general coding tasks.

### Automations{% #automations %}

[Automations](https://docs.datadoghq.com/bits_ai/bits_ai_dev_agent/automations.md) run Bits Code sessions automatically, on a schedule or in response to signals from Datadog products like Error Tracking, APM, or Code Security. After a session completes, Bits Code delivers the results as a pull request, a draft PR, or a Slack notification.

You can build automations from triggers (a product finding, a custom prompt, a schedule, or a combination) and configure one or more outputs. Datadog-provided templates are also available to help you get started. Create and manage automations at **Bits AI** > **Bits Code** > [**Automations**](https://app.datadoghq.com/code/automations).

### Pull request collaboration{% #pull-request-collaboration %}

Bits Code integrates with GitHub to:

- Create pull requests, generating titles and descriptions based on your repository's pull request template
- Iterate on pull requests in response to comments; mention `@Datadog` in a comment to prompt Bits for updates
- Monitor CI logs and fix failures

Bits Code never auto-merges PRs. See all the PRs that Bits Code is working on in **Bits AI** > **Bits Code** > **[Sessions](https://app.datadoghq.com/code)**.

## Limitations{% #limitations %}

- Bits Code is an AI product, which means it can make mistakes. Use best practices when reviewing and testing agent-generated code.
- Bits Code does not support multi-repository investigations.

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

- [Automatically identify issues and generate fixes with Bits Code](https://www.datadoghq.com/blog/bits-ai-dev-agent/)
- [Introducing Bits Code for Code Security](https://www.datadoghq.com/blog/bitsai-dev-agent-code-security)
- [AI Credits](https://docs.datadoghq.com/account_management/billing/ai_credits.md)
