Create a run strategy¶
Create a run policy configuration that is referenced by the agent.
POST https://moi.matrixorigin.cn/newmoi/workspaces/{workspace_id}/runtime-policy-profiles
Preparation before calling¶
Prepare a personal access token and target workspace ID that has 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: The workspace ID for which the policy is to be created, passed in theX-Workspace-IDheader and also asworkspace_idin the path.
Request example¶
curl -X POST "https://moi.matrixorigin.cn/newmoi/workspaces/$WORKSPACE_ID/runtime-policy-profiles" \
-H "X-API-Key: $AI_STUDIO_API_KEY" \
-H "X-Workspace-ID: $WORKSPACE_ID" \
-H 'Content-Type: application/json' \
-d '{
"name": "默认运行限制",
"budgets": {
"max_steps": 20
}
}'
Path parameters¶
Parameters |
Type |
Is it required |
Description |
|---|---|---|---|
|
string |
Yes |
Current workspace ID, must be consistent with |
Request body¶
Parameters |
Type |
Is it required |
Description |
|---|---|---|---|
|
string |
Yes |
Policy name. |
|
string |
No |
Policy description. |
|
string |
No |
Policy status. |
|
string |
No |
Policy scope type. |
|
string |
No |
Scope reference. |
|
object |
No |
Access conditions. |
|
object |
No |
Budget limit. |
|
object |
No |
Retry policy. |
|
object |
No |
Data policy. |
|
object |
No |
Product strategy. |
|
object |
No |
Run provider constraints. |
|
object |
No |
Tag key-value pair. |
|
object |
No |
Annotation key-value pair. |
|
object |
No |
Extended metadata. |
Successful response¶
Returns 201 on success. data is the new strategy.
{
"code": 0,
"data": {
"id": "policy_01",
"workspace_id": "ws_01",
"name": "默认运行限制",
"status": "active",
"scope_type": "workspace",
"budgets": {
"max_steps": 20
},
"version": 1,
"created_at": "2026-08-18T01:00:00Z",
"updated_at": "2026-08-18T01:00:00Z"
}
}
The response fields are as follows.
Field |
Type |
Description |
|---|---|---|
|
integer |
|
|
string |
Run policy ID. |
|
string |
ID of the workspace to which it belongs. |
|
string |
Policy name and status. |
|
string |
Policy name and status. |
|
string |
Scope types and references; references are only returned if they have a value. |
|
string |
Scope types and references; references are only returned if they have a value. |
|
object |
Admission, budget, and retry configuration; returned only if there is a value. |
|
object |
Admission, budget, and retry configuration; returned only if there is a value. |
|
object |
Admission, budget, and retry configuration; returned only if there is a value. |
|
object |
Data, product, and provider constraints; only returned if there is a value. |
|
object |
Data, product, and provider constraints; only returned if there is a value. |
|
object |
Data, product, and provider constraints; only returned if there is a value. |
|
integer |
Policy version. |
|
string |
Creation and update time. |
|
string |
Creation and 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 permission to create. |
Use valid credentials, or contact your administrator for authorization. |
|
|
Policy ID or name conflict. |
Modify identification or process existing policies. |
|
|
The running policy service is unavailable. |
Try again later. |
Follow-up operations¶
Save data.id and reference it as the agent run strategy.