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 the X-API-Key Header.

  • $WORKSPACE_ID: Target workspace ID, passed through X-Workspace-ID Header.

  • $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

workspace_id

string

Yes

The current workspace ID.

agent_id

string

Yes

The agent ID to be queried.

Query parameters

Parameters

Type

Is it required

Description

agent_workspace_id

string

No

Workspace where the agent definition belongs. Use workspace_id from the same agent-list item; if omitted, the current workspace is used.

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

code

integer

0 on success.

data.agent_id

string

Agent ID.

data.agent_version

integer

Agent resource version.

data.policy_refs

object

Saved run, approval, and guardrail policy references.

data.runtime_policy

object

The run policy configuration returned when parsable.

data.warnings

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

400

2(INVALID_ARGUMENT)

Invalid path parameter or agent_workspace_id.

Check path and query parameters.

401

6(UNAUTHENTICATED)

Lack of valid identity credentials.

Check API Key.

403

5(PERMISSION_DENIED)

The current caller does not have permission to read the agent.

Check the agent authorization in the workspace.

404

3(NOT_FOUND)

The agent does not exist within the specified workspace.

Check the agent ID and the workspace it belongs to.

503

15(UNAVAILABLE)

The agent resource service or its authorized dependencies are temporarily unavailable.

Try again later.

Follow-up operations

When modification is needed Update running strategy.

Last updated on