Agents
Agents are programming assistants tailored for diverse development scenarios. CodeArts Agent CLI provides multiple out-of-the-box agents that require no manual creation, aiming to provide efficient programming assistance for various development scenarios. In addition to built-in agents, you can also create custom agents.
Built-in Agents
Built-in agents are classified into primary agents and sub-agents. Primary agents are the primary assistants you interact with. You can use the Tab key to switch between them. These agents handle your main conversations. Sub-agents are specialized assistants that primary agents can call to perform specific tasks. You can manually call a sub-agent by entering an at sign (@) followed by the sub-agent name in a session.
Custom Agents
In addition to built-in agents, CodeArts Agent CLI also supports custom agents. When project-level and personal-level agents share the same name, the project-level agent takes precedence over the personal-level agent.
| Type | Scope | Description |
|---|---|---|
| Custom primary agent Custom sub-agent | Project-level | Effective only for the agents of the current project, distributed along with the repository, and stored locally. Storage location: Project root directory/.codeartsdoer/agents |
| Personal-level | Agents are based on personal habits or preferences and take effect only for all projects of the current user. Storage location: ~/.codeartsdoer/agents The tilde (~) indicates the home directory of the current user. In Windows, it is equivalent to C:\Users\Username\. In macOS, it is equivalent to /Users/Username/. In Linux, it is equivalent to /home/Username/. |
Creating Agents Using Markdown Files
CodeArts Agent CLI allows you to create local project-level or personal-level agents through Markdown files. When project-level and personal-level agents share the same name, the project-level agent takes precedence over the personal-level agent.
Custom Agent File Format
Custom agents are written in the Markdown file format. The file header configures metadata using YAML front matter, and the body contains the system prompt and role instructions.
--- description: Agent desc # Agent function description mode: subagent # Agent description model: provider/model # If the model is configured in this format, the default model will be overwritten. tools: # Tool permission configuration. tool1: true # Allows the use of tool1. tool2: false # Prohibits the use of tool2. --- # Prompt Here lists the system prompt content of the agent.
The following table describes the parameters of the custom agent.
| Parameter | Mandatory | Type | Default Value | Description |
|---|---|---|---|---|
| description | Yes | String | N/A | Description of the custom agent |
| mode | Yes | String | subagent | Role of the agent
|
| model | No | String | N/A | Format: provider/model |
| tools | No | N/A | Tool permissions available to the agent. For details about the tools supported by CodeArts Agent CLI, see Table 5. You can also use * to match all tools. Example: tools: "*":false # Prohibits the use of all tools. | |
| hidden | No | Boolean | N/A | Visibility control If this parameter is set to true, the agent is hidden from the @ autocomplete menu. This setting is intended for internal agents that are called only through programmatic calls. |
| disable | No | Boolean | N/A | Switch control
|
| Prompt | Yes | String | N/A | System prompt of the custom agent |
Example Custom Agent
This example describes how to configure a personal sub-agent in Windows.
- Go to the ~/.codeartsdoer/agents directory, create the test.md file, and write the content below to the file. The tilde (~) indicates the home directory of the current user. In Windows, it is equivalent to C:\Users\Username\. In macOS, it is equivalent to /Users/Username/. In Linux, it is equivalent to /home/Username/.
--- # ========== Mandatory ========== description: (Mandatory) Description of the agent's functions and application scenarios. The primary agent determines when to call this agent based on this description. mode: subagent # Enumerated values: subagent (sub-agent) / primary (primary agent) / all (both). # ========== Model Configuration ========== model: provider/model-id # Custom model. Format: provider/model-id. You can run the /models command to view the supported models. # ========== Behavior Control ========== hidden: false # true: Hide from the @ autocomplete menu, only available for internal programmatic calls. disable: false # true: Disable the current agent. # ========== Tool Permissions ========== tools: write: false # File write permission. edit: false # File edit permission. bash: false # System command execution permission. read: false # File read permission. # System prompt (supports multi-line Markdown format) You are a senior code review expert. Focus on: - Code quality and best practices - Potential bugs and edge cases - Performance impact - Security risks Provide constructive feedback and do not directly modify the code.
- Go to any code project and run the following command:
@test Analyze code
After the command is delivered, the AI specifies a custom sub-agent to analyze code.
Figure 1 Calling the test sub-agent to analyze code
Feedback
Was this page helpful?
Provide feedbackThank you very much for your feedback. We will continue working to improve the documentation.See the reply and handling status in My Cloud VOC.
For any further questions, feel free to contact us through the chatbot.
Chatbot