Update running strategy¶
Partially updated run policy configuration. Each successful update increments the policy version and only affects subsequent admission operations.
PATCH https://moi.matrixorigin.cn/newmoi/workspaces/{workspace_id}/runtime-policy-profiles/{policy_id}
Preparation before calling¶
First query the running policy details and confirm the policy to be updated. Prepare the personal access token, target workspace ID, and policy ID that have access to the target workspace.
The example below uses:
$AI_STUDIO_API_KEY: The actual personal access token, passed through theX-API-KeyHeader.$WORKSPACE_ID: Target workspace ID, passed through theX-Workspace-IDHeader and also asworkspace_idin the path.$POLICY_ID: The running policy ID to update, aspolicy_idin the path.
Request example¶
curl -X PATCH "https://moi.matrixorigin.cn/newmoi/workspaces/$WORKSPACE_ID/runtime-policy-profiles/$POLICY_ID" \
-H "X-API-Key: $AI_STUDIO_API_KEY" \
-H "X-Workspace-ID: $WORKSPACE_ID" \
-H 'Content-Type: application/json' \
-d '{
"budgets": {
"max_steps": 30
},
"retry": {
"max_attempts": 2
}
}'
Path parameters¶
Parameters |
Type |
Is it required |
Description |
|---|---|---|---|
|
string |
Yes |
The current workspace ID. |
|
string |
Yes |
The running policy ID. |
Request body¶
All fields are optional, submit only the fields that need to be updated.
Parameters |
Type |
Is it required |
Description |
|---|---|---|---|
|
string |
No |
Policy name and description. |
|
string |
No |
Policy name and description. |
|
string |
No |
Policy status and scope. |
|
string |
No |
Policy status and scope. |
|
string |
No |
Policy status and scope. |
|
object |
No |
Admission, budget, and retry configuration. |
|
object |
No |
Admission, budget, and retry configuration. |
|
object |
No |
Admission, budget, and retry configuration. |
|
object |
No |
Data, product, and provider restrictions. |
|
object |
No |
Data, product, and provider restrictions. |
|
object |
No |
Data, product, and provider restrictions. |
|
object |
No |
Attached tags, annotations, and metadata. |
|
object |
No |
Attached tags, annotations, and metadata. |
|
object |
No |
Attached tags, annotations, and metadata. |
Successful response¶
On success, 200 is returned, and data is the updated strategy. SAVE NEW data.version.
{
"code": 0,
"data": {
"id": "policy_01",
"name": "默认运行限制",
"status": "active",
"scope_type": "workspace",
"budgets": {
"max_steps": 30
},
"retry": {
"max_attempts": 2
},
"version": 2,
"updated_at": "2026-08-18T01:00:00Z"
}
}
The response fields are as follows.
Field |
Type |
Description |
|---|---|---|
|
integer |
|
|
string |
Run policy ID. |
|
string |
Updated policy name, status, and scope type. |
|
string |
Updated policy name, status, and scope type. |
|
string |
Updated policy name, status, and scope type. |
|
object |
Updated budget and retry configuration; only returned if there is a value. |
|
object |
Updated budget and retry configuration; only returned if there is a value. |
|
integer |
The updated policy version. |
|
string |
Update time. |
Error response¶
{
"code": 2,
"message": "运行策略参数无效"
}
Common HTTP errors¶
HTTP status code |
error code |
Common causes |
Recommended actions |
|---|---|---|---|
|
|
The request body or policy field is invalid. |
Check request fields. |
|
|
Credentials are missing or invalid. |
Check API Key. |
|
|
The current identity does not have update permissions. |
Use valid credentials, or contact your administrator for authorization. |
|
|
Run policy does not exist. |
Query the running policy list first. |
|
|
The updated strategy conflicts with existing resources. |
Modify the update content and try again. |
|
|
The running policy service is unavailable. |
Try again later. |
Follow-up operations¶
Use Query the details of the running strategy to confirm the current fields and versions.