UpdateAgent
Updates the definition of a specified agent and increments the definition version, with the option to publish immediately. This operation is available only when the canary release feature is enabled. Before calling this operation, ensure that the canary release feature is enabled for the current account and the target region.
Operation description
This operation is available only when the canary release feature is enabled. Before calling this operation, ensure that the canary release feature is enabled for the current account and the target region.
Updates a custom agent that the current identity has administrative permissions for. The Name parameter is used to locate the target agent and is not used for renaming. Call GetAgent first to read the current AgentVersion, and explicitly pass ExpectedVersion during the update. If a conflict occurs, re-read the version and verify the differences instead of blindly overwriting.
Omit reference lists that do not need to be modified. The current new backend retains existing references for empty arrays of Tools, Skills, and CallableAgents, but clears references for an empty array of ExpertSuites. A unified empty array clearing rule cannot be used. Tools already includes Kind and the corresponding tool configurations, using the same structure as CreateAgent. Specifying only Name is not a valid tool configuration.
For official skills, specify only Source=OFFICIAL and SkillId. For official suites, specify only Source=OFFICIAL and SuiteId, without mixing in name, version, or artifact fields. The integer Version and VersionSelector for custom resources are mutually exclusive. The version selection capability depends on the deployment of the target server.
If PublishImmediately is omitted or set to false, only the definition is saved. If it is set to true, a new draft version is saved before requesting publication. Saving and publishing are not atomic operations. If publishing fails, the draft version may have already been incremented. In this case, call GetAgent to read the current version before deciding whether to retry, to avoid generating duplicate versions.
Try it now
Test
RAM authorization
|
Action |
Access level |
Resource type |
Condition key |
Dependent action |
|
dataworks:UpdateAgent |
update |
*All Resource
|
None | None |
Request parameters
|
Parameter |
Type |
Required |
Description |
Example |
| Name |
string |
Yes |
The name of the agent to be updated. Use the Name returned by GetAgent. This field is used to locate the target agent and is not used for renaming. |
my-agent |
| ExpectedVersion |
integer |
No |
The agent definition version used for concurrency control. We recommend explicitly specifying the AgentVersion you just obtained from GetAgent for each call. The update is rejected if the version does not match the current version on the server. To ensure compatibility with different deployment versions, do not rely on the server-side processing when this parameter is omitted. |
2 |
| 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 an excellent ETL engineer |
| Tools |
array<object> |
No |
The list of tool references. Omit this parameter if no modification is required. The current new backend retains existing tools even for an empty array. A non-empty array replaces the references. Each item must include Kind and the corresponding configuration, and cannot include only Name. Replace the MCP service and tool names in the example with actual values available to the current identity. |
[{"Kind":"MCP_TOOLSET","McpServerName":"mcp-a","McpItems":["only-this-tool"]}] |
|
object |
No |
A single tool reference, which uses the same structure as CreateAgent and UpdateAgent. |
{"Kind":"MCP_TOOLSET","McpServerName":"mcp-a","McpItems":["only-this-tool"]} |
|
| Kind |
string |
No |
The tool type. A valid tool reference must specify BUILTIN_TOOLSET or MCP_TOOLSET. For BUILTIN_TOOLSET, BuiltinName must also be specified. For MCP_TOOLSET, McpServerName must also be specified. The target server validates the reference based on the tool type. Valid values:
|
MCP_TOOLSET |
| 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 |
| 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 permissions to reference and that has an active published version. |
mcp-a |
| McpItems |
array |
No |
The list of selected MCP tool names. If this parameter is omitted or an empty array is provided, no filtering by tool name is performed. Each item must be an actual tool name in the target service. |
["only-this-tool"] |
|
string |
No |
A single MCP tool name, which must be from the target MCP service. |
only-this-tool |
|
| Name |
string |
No |
A field retained from the legacy model. 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. Omit this parameter if no modification is required. Do not use an empty array to indicate retention or clearing. For official skills, specify only Source=OFFICIAL and SkillId. Name, Version, VersionSelector, or client artifact fields are not accepted. For custom skills, specify Name, and you can explicitly specify an existing integer Version. |
[{"Source":"OFFICIAL","SkillId":"dataworks-semantic"}] |
|
object |
No |
A single skill reference. An official reference includes only Source and SkillId. Do not mix in the name or version selection fields of custom resources. |
{"Source":"OFFICIAL","SkillId":"dataworks-semantic"} |
|
| Source |
string |
No |
The source of the skill. OFFICIAL: official skill, used with SkillId. DB or omitted: custom skill, used with Name. Valid values:
|
OFFICIAL |
| SkillId |
string |
No |
The resource ID of the official skill. This parameter is used when Source is set to OFFICIAL. |
dataworks-semantic |
| Name |
string |
No |
The name of the custom skill. Use the Name of a visible custom skill. For official skills, use SkillId. |
my-business-skill |
| Version |
integer |
No |
The published integer version number of the custom skill, used to explicitly select an existing version. Do not pass this field when Source is set to OFFICIAL. This parameter is mutually exclusive with VersionSelector. |
1 |
| VersionSelector |
string |
No |
The semantic version selection expression of the custom skill, such as ^1.2.3. Use this parameter only when the target server has deployed the custom resource version selection capability. This parameter is mutually exclusive with Version. This field is not accepted when Source is set to OFFICIAL. To ensure compatibility with servers of unconfirmed versions, use an existing integer Version. |
^1.2.3 |
| ExpertSuites |
array<object> |
No |
The list of expert suite references. If omitted, the existing references are retained. An explicit empty array clears the references. For official suites, specify only Source=OFFICIAL and SuiteId. Version, VersionSelector, or client artifact fields are not accepted. For custom suites, use SuiteId, and you can explicitly specify an existing integer Version. |
[{"SuiteId":"suite_example","Version":3}] |
|
object |
No |
|||
| Source |
string |
No |
The source of the expert suite. OFFICIAL: official suite. DB or omitted: custom suite. Both types of references use SuiteId, and the version fields apply only to custom resources. Valid values:
|
OFFICIAL |
| SuiteId |
string |
No |
The ID of the target expert suite. The suite must be one that the current caller has permissions to reference. |
suite_example |
| Version |
integer |
No |
The published integer version number of the custom expert suite, used to explicitly select an existing version. Do not pass this field when Source is set to OFFICIAL. This parameter is mutually exclusive with VersionSelector. To obtain explicit and reproducible references, do not rely on the default selection when the version is omitted. |
3 |
| VersionSelector |
string |
No |
The semantic version selection expression of the custom expert suite, such as ^1.2.3. Use this parameter only when the target server has deployed the custom resource version selection capability. This parameter is mutually exclusive with Version. This field is not accepted when Source is set to OFFICIAL. To ensure compatibility with servers of unconfirmed versions, use an existing integer Version. |
^1.2.3 |
| CallableAgents |
array<object> |
No |
The list of callable sub-agent references. For non-empty references, the referenced sub-agents must be visible. The agent cannot reference itself or form a call loop. Omit this parameter if no modification is required. Do not use an empty array to express general retention or clearing semantics. |
[{"Name":"data-analysis"}] |
|
object |
No |
A reference to a single callable sub-agent. |
{"Name":"data-analysis"} |
|
| Name |
string |
No |
The name of the called sub-agent. The agent must be one that the current caller has permissions to use. |
data-analysis |
| PublishImmediately |
boolean |
No |
Specifies whether to publish the agent immediately after the update. If this parameter is set to true, the operation saves a new draft version before requesting publication. If this parameter is set to false or omitted, it saves only the definition. Saving and publishing are not atomic operations. If the operation fails, call GetAgent to read the current version before retrying to avoid blindly repeating the update. |
false |
| Metadata |
object |
No |
The extended metadata. If omitted, the existing metadata is retained. If provided, the business metadata is updated, and the server retains the protected system metadata. |
{} |
| 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 PROJECT. |
|
|
string |
No |
A single visible project ID. |
24180 |
|
| UserIds |
array |
No |
The list of visible user IDs. This parameter is used when Visibility is set to USER. |
|
|
string |
No |
The user ID. |
123456 |
Parameters are submitted as top-level form fields. Structured parameters such as Model, Tools, Skills, ExpertSuites, CallableAgents, Metadata, and VisibilityScope are JSON-encoded. Minimum compatible example: Name=my-agent, ExpectedVersion=2, Description=Data analytics assistant, PublishImmediately=false. This example updates only the description. Existing values are retained for omitted reference fields. For Name and ExpectedVersion, use the actual values just read from the target agent.
Response elements
|
Element |
Type |
Description |
Example |
|
object |
The agent update response, which contains the updated agent definition and the OpenAPI request ID. |
||
| RequestId |
string |
The request ID. |
824F80BA-1778-5D8A-BAFF-668A4D9C4CC7 |
| Agent |
object |
The details of the updated agent. |
|
| AgentVersion |
integer |
The updated agent definition version. |
3 |
| Name |
string |
The name of the agent. |
my-agent |
| Skills |
array<object> |
The list of bound skill references after the update. |
|
|
object |
|||
| Source |
string |
The source of the skill. |
OFFICIAL |
| SkillId |
string |
The official skill ID. |
dataworks-semantic |
| Name |
string |
The name of the bound custom skill. |
my-business-skill |
| Version |
integer |
The published version number of the bound custom skill. |
1 |
| VersionSelector |
string |
The version selection expression. |
^1.2.3 |
| ExpertSuites |
array<object> |
The bound expert suites. |
|
|
object |
|||
| Source |
string |
The source of the expert suite. |
OFFICIAL |
| SuiteId |
string |
The ID of the expert suite. |
suite_example |
| Version |
integer |
The bound published version number. |
3 |
| VersionSelector |
string |
The version selection expression. |
^1.2.3 |
| Name |
string |
The suite name of the bound version. |
analysis-suite |
| DisplayName |
string |
The display name of the bound version. |
Data analytics expert suite |
| Description |
string |
The suite description of the bound version. |
Data analytics expert capability collection |
| SemanticVersion |
string |
The semantic version of the bound version. |
1.2.0 |
| 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 |
Returns the updated agent definition and the request ID. GmtCreateTime and GmtModifiedTime represent UNIX timestamps in milliseconds. They must be processed as millisecond timestamps and not parsed as ISO date strings. Supplementary fields for referenced resources are read based on Source and the returned content. Do not assume that official resources always have custom resource version fields.
Examples
Success response
JSON format
{
"RequestId": "824F80BA-1778-5D8A-BAFF-668A4D9C4CC7",
"Agent": {
"AgentVersion": 3,
"Name": "my-agent",
"Skills": [
{
"Source": "OFFICIAL",
"SkillId": "dataworks-semantic",
"Name": "my-business-skill",
"Version": 1,
"VersionSelector": "^1.2.3"
}
],
"ExpertSuites": [
{
"Source": "OFFICIAL",
"SuiteId": "suite_example",
"Version": 3,
"VersionSelector": "^1.2.3",
"Name": "analysis-suite",
"DisplayName": "Data analytics expert suite",
"Description": "Data analytics expert capability collection",
"SemanticVersion": "1.2.0"
}
],
"GmtCreateTime": 1780555634000,
"GmtModifiedTime": 1780555634000
}
}
Error codes
See Error Codes for a complete list.
Release notes
See Release Notes for a complete list.