Query the list of agents¶
Lists the agents whose current identity is readable in the workspace. It can be filtered by status, keywords and display scenarios, and read in sections through paging parameters.
GET https://api.moi.matrixorigin.cn/v5/workspaces/{workspace_id}/agents
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 to query, passed through theX-Workspace-IDHeader and asworkspace_idin the path.
Request example¶
curl --get "https://api.moi.matrixorigin.cn/v5/workspaces/$WORKSPACE_ID/agents" \
-H "X-API-Key: $AI_STUDIO_API_KEY" \
-H "X-Workspace-ID: $WORKSPACE_ID" \
--data-urlencode "surface=agent_chat" \
--data-urlencode "status=active" \
--data-urlencode "limit=20" \
--data-urlencode "offset=0"
Path parameters¶
Parameters |
Type |
Is it required |
Description |
|---|---|---|---|
|
string |
Yes |
Current workspace ID, must be consistent with |
Query parameters¶
Parameters |
Type |
Is it required |
Description |
|---|---|---|---|
|
string |
No |
Filter by agent status. |
|
string |
No |
Filter by keyword. |
|
string |
No |
Display scene; only |
|
integer |
No |
Single return quantity. |
|
integer |
No |
Returns the offset. |
The returned results have been filtered by the current identity’s agent read permissions.
Successful response¶
Returns 200 on success. data.items is the agent that can be read on this page, and data.total is the total number after filtering.
{
"code": 0,
"data": {
"items": [
{
"id": "agent_01",
"workspace_id": "ws_01",
"schema_version": 1,
"name": "销售助手",
"instruction": {
"system_prompt": "分析销售数据"
},
"runtime": {
"provider": "matrixone",
"profile": "default"
},
"status": "active",
"version": 1,
"source_type": "custom",
"created_at": "2026-01-15T10:00:00Z",
"updated_at": "2026-01-15T10:00:00Z"
}
],
"total": 1,
"limit": 20,
"offset": 0
}
}
The response fields are as follows.
Field |
Type |
Description |
|---|---|---|
|
integer |
|
|
object[] |
List of agents on this page. |
|
string |
Agent ID and workspace ID. |
|
string |
Agent ID and workspace ID. |
|
integer |
Agent metadata structure version. |
|
string |
Agent name and description; will not be returned if no description is set. |
|
string |
Agent name and description; will not be returned if no description is set. |
|
string |
Display icon; does not return if not set. |
|
string[] |
Label used for display; does not return if not set. |
|
object |
Command configuration. |
|
object |
Run target containing |
|
object |
Model configuration and resource binding; does not return if not set. |
|
object |
Model configuration and resource binding; does not return if not set. |
|
object |
Policy and workflow reference; not returned if not set. |
|
object |
Policy and workflow reference; not returned if not set. |
|
object |
Life cycle information; does not return if not set. |
|
string |
Agent status and resource version. |
|
integer |
Agent status and resource version. |
|
string |
Source type and source reference; not returned when source reference is not set. |
|
string |
Source type and source reference; not returned when source reference is not set. |
|
object |
Extended metadata; not returned if not set. |
|
string |
Creator ID; does not return if not set. |
|
string |
Last updater ID; does not return if not set. |
|
string |
Creation and last update times, in RFC 3339 format. |
|
string |
Creation and last update times, in RFC 3339 format. |
|
integer |
The total number of agents that meet the filter conditions and can be read by the current identity. |
|
integer |
The paging value actually used this time. |
|
integer |
The paging value actually used this time. |
[] after a type denotes an array. [] in a field path denotes each item in an array.
Error response¶
{
"code": 2,
"message": "invalid agent resource request"
}
Common HTTP errors¶
HTTP status code |
error code |
Common causes |
Recommended actions |
|---|---|---|---|
|
|
|
Check path and query parameters. |
|
|
Lack of valid identity credentials. |
Check API Key. |
|
|
The current identity does not have read permission to the workspace. |
Use an authorized identity, or contact the administrator for authorization. |
|
|
The agent resource service or its authorized dependencies are temporarily unavailable. |
Try again later. |
Follow-up operations¶
Use data.items[].id to call Query agent details, or call Query the agent version to view the version status.