List agents

Updated at:

List agents in the current workspace with pagination.

Endpoint

Returns 200 and a list envelope. data is an array of Agent objects.

GET/agents

Query parameters

limitintegerOptional

Number of items per page, default 20; recommended range 1..100

orderstringOptional

Sort direction, asc or desc, default desc

afterstringOptional

The last_id from the previous page; the cursor item is excluded

beforestringOptional

The first_id from the previous page, for reverse pagination; cannot be used with after; the cursor must be a valid agent in the current workspace

Passing both after and before returns 400. For the first page, omit after. For later pages, pass the last_id from the previous response. For reverse pagination, pass the first_id as before. has_more indicates whether the current scan direction has more results. The list is sorted lexicographically by agent ID, is not guaranteed to sort stably by created_at, and does not provide snapshot isolation under concurrent writes.

Request example

curl -sS "$BASE_URL/agents?limit=20&order=desc" \
  -H "Authorization: Bearer $DASHSCOPE_API_KEY" \
  -H "OpenAI-Beta: agents=v1"
page = client.beta.agents.list(limit=20, order="desc")
for agent in page.data:
    print(agent.id, agent.name)

Response fields

objectstring

List object type, fixed as list

dataarray

Agent objects on this page; [] when empty

first_idstring / null

ID of the first item; null for an empty page

last_idstring / null

ID of the last item; null for an empty page

has_moreboolean

Whether the current scan direction has another page

Agent fields

idstring

Agent ID. Treat it as an opaque string

objectstring

Agent object type, fixed as agent

created_atinteger

Creation time as a Unix timestamp in seconds

updated_atinteger

Last modification time as a Unix timestamp in seconds; not a version number

namestring / null

Display name

metadataobject / null

Metadata, stored string key-value pairs

modelstring

Stored model ID

reasoningobject / null

Reasoning configuration. Either subfield can be null.

Properties

effortstring / null

Reasoning effort: none, minimal, low, medium, high, xhigh, max

summarystring / null

Reasoning summary: concise, detailed, auto

textobject / null

Text output configuration.

Properties

formatobject

Output format.

Properties

typestring / null

Output format type, fixed as text

verbositystring / null

Output verbosity, low, medium, high

instructionsstring / null

Stored custom instructions

toolsarray / null

Stored tool configuration; each branch returns only its own fields

Properties

functionobject

Function tool configuration; returns name, description, and parameters

mcpobject

MCP tool configuration; returns server_label, transport, allowed_tools, required, and connection_origin; transport is http or stdio

web_searchobject

Web search tool configuration; returns type and the saved configuration

multi_agentobject / null

Subagent configuration.

Properties

enabledboolean

Whether subagent tools are enabled

max_concurrent_subagentsinteger / null

Maximum number of concurrent subagents; no default is applied

Optional fields that were never set can be null.

Response example

{
  "object": "list",
  "data": [],
  "first_id": null,
  "last_id": null,
  "has_more": false
}

Error codes

Business errors return an error object with type, code, message, and param. Common errors:

HTTP statusError type / codeSolution
400invalid_request_error / invalid_request_errorFix limit and order as described in the query parameters
401authentication_error / invalid_api_keySend a valid Authorization: Bearer $DASHSCOPE_API_KEY header
404not_found_error / not_found_errorUse the last_id returned by the previous page as after
500server_error / server_errorRetry later. If it keeps failing, submit a ticket with x-request-id