Updated on 2026-07-30 GMT+08:00

IntelliJ IDEA

CodeArts Agent provides intelligent coding assistance for developers in various scenarios, including code generation, R&D knowledge Q&A, and agent-based collaborative development.

This section uses IntelliJ IDEA as an example to guide you through the installation and login of the CodeArts Agent extension. It also describes how you can perform a unit test.

Procedure

Step

Description

Preparations

  1. Sign up for a HUAWEI ID and enable Huawei Cloud services.
  2. Purchase a CodeArts Agent package.
NOTE:

CodeArts Agent provides two editions: Basic and Professional. Select a proper edition based on your service requirements. For details about how to purchase a package, see Subscriptions. This section uses the basic edition as an example.

Step 1: Install and Log In to CodeArts Agent

Install the CodeArts Agent extension and log in with your HUAWEI ID.

Step 2: Create a Snake Game

Use the agent capabilities to generate a clean, modular, and testable Snake game for unit testing.

Step 3: Perform a Unit Test with the Agent

Automate unit tests of core modules with the agent to improve code quality and verification efficiency.

Preparations

Before using CodeArts Agent for coding, complete the preparations by referring to Table 1.

Table 1 Preparations

Item

Description

IntelliJ IDEA

You have downloaded and installed IntelliJ IDEA (versions 2022.3 to 2026.1).

Switch IntelliJ IDEA's interface language for improved usability.

Windows OS: Windows 11 (x64) is recommended. If you are using Windows 10 (x64), the version must be 2019 or later, and upgrading to the latest stable version is recommended.

Account

You have a HUAWEI ID. If you do not have one, perform the following steps to create a HUAWEI ID:
  1. Visit the Huawei Cloud official website, and click Sign Up in the upper right corner.
  2. Sign up for a HUAWEI ID and enable Huawei Cloud services.

Step 1: Install and Log In to CodeArts Agent

  1. Double-click the IntelliJ IDEA icon to start the program.
  2. Install CodeArts Agent.

    1. In the navigation pane on the left of IntelliJ IDEA, click Plugins to access the Plugins page.
    2. Click Marketplace on the top of the page and enter CodeArts Agent in the search box to search for the CodeArts Agent extension.
      Figure 1 Searching for CodeArts Agent
    3. Click Install. IntelliJ IDEA will then download and install the extension.
    4. After the installation is complete, click Restart IDE or manually restart the IDE to activate the extension.

  3. Create a project for storing files.

    1. On the Welcome to IntelliJ IDEA page, click New Project. The New Project dialog box is displayed.
    2. Enter the project name, select a path for storing the project, and click Create.

      Unit tests depend on the data read from pom.xml. To ensure unit tests can run properly, set Build system to Maven when creating a project. After the project is created, a pom.xml file is generated in the corresponding folder of the explorer.

      Figure 2 Creating a project

  4. Log in to CodeArts Agent.

    1. On the sidebar of IntelliJ IDEA, click the CodeArts Agent extension icon .
    2. Click Switch to International Site.
    3. Click Log In with HUAWEI ID. The Huawei Cloud login page is displayed.
    4. Enter your HUAWEI ID and password and click Log In.

      If this is the first time you use CodeArts Agent, the activation page will be displayed. Agree to the service statement and click Activate Now. Wait until the package is activated.

      After the package is activated, complete the login authorization. After the system displays a message indicating that the login is successful, return to IntelliJ IDEA to start your intelligent coding journey.

Step 2: Create a Snake Game

This section uses the agent capabilities to generate a Snake game in Java for unit testing.

  1. Click the CodeArts Agent icon on the IDE sidebar to open the chat panel.
  2. At the bottom of the input box on the chat panel, choose Built-in > Agent to switch to the agent mode.
  3. Select the agent running mode and authorize automatic operations.

    1. Click the settings icon in the upper right corner of the chat panel to access the settings page.
    2. Choose Dialog Flow > Agent > Terminal Command Execution Mode, select the running policy for the agent to execute terminal commands. This section uses the default running policy (Running in Sandbox).

      A sandbox provides an isolated and restricted execution space for instructions generated by agents. Strict permission controls ensure commands run in a secure, isolated environment. This effectively blocks access to unauthorized resources, like files and networks, and prevents risky commands, such as those that change permissions. For intercepted commands, the agent will issue a risk prompt within a chat. These commands need your second approval before running outside the sandbox.

    3. Choose Dialog Flow > Auto-approve and click to enable the required items.

      After authorization, tasks for generating complex project-level code are executed automatically. Without authorization, some operations will need your manual confirmation when you code with CodeArts Agent.

      Table 2 Parameters for automatic approval

      Parameter

      Description

      Example

      Edit

      Allows the agent to call tools like edit, write, and deleteFile to edit files on your computer.

      Enabled

      Open Browser

      Allows the agent to access websites in the browser.

      Enabled

      Web Crawler

      Allows the agent to access and capture specified web page content.

      Enabled

    4. Exit the current page to complete the authorization.

  4. In the chat box, enter the following content. CodeArts Agent will guide you to create a game step by step.

    Develop a snake game in Java.

Step 3: Perform a Unit Test with the Agent

Automate unit tests of core modules with the agent to improve code quality and verification efficiency.

  1. In the code generated in Step 2: Create a Snake Game, right-click and choose CodeArts Agent > Generate Unit Tests (Agent).

    Figure 3 Choosing Unit Test (Agent)

  2. Check whether the GamePanelTest.java unit test file is generated. If yes, the running is successful and the test is passed.