# Agentic Analysis

> **Beta:** This feature is in Beta stage and is only available with SonarQube Cloud projects for organizations in the Team and Enterprise plans. See the [Product release lifecycle](/sonarqube-cloud/appendices/product-release-lifecycle.md) page for more information on release stages.

## Overview

SonarQube Agentic Analysis is part of the *Verify* phase of the [Agent Centric Development Cycle](/agent-centric-development-cycle/readme.md). It reuses the context from a previous CI analysis and restores it on-demand for single- or multi-file analysis. This lets AI agents verify code changes with minimal latency while maintaining full CI analysis precision.

## Supported languages

Agentic Analysis is available for the following languages:

* Java
* Python
* JavaScript/TypeScript
* CSS
* HTML
* XML
* C#
* VB.NET
* C++

Secrets detection and the IaC domains Docker, Kubernetes, and Terraform, are also supported.

> **Note:** If your Java project was analyzed using [Automatic analysis](https://docs.sonarsource.com/sonarqube-cloud/analyzing-source-code/automatic-analysis/), only basic analysis results are returned.

## Supported IDEs and CLIs

Agentic Analysis is compatible with most AI-enabled IDEs and CLIs including Claude Code, Cursor, Codex, Gemini CLI, and VS Code with Copilot. See our [IDE/CLI quickstart guides](/agent-centric-development-cycle/developer-tools/mcp-server/setup/quickstart-guides.md) for the full list of supported IDEs and CLIs.

## Guide-and-Verify loop

Using Agentic Analysis together with [Context Augmentation](/agent-centric-development-cycle/features/context-augmentation.md) allows you to build a guide-and-verify loop to ensure pull requests pass quality gates the first time, leading to faster code reviews with no back-and-forth. The loop has four steps:

1. **Guide**: [Context Augmentation](/agent-centric-development-cycle/features/context-augmentation.md) injects architectural awareness and coding guidelines into the LLM context before code generation.
2. **Generate**: The LLM generates code based on the augmented context.
3. **Verify**: [Agentic Analysis](/agent-centric-development-cycle/features/agentic-analysis.md) verifies the generated code with full CI-level precision.
4. **Loop**: The LLM refines the code based on analysis results and repeats until quality gates pass.

```mermaid
%%{init: {'themeVariables': {'actorBkg': 'rgba(18, 110, 211, 0.06)', 'actorBorder': '#126ED3', 'actorLineColor': '#126ED3', 'signalColor': '#126ED3', 'labelBoxBorderColor': '#126ED3'}}}%%
sequenceDiagram
    participant User
    participant LLM as AI Agent
    participant CAG as Context Augmentation<br/>(Guide)
    participant A3S as Agentic Analysis<br/>(Verify)

    User->>LLM: Request code generation
    LLM->>CAG: Request guidelines & architecture
    CAG-->>LLM: Inject coding standards & structure
    LLM->>LLM: Generate code
    LLM->>A3S: Analyze generated code
    A3S-->>LLM: Return analysis results

    alt Issues found
        LLM->>LLM: Refine code based on issues
        LLM->>A3S: Re-analyze code
        A3S-->>LLM: Return analysis results
    end

    LLM-->>User: Return verified code
```

## Setup

To learn how to set up a code verification loop with Agentic Analysis, see [Ensure your agent verifies its code](/agent-centric-development-cycle/how-to-guides/verify-your-code/ensure-your-agent-verifies-its-code.md).

## About the context mechanism

Agentic Analysis achieves high-precision analysis through a two-phase approach: it first collects context during CI analysis, then restores that context on demand.

### Phase 1: Context collection

During a regular CI analysis, SonarQube may collect and store:

* Dependencies: JAR files, npm packages, or Python libraries the project uses.
* Compiled artifacts: `.class` files.
* Type information: Symbol tables, type hierarchies, import graphs.
* Build configuration: Project structure, source paths, compiler settings.

This context is stored in the SonarQube Cloud backend (AWS), tagged by project key and branch.

<figure><img src="/files/ocntF3beh6Q4YpkJWpvg" alt="Diagram of how context is stored in the context storage during a CI scan"><figcaption></figcaption></figure>

### Phase 2: Context restoration

When analyzing files using Agentic Analysis, the context collected for this project during a CI analysis is restored, based on the specified project and branch name. This lets the analysis run with full access to dependencies and compiled artifacts. Analysis results have a level of precision that matches a full CI scan analysis.

<figure><img src="/files/fWAO7gyGOqDBVbHJWJd0" alt="Diagram showing the context restoration process."><figcaption></figcaption></figure>

## Related pages

* [Context Augmentation](/agent-centric-development-cycle/features/context-augmentation.md)
* [MCP Server](/agent-centric-development-cycle/developer-tools/mcp-server.md)
* [Tools](/agent-centric-development-cycle/developer-tools/mcp-server/reference/tools.md)


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.sonarsource.com/agent-centric-development-cycle/features/agentic-analysis.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
