| title | Bits Code | |||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| aliases |
|
|||||||||||||||||||||
| further_reading |
|
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 source code providers to create production-ready pull or merge requests, then iterates on changes using CI logs and developer feedback.
{{< img src="bits_ai/dev_agent/sessions_overview.png" alt="A tab titled 'Sessions' shows a text field with suggestions underneath" style="width:100%;" >}}
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 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 a source code integration and complete any additional configuration. Then, start your first session.
Learn how your Bits Code usage is billed on AI Credits.
Bits Code supports the following source code providers:
- GitHub: GitHub.com and GitHub Enterprise Cloud
- GitLab: GitLab.com
The following plans are not supported:
- Self-hosted plans, such as GitHub Enterprise Server and GitLab Self-Managed.
- Cloud-hosted plans on dedicated domains, such as GitHub Enterprise Cloud with data residency and GitLab Dedicated. Bits Code supports only providers on the standard GitHub.com and GitLab.com domains.
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.
{{< img src="bits_ai/dev_agent/code_fix.png" alt="A session showing a Bits AI summary and task list on the left and a code diff on the right" style="width:100%;" >}}
After completing setup, do one of the following to start a Bits Code session:
- Enter a freeform prompt at Sessions: 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
A session can also be created when another Bits AI agent (like Bits Chat or Bits Investigation) hands off a coding task to Bits Code.
On Sessions, 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 or MR.
Click a session to view its details and continue working with Bits Code. To remove a session from your My Sessions list, click (Archive for everyone) or (Unwatch session).
Bits Code can suggest code improvements within several Datadog products, including the following:
| Product | Capabilities |
|---|---|
| APM | Proposes code changes for relevant APM Recommendations |
| Bits Investigation | Generates code remediations based on Bits Investigations |
| Bits Chat | Suggests code changes arising from Bits Chat conversations |
| Cloud Cost | Generates code changes for Cloud Cost Recommendations |
| Error Tracking | Diagnoses issues and generates code fixes on-demand or autonomously |
| Code Security | Remediates SAST vulnerabilities, IaC vulnerabilities, and SCA vulnerabilities (individually or in bulk) |
| Test Optimization | Provides code fixes for flaky tests and verifies that tests remain stable |
| Continuous Profiler | Provides code changes for Automated Analysis insights |
| Containers | Provides code changes for Kubernetes Remediations |
Across supported Datadog products, use Bits Code to implement optimizations and fixes—for example, Cloud Cost Recommendations, Error Tracking issues, and SAST vulnerabilities. In certain products, Bits Chat explores and investigates issues, then hands off its findings to Bits Code to implement a code change.
{{< img src="bits_ai/dev_agent/fix_with_bits.png" alt="A button labeled with the text 'Fix with Bits.'" style="width:25%" >}}
You can manually prompt Bits Code to implement changes for a certain finding, or configure an automation so that it does so autonomously.
Use the freeform prompt field at Sessions to work with Bits Code on general coding tasks.
Automations 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 or merge request (optionally in draft mode) 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.
Bits Code integrates with source code providers to:
- Create pull or merge requests, generating titles and descriptions based on your repository's pull or merge request template
- Iterate on pull or merge requests in response to comments; mention
@Datadogin a comment to prompt Bits for updates - Monitor CI logs and fix failures
Bits Code never auto-merges PRs or MRs. See all the PRs or MRs that Bits Code is working on in Bits AI > Bits Code > Sessions.
- 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.
{{< partial name="whats-next/whats-next.html" >}}