CreateAgent
Creates an agent.
Operation description
Creates a custom agent. The Name must be unique within the current account. Tools use the same tool type configuration as UpdateAgent. For official skills, only specify Source=OFFICIAL and SkillId. For official expert suites, only specify Source=OFFICIAL and SuiteId, without including Name, Version, VersionSelector, or client artifact fields. For custom resources, do not pass the integer Version and VersionSelector at the same time. The version selection capability is subject to the target server deployment. Replace the sample resource identifiers with actual values that the current identity has permission to use. If PublishImmediately is omitted or set to false, only a draft is saved. If set to true, the draft is saved first and then a publish request is made. Saving and publishing are not atomic operations. If publishing fails, the draft may already exist. You should call GetAgent to read it back before blindly retrying the creation.
Try it now
Test
RAM authorization
|
Action |
Access level |
Resource type |
Condition key |
Dependent action |
|
dataworks:CreateAgent |
create |
*All Resource
|
None | None |
Request parameters
|
Parameter |
Type |
Required |
Description |
Example |
| Name |
string |
Yes |
The name of the agent. The name must be unique within the current account. |
my-agent |
| DisplayName |
string |
No |
The display name of the agent. |
My assistant |
| Description |
string |
No |
The description of the agent. |
Data analytics assistant |
| Model |
object |
No |
The model configuration. |
{ "modelName": "dataworks-public-bailian/qwen-max" } |
| SystemPrompt |
string |
No |
The system prompt. |
You are a data analytics assistant. |
| Tools |
array<object> |
No |
The list of tool references. This uses the same tool type configuration as UpdateAgent. Each item must include Kind and the corresponding configuration, and cannot only include Name. Replace the MCP service and tool names in the examples with actual values available to the current identity. |
[{"Kind":"MCP_TOOLSET","McpServerName":"mcp-a","McpItems":["only-this-tool"]}] |
|
object |
No |
A single tool reference. This uses the same structure as CreateAgent and UpdateAgent. |
||
| BuiltinName |
string |
No |
The name of the built-in toolset. This parameter is required when Kind is set to BUILTIN_TOOLSET. Use a name supported by the target server. Omit this parameter when Kind is set to MCP_TOOLSET. |
web_search |
| Kind |
string |
No |
The type of the tool. A valid tool reference must specify BUILTIN_TOOLSET or MCP_TOOLSET. For the former, BuiltinName must also be specified. For the latter, McpServerName must also be specified. The target server validates the reference based on the tool type. Valid values:
|
MCP_TOOLSET |
| McpItems |
array |
No |
The list of selected MCP tool names. If this parameter is omitted or set to an empty array, tools are not filtered by name. Each item must be an actual tool name that exists in the target service. |
["only-this-tool"] |
|
string |
No |
A single MCP tool name. The name must be from the target MCP service. |
only-this-tool |
|
| McpServerName |
string |
No |
The MCP service name. This parameter is required when Kind is set to MCP_TOOLSET. The service must be one that the current invoker has permission to reference and has an active published version. |
mcp-a |
| Name |
string |
No |
A reserved field for legacy models. Specifying only Name does not constitute a valid tool configuration and cannot replace Kind, BuiltinName, or McpServerName. |
search_tables |
| Skills |
array<object> |
No |
The list of skill references. An official reference only includes Source=OFFICIAL and SkillId. A custom reference uses Name, and you can explicitly specify an existing integer Version. Official references do not include version selection fields. |
[{"Source":"OFFICIAL","SkillId":"dataworks-semantic"}] |
|
object |
No |
A single skill reference. For an official item, only specify Source and SkillId. For a custom item, use Name. |
||
| Name |
string |
No |
The name of the skill. |
skill-1 |
| SkillId |
string |
No |
The ID of the official skill. |
dataworks-semantic |
| Source |
string |
No |
The source of the skill. Valid values:
|
OFFICIAL |
| Version |
integer |
No |
The release version number of the custom skill. |
1 |
| VersionSelector |
string |
No |
The version selection expression. |
^1.2.3 |
| ExpertSuites |
array<object> |
No |
The list of expert suite references. |
[{"Source":"OFFICIAL","SuiteId":"dataworks-data-analysis-extension"},{"SuiteId":"suite_example","Version":1}] |
|
object |
No |
|||
| Source |
string |
No |
The source of the expert suite. Valid values:
|
OFFICIAL |
| SuiteId |
string |
No |
The ID of the expert suite. |
dataworks-data-analysis-extension |
| Version |
integer |
No |
The release version number of the custom expert suite. |
1 |
| VersionSelector |
string |
No |
The version selection expression. |
^1.2.3 |
| CallableAgents |
array<object> |
No |
The list of sub-agents that can be called by this agent. |
|
|
object |
No |
The name of the agent. |
||
| Name |
string |
No |
The name of the agent. |
agent-1 |
| PublishImmediately |
boolean |
No |
Specifies whether to publish the agent immediately after creation. Valid values:
|
false |
| Metadata |
object |
No |
The extended metadata in key-value pairs. |
{} |
| Visibility |
string |
No |
The visibility level. Valid values:
|
TENANT |
| VisibilityScope |
object |
No |
The visibility scope. The corresponding field is used based on the Visibility value. |
|
| ProjectIds |
array |
No |
The list of visible project IDs. This parameter takes effect when Visibility is set to |
|
|
string |
No |
The workspace ID. |
[21791] |
|
| UserIds |
array |
No |
The list of visible user IDs. This parameter takes effect when Visibility is set to |
|
|
string |
No |
The list of visible user IDs. This parameter takes effect when Visibility is set to |
[] |
Response elements
|
Element |
Type |
Description |
Example |
|
object |
Schema of Response |
||
| Agent |
object |
The details of the created agent. |
|
| ExpertSuites |
array<object> |
The associated expert suites. |
|
|
object |
|||
| PackageVersion |
string |
The official suite artifact version. |
0.1.0.202610211408 |
| Source |
string |
The source of the expert suite. |
OFFICIAL |
| SuiteId |
string |
The ID of the expert suite. |
dataworks-data-analysis-extension |
| Version |
integer |
The custom suite release version. |
1 |
| VersionSelector |
string |
The version selection expression. |
^1.2.3 |
| GmtCreateTime |
integer |
The time when the agent was created. The value is a UNIX timestamp in milliseconds. |
1780555634000 |
| GmtModifiedTime |
integer |
The time when the agent was last modified. The value is a UNIX timestamp in milliseconds. |
1780555634000 |
| Name |
string |
The name of the agent. |
my-agent |
| Skills |
array<object> |
The associated skills. |
|
|
object |
|||
| Name |
string |
The name of the custom skill. |
my-business-skill |
| PackageVersion |
string |
The official skill artifact version. |
0.6.0.202608201110 |
| SkillId |
string |
The ID of the official skill. |
dataworks-semantic |
| Source |
string |
The source of the skill. |
OFFICIAL |
| Version |
integer |
The release version number of the custom skill. |
1 |
| VersionSelector |
string |
The version selection expression. |
^1.2.3 |
| RequestId |
string |
The request ID. |
824F80BA-1778-5D8A-BAFF-668A4D9C4CC7 |
Examples
Success response
JSON format
{
"Agent": {
"ExpertSuites": [
{
"PackageVersion": "0.1.0.202610211408",
"Source": "OFFICIAL",
"SuiteId": "dataworks-data-analysis-extension",
"Version": 1,
"VersionSelector": "^1.2.3"
}
],
"GmtCreateTime": 1780555634000,
"GmtModifiedTime": 1780555634000,
"Name": "my-agent",
"Skills": [
{
"Name": "my-business-skill",
"PackageVersion": "0.6.0.202608201110",
"SkillId": "dataworks-semantic",
"Source": "OFFICIAL",
"Version": 1,
"VersionSelector": "^1.2.3"
}
]
},
"RequestId": "824F80BA-1778-5D8A-BAFF-668A4D9C4CC7"
}
Error codes
See Error Codes for a complete list.
Release notes
See Release Notes for a complete list.