List environment templates
List environment templates in the current workspace with cursor pagination.
Endpoint
Returns 200 and a list envelope.
/agents/environments/templatesQuery parameters
limitintegerOptionalNumber of items per page, default 20; 1..100 is recommended
orderstringOptionalSort direction, asc or desc, defaults to desc
afterstringOptionalThe last_id from the previous page; the cursor item is excluded
beforestringOptionalThe first_id from the previous page, for reverse pagination; cannot be used with after
Passing both after and before returns 400. An invalid cursor or a missing template returns 404.
Request example
curl -sS "$BASE_URL/agents/environments/templates?limit=20&order=desc" \
-H "Authorization: Bearer $DASHSCOPE_API_KEY" \
-H "OpenAI-Beta: agents=v1"
page = client.beta.agents.environments.templates.list(limit=20, order="desc")
for template in page.data:
print(template.id, template.name)
Response fields
objectstringList object type, fixed as list
dataarrayEnvironment templates on this page; [] when empty
first_idstring / nullFirst item ID on this page; null for an empty page
last_idstring / nullLast item ID on this page; null for an empty page; use it as after
has_morebooleanWhether the current scan direction has another page
Each template in data[] contains id, object, name, created_at, updated_at, packages, network, desktop, capability_directories, skills, plugins, and files. Field meanings are the same as in Retrieve an environment template.
Response example
{
"object": "list",
"data": [
{
"id": "envtmpl_xxx",
"name": "example-template",
"object": "agent.environment.template",
"created_at": 1794452344,
"updated_at": 1794452344,
"packages": {"python": [], "system": [], "npm": []},
"network": {"access": "disabled", "allowed_domains": []},
"desktop": {"enabled": false},
"capability_directories": ["/workspace/skills"],
"skills": [],
"plugins": [],
"files": []
}
],
"first_id": "envtmpl_xxx",
"last_id": "envtmpl_xxx",
"has_more": false
}
Error codes
| HTTP status | Error type / code | Solution |
|---|---|---|
400 | invalid_request_error / invalid_request_error | Fix limit, order, after, or before as described in the query parameters |
401 | authentication_error / invalid_api_key | Send a valid Authorization: Bearer $DASHSCOPE_API_KEY header |
404 | not_found_error / not_found_error | Use a valid cursor in the current collection |
500 | server_error / server_error | Retry later. If it keeps failing, submit a ticket with x-request-id |