Query execution strategy¶
Reads the agent’s currently saved policy reference and returns a resolvable running policy configuration and a warning for unresolved references.
GET https://api.moi.matrixorigin.cn/v5/workspaces/{workspace_id}/agents/{agent_id}/policies
Preparation before calling¶
First query the agent list to obtain the agent ID. Prepare the personal access token, target workspace ID, and agent 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 throughX-Workspace-IDHeader.$AGENT_ID: The agent ID to be queried.
Request example¶
curl "https://api.moi.matrixorigin.cn/v5/workspaces/$WORKSPACE_ID/agents/$AGENT_ID/policies" \
-H "X-API-Key: $AI_STUDIO_API_KEY" \
-H "X-Workspace-ID: $WORKSPACE_ID"
Path parameters¶
Parameters |
Type |
Is it required |
Description |
|---|---|---|---|
|
string |
Yes |
The current workspace ID. |
|
string |
Yes |
The agent ID to be queried. |
Query parameters¶
Parameters |
Type |
Is it required |
Description |
|---|---|---|---|
|
string |
No |
Workspace where the agent definition belongs. Use |
Successful response¶
Returns 200 on success. warnings means that a reference has not been resolved, but does not mean that this read failed. When there are no warnings, the field may be omitted and should be treated as an empty list.
{
"code": 0,
"data": {
"agent_id": "agent_01",
"agent_version": 2,
"policy_refs": {
"runtime_policy_ref": "rp_01",
"approval_policy_ref": "ap_01",
"guardrail_policy_ref": "gp_01"
},
"runtime_policy": {
"id": "rp_01"
},
"warnings": []
}
}
The response fields are as follows.
Field |
Type |
Description |
|---|---|---|
|
integer |
|
|
string |
Agent ID. |
|
integer |
Agent resource version. |
|
object |
Saved run, approval, and guardrail policy references. |
|
object |
The run policy configuration returned when parsable. |
|
array of string |
Unresolved policy or approval/guardrail reference descriptions; returned only when warnings exist. |
[] after a type denotes an array. [] in a field path denotes each item in an array.
Error response¶
{
"code": 3,
"message": "<错误信息>"
}
Common HTTP errors¶
HTTP status code |
error code |
Common causes |
Recommended actions |
|---|---|---|---|
|
|
Invalid path parameter or |
Check path and query parameters. |
|
|
Lack of valid identity credentials. |
Check API Key. |
|
|
The current caller does not have permission to read the agent. |
Check the agent authorization in the workspace. |
|
|
The agent does not exist within the specified workspace. |
Check the agent ID and the workspace it belongs to. |
|
|
The agent resource service or its authorized dependencies are temporarily unavailable. |
Try again later. |
Follow-up operations¶
When modification is needed Update running strategy.