CreateAgent
Creates an agent.
Operation description
Name is the unique identifier of the agent within the current tenant. It can contain only letters, digits, underscores, and hyphens, and must be 1 to 128 characters in length. It cannot be modified after creation.
Each agent can be bound to only one knowledge base.
Try it now
Try this API in OpenAPI Explorer, no manual signing needed. Successful calls auto-generate SDK code matching your parameters. Download it with built-in credential security for local usage.Try this API in OpenAPI Explorer, no manual signing needed. Successful calls auto-generate SDK code matching your parameters. Download it with built-in credential security for local usage.
Test
RAM authorization
|
Action |
Access level |
Resource type |
Condition key |
Dependent action |
|
ada:CreateAgent |
create |
*All Resource
|
None | None |
Request parameters
|
Parameter |
Type |
Required |
Description |
Example |
| Name |
string |
Yes |
The name of the agent, which is also the unique identifier that cannot be modified after creation. |
code-review-agent |
| DisplayName |
string |
No |
The display name of the agent. |
Code review agent |
| Description |
string |
No |
The description of the agent. |
Analyze code changes and generate code review comments |
| SystemPrompt |
string |
No |
The system prompt. |
Check the correctness, security, and maintainability of code changes in the code review, and provide review comments based on severity |
| Tools |
any |
No |
The list of references to MCP server and connector names. The same array supports both types of entries. Specify only one type of reference for each entry. For MCP, omitting items indicates all public tools, and historically specified items retain their original values. |
[{"mcpServerName":"code-repository-mcp"},{"connectorName":"code-review-data"}] |
| Skills |
any |
No |
The list of skill references. For specific fields, refer to the supplementary description of request parameters. |
[{"name":"code-review"}] |
| KnowledgeBases |
any |
No |
The list of knowledge base references, which can contain at most one element. |
[{"name":"code-review-guidelines"}] |
| Visibility |
string |
No |
The visibility scope of the agent. Valid values: user and tenant. Default value: user. Valid values:
|
user |
Tools (MCP server and connector)
| Name | Type | Description | Example |
| mcpServerName | string | The name of the registered MCP server. | code-repository-mcp |
| connectorName | string | The name of the connector that is visible, not deleted, and available to the current identity. | code-review-data |
A single Tools array can contain both types of entries. For a single name entry, specify only one of mcpServerName or connectorName. The request fails and partial configurations are not saved if the name is empty, does not exist, is invisible, is unavailable, contains unknown fields, or is a duplicate reference.
Skills
| Name | Type | Description | Example |
| name | string | The name of the skill. The current available version is used at runtime. | code-review |
KnowledgeBases
| Name | Type | Description | Example |
| name | string | The name of the existing knowledge base that is accessible to the current identity. | code-review-guidelines |
Request example
{
"Name": "code-review-agent",
"DisplayName": "CR 代码评审 Agent",
"Description": "分析代码变更并生成 CR 评审意见",
"SystemPrompt": "请检查 CR 中代码变更的正确性、安全性和可维护性,并按严重程度给出评审意见。",
"Tools": [
{
"mcpServerName": "code-repository-mcp"
},
{
"connectorName": "code-review-data"
}
],
"Skills": [
{
"name": "code-review"
}
],
"KnowledgeBases": [
{
"name": "code-review-guidelines"
}
],
"Visibility": "user"
}
Response elements
|
Element |
Type |
Description |
Example |
|
object |
The agent creation result. |
||
| AgentId |
string |
The agent ID generated by the service. |
agent_00000000000000000000000000000001 |
| Name |
string |
The name of the created agent. |
code-review-agent |
| UpdatedAt |
integer |
The last update time, which is a UNIX timestamp in milliseconds. |
1788332400000 |
| Success |
boolean |
Indicates whether the agent was created successfully. A success response always returns true. An error response is returned upon failure. |
true |
| RequestId |
string |
The request ID, which is used for Tracing Analysis and troubleshooting. |
0A1B2C3D-4E5F-6789-ABCD-EF0123456789 |
Success response example
{
"AgentId": "agent_00000000000000000000000000000001",
"Name": "code-review-agent",
"UpdatedAt": 1788332400000,
"Success": true,
"RequestId": "0A1B2C3D-4E5F-6789-ABCD-EF0123456789"
}
Examples
Success response
JSON format
{
"AgentId": "agent_00000000000000000000000000000001",
"Name": "code-review-agent",
"UpdatedAt": 1788332400000,
"Success": true,
"RequestId": "0A1B2C3D-4E5F-6789-ABCD-EF0123456789"
}
Error codes
|
HTTP status code |
Error code |
Error message |
Description |
|---|---|---|---|
| 400 | InvalidParameter | The specified parameter is invalid. | |
| 401 | Unauthenticated | Authentication required. | |
| 500 | InternalError | Internal server error. | |
| 503 | ServiceUnavailable | The service is not ready or temporarily unavailable. | |
| 504 | ServiceTimeout | A required service timed out. | |
| 504 | Agent.OperationResultUnknown | The Agent operation result is unknown. | |
| 409 | Agent.AlreadyExists | An Agent with the specified name already exists. |
See Error CodesError Codes for a complete list.
Release notes
See Release NotesRelease Notes for a complete list.