AI Mode, available since Alibaba Cloud CLI 3.3.3, appends an AI identifier to the User-Agent of every API request so servers can distinguish AI agent traffic from manual requests.
Overview
When enabled, the CLI appends the following segment to the User-Agent of each API request:
AlibabaCloud-AIMode/enabled AlibabaCloud-Agent-SkillsWhere:
AlibabaCloud-AIMode/enabled: fixed prefix indicating AI Mode is active.AlibabaCloud-Agent-Skills: default skills identifier, customizable.
The AI identifier lets you:
Distinguish AI agent requests from manual operations.
Enable server-side auditing, rate limiting, and analytics by agent identity.
AI Mode only modifies the User-Agent header. It does not change API behavior or permissions.
Manage AI Mode
Manage AI Mode with the aliyun configure ai-mode command group.
View the current configuration
Run the following command to view the current configuration:
aliyun configure ai-mode showExample output:
{
"enabled": true,
"user_agent": "",
"effective_user_agent": "AlibabaCloud-Agent-Skills",
"request_user_agent_suffix": "AlibabaCloud-AIMode/enabled AlibabaCloud-Agent-Skills",
"config_file": "/home/user/.aliyun/ai-mode.json"
}Field descriptions:
Field | Description |
| Indicates whether AI Mode is enabled. |
| Custom skills identifier. Empty means the default is used. |
| Effective skills identifier: the custom value if set, otherwise |
| Complete suffix appended to the User-Agent. |
| Path to the configuration file. |
Enable and disable AI Mode
Run the following commands to enable or disable AI Mode:
# Enable AI Mode
aliyun configure ai-mode enable
# Disable AI Mode
aliyun configure ai-mode disableCustomize the skills identifier segment
The default skills identifier is AlibabaCloud-Agent-Skills. To differentiate between AI agents, customize this value:
# Set a custom skills identifier segment
aliyun configure ai-mode set-user-agent --user-agent "MyAgent/1.0"
# Reset to the default value
aliyun configure ai-mode reset-user-agentAfter customization, the User-Agent suffix becomes:
AlibabaCloud-AIMode/enabled MyAgent/1.0Per-command override
When making an OpenAPI call, you can use a command-line flag to override the global AI Mode setting for the current command only:
Flag | Effect |
| Enables AI Mode for this command, even if disabled globally. |
| Disables AI Mode for this command, even if enabled globally. |
If both flags appear in the same command, --no-cli-ai-mode takes precedence.
Examples:
# AI Mode is disabled globally, but this command appends the AI identifier
aliyun ecs DescribeInstances --cli-ai-mode
# AI Mode is enabled globally, but this command does not append the identifier
aliyun ecs DescribeInstances --no-cli-ai-modeEnvironment variables
The CLI exposes AI Mode status to plugin child processes through the following environment variables:
Environment variable | Description |
| Set to |
| Complete User-Agent suffix appended when AI Mode is active. Example: |
The CLI injects these variables automatically when starting a plugin child process. To control AI Mode, use the configure ai-mode command or the --cli-ai-mode flag.
Configuration file
To manually view or back up the AI Mode configuration file, find it at the following path:
Operating system | Path |
Linux / macOS |
|
Windows |
|
File format example:
{
"enabled": true,
"user_agent": "MyAgent/1.0"
}Field descriptions:
Field | Type | Description |
| boolean | Specifies whether to enable AI Mode. Default: |
| string | Custom skills identifier. If empty, defaults to |
If the configuration file does not exist, AI Mode is disabled. Use the aliyun configure ai-mode command instead of editing the file manually.
Precedence
AI Mode settings are applied in the following order (highest to lowest):
Command-line flags (
--cli-ai-mode/--no-cli-ai-mode)Configuration file (
ai-mode.json)
Command-line flags override configuration file settings. If both --cli-ai-mode and --no-cli-ai-mode appear in the same command, --no-cli-ai-mode wins.
Scope
The AI identifier applies in the following scenarios:
OpenAPI calls: The AI identifier is appended to the
User-Agentfor both RPC and RESTful requests initiated through commands.Plugin commands: The CLI passes AI Mode status to plugin child processes through
ALIBABA_CLOUD_CLI_AI_MODEandALIBABA_CLOUD_CLI_AI_USER_AGENTenvironment variables, allowing plugins to append the identifier to their own requests.
Appendix: Subcommand reference
Available subcommands under aliyun configure ai-mode:
Subcommand | Description |
| Display the current AI Mode configuration. |
| Enable AI Mode globally. |
| Disable AI Mode globally. |
| Set a custom skills identifier. |
| Reset the skills identifier to |
| Configure ossutil plugin settings (JSON string). |
| Clear ossutil plugin settings. |