# Monitor projects with AI code

Monitoring projects containing AI code is the final step in ensuring that your projects in SonarQube Cloud meet your AI Code Assurance standards.

Sonar’s AI Code Assurance helps you ensure security and code quality within projects containing AI-generated code. By utilizing project labels, custom quality gate certification and marking, and dynamic project badge publishing, you can maintain high standards and confidently assure the quality of your AI projects.

By now, you’ve likely completed the first two steps to qualify your projects as AI Code Assured:

1. [#label-projects-with-ai-code](https://docs.sonarsource.com/sonarqube-server/quality-standards-administration/overview#label-projects-with-ai-code "mention")
2. [#apply-qualified-quality-gate](https://docs.sonarsource.com/sonarqube-server/quality-standards-administration/overview#apply-qualified-quality-gate "mention")

You should be able to see your projects’ *AI Code Assurance* status on the **Projects**, main-branch **Overview**, and **Project Information** pages.

With those objectives in place, you can publish dynamic AI Code Assurance badges to your external websites to monitor projects.

{% hint style="warning" %}
In SonarQube Server version 10.7, the Sonar way quality gate was enforced on projects marked as containing AI Code. If you’re migrating from this version, projects using this quality gate will lose their AI Code Assurance status until a new, AI-qualified quality gate is applied.
{% endhint %}

## Understanding your AI Code Assurance labels <a href="#ai-code-assurance-labels" id="ai-code-assurance-labels"></a>

Your project **Overview** and **Project Information** pages show labels highlighting the state of AI Code Assurance. These labels provide a quick visual reference of your project’s state of AI Code Assurance status, including the state of containing AI-generated code and the status of your project’s quality gate.

### Internal AI Code Assurance status <a href="#internal-ai-code-assurance-status" id="internal-ai-code-assurance-status"></a>

Here’s what each AI Code Assurance label represents, and what you can do to update the status.

![$contains-ai-code](https://content.gitbook.com/content/3VWSqvZ4eaBLWvA6epdv/blobs/uZdZ4zf22ZqINzBeH9kG/c151514ef7beca0f865ee429bc9fe0e33b05ceb4.svg): Defined by a Project Admin that the project contains AI-generated code.

* Go to *Your project* > **Project settings** > **AI-generated code** or use the API to activate and deactivate this label.

![$in-shield-success](https://content.gitbook.com/content/3VWSqvZ4eaBLWvA6epdv/blobs/B98NdWOE473U6owNRKnf/dc39952837c5fcfee0e10e48781c469f3a96d50f.svg) **AI Code Assurance passed**: Your code *is passing the quality gate qualified for AI-generated code*.

* Run a new analysis to check your code against the quality gate.

![$in-shield-error](https://content.gitbook.com/content/3VWSqvZ4eaBLWvA6epdv/blobs/e1he2WXgvHDvJS2LntoZ/9040dcf9d62138bd33f0f61a706047eee2dd041e.svg) **AI Code Assurance failed**: Your code *is not passing the quality gate qualified for AI-generated code*.

* Address the issues in your code to meet the standards defined by your quality gate.

![$in-shield-on](https://content.gitbook.com/content/3VWSqvZ4eaBLWvA6epdv/blobs/ttZloZmwNoO7GwAKprp6/185be81999243203ea71699933ca21b534b1d0c8.svg) **AI Code Assurance is on**: Your code *uses a quality gate qualified for AI-generated code* and the quality gate status has not been computed.

* Run a new analysis to update the status of your quality gate.

![$in-shield-off/disabled](https://content.gitbook.com/content/3VWSqvZ4eaBLWvA6epdv/blobs/LMt58Y15XWs0H0fiOvnu/36db0d31c4bbcfae3106b7404405d1b73b89f897.svg) **AI Code Assurance is off**: Your code is *not marked* as containing AI code or is *not using* a quality gate qualified for AI-generated code.

* Check that your project is marked as **Contains AI-Generated Code**,
* assign a quality gate qualified for AI-generated code,
* then run an analysis to update the quality gate status.

## Using the AI Code Assurance badge <a href="#using-the-ai-code-assurance-badge" id="using-the-ai-code-assurance-badge"></a>

In Step 3, add a dynamic AI Code Assurance badge to monitor the current status of your AI Code Assured projects on your web pages. This badge works like other SonarQube external badges and can be used by any team member with project access.

See the documentation on [project-badge](https://docs.sonarsource.com/sonarqube-server/user-guide/project-badge "mention") for instructions on how to publish SonarQube badges externally.

### External AI Code Assurance badges <a href="#external-ai-code-assurance-badges" id="external-ai-code-assurance-badges"></a>

Here’s what each AI Code Assurance badge represents, and what you should do to update the status.

![$AI Code Assurance | Pass](https://content.gitbook.com/content/3VWSqvZ4eaBLWvA6epdv/blobs/mqgb819EOMWdyAfsWBEa/03cd4e2808e12a0ff0f96d278d36d36243e57ae4.svg): Your code *is passing the quality gate qualified for AI-generated code*.

* Run a new analysis to check your code against the quality gate.

![$AI Code Assurance | Fail](https://content.gitbook.com/content/3VWSqvZ4eaBLWvA6epdv/blobs/ZMXvbkU1QwomCutqrRPz/b399405d1b7e606e04cd64a20c0ac271f2b739b7.svg): Your code *is not passing the quality gate qualified for AI-generated code*.

* Address the issues in your code to meet the standards defined by your quality gate.

![$AI Code Assurance | On](https://content.gitbook.com/content/3VWSqvZ4eaBLWvA6epdv/blobs/3xYrbocShiqJifs9QlpW/5f7af3bfd4947a268500720f3dc9f0995a18cd5c.svg): Your code *is using a quality gate qualified for AI-generated code* and the quality gate status has not been computed.

* Run a new analysis to update the status of your quality gate.

![$AI Code Assurance | Off](https://content.gitbook.com/content/3VWSqvZ4eaBLWvA6epdv/blobs/VKiGM81cixhUcffAPWWu/cfd6777e58daaca37daf82be4d4eae22ab5f07d6.svg): Your code is *not using* a quality gate qualified for AI-generated code.

* Assign a quality gate qualified for AI-generated code and run an analysis to update the quality gate status.

## Related pages <a href="#related-pages" id="related-pages"></a>

* [overview](https://docs.sonarsource.com/sonarqube-server/ai-capabilities/overview "mention") of AI capabilites
* [overview](https://docs.sonarsource.com/sonarqube-server/instance-administration/ai-features/overview "mention") of AI features for instance administration
* [overview](https://docs.sonarsource.com/sonarqube-server/project-administration/ai-features/overview "mention") to manage AI features at the project level
  * The [set-up-ai-code-assurance](https://docs.sonarsource.com/sonarqube-server/project-administration/ai-features/set-up-ai-code-assurance "mention") page has information about using the API for AI Code Assurance
