Query the agent version

Lists the loaded versions of an agent, including status, runtime bindings, and the current default version. Resource versions produced by ordinary agent creation or updates do not appear here.

GET https://api.moi.matrixorigin.cn/v5/workspaces/{workspace_id}/agents/{agent_id}/versions

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 the X-Workspace-ID Header and as workspace_id in the path.

  • $AGENT_ID: Target agent ID, as agent_id in the path.

Request example

curl "https://api.moi.matrixorigin.cn/v5/workspaces/$WORKSPACE_ID/agents/$AGENT_ID/versions" \
  -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

Agent ID.

Query parameters

Parameters

Type

Is it required

Description

agent_workspace_id

string

No

The workspace to which the agent belongs; if not passed, the workspace in the path will be used.

Successful response

Returns 200 on success. data.items is the list of loaded agent package versions, and data.lineage summarizes their workspace, agent, and current default version. Resource versions produced by ordinary agent creation or updates do not appear here.

{
  "code": 0,
  "data": {
    "items": [
      {
        "workspace_id": "ws_01",
        "agent_id": "agent_01",
        "version": "v3",
        "status": "runnable",
        "source_digest": "sha256:9f2b7c4a1d5e8f0a2b3c4d5e6f708192a3b4c5d6e7f8091a2b3c4d5e6f70819",
        "loaded_at": "2026-01-15T10:00:00Z"
      }
    ],
    "total": 1,
    "lineage": {
      "workspace_id": "ws_01",
      "agent_id": "agent_01",
      "default_version": "v3",
      "created_at": "2026-01-15T10:00:00Z",
      "updated_at": "2026-01-15T10:00:00Z"
    }
  }
}

The response fields are as follows.

Field

Type

Description

code

integer

0 on success.

data.items

array

The version record of the current agent lineage.

data.items[].workspace_id

string

Workspace where the loaded version belongs.

data.items[].agent_id

string

Agent ID for the loaded version.

data.items[].version

string

Version number.

data.items[].status

string

Version status; can be needs_configuration, runnable, or disabled.

data.items[].source_digest

string

A summary of the contents of the loaded version.

data.items[].loaded_at

string

Version load time, using RFC 3339 format.

data.total

integer

Number of loaded versions matching the query.

data.lineage

object

Summary of the workspace, agent, and current default loaded version.

data.lineage.default_version

string

The current default version.

data.lineage.created_at

string

Time when the pedigree was created and last updated, using RFC 3339 format.

data.lineage.updated_at

string

Time when the pedigree was created and last updated, using RFC 3339 format.

[] after a type denotes an array. [] in a field path denotes each item in an array.

Error response

{
  "code": 1500,
  "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 workspace and agent identification.

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’s version or version lineage was not found.

First query the agent list and confirm that its version is loaded.

503

15(UNAVAILABLE)

Version services or authorization dependencies are temporarily unavailable.

Try again later.

Follow-up operations

After selecting a version, you can Set as default version; if you no longer use the version, you can Disable agent version.

Last updated on