Copy Agent
Copy an existing Agent to generate a new draft.
Prerequisites
Obtain an Alibaba Cloud Model Studio API Key and workspace ID first. For authentication, see API Authentication. Copying an Agent requires the Knowledge Base - Create permission, which is determined by the user's role in Workspace Member Management. See Permissions.
Endpoint
POST /api/v1/indices/rag/app/copy
Copy the specified Agent to create a new draft Agent. The new Agent name is automatically prefixed with copy_, the version number is beta, the status is draft, and the configuration is inherited from the source Agent.
Request body
| Field | Required | Type | Description |
|---|---|---|---|
agent_id | Yes | string | Source Agent ID. |
Request example
curl -X POST "$BASE_URL/api/v1/indices/rag/app/copy" \
-H "Authorization: Bearer $BAILIAN_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"agent_id": "aid-8f3a1b2c4d5e6f70"
}'
BASE_URL is https://{workspace_id}.cn-beijing.maas.aliyuncs.com ({workspace_id} is the workspace ID), and BAILIAN_API_KEY is your Alibaba Cloud Model Studio API Key.
Response example
Returns 200 on success.
{
"request_id": "a7b8c9d0-e1f2-3456-abcd-567890123456",
"status_code": 200,
"code": "Success",
"message": "",
"status": "SUCCESS",
"success": true,
"data": {
"agent_id": "aid-9a0b1c2d3e4f5678",
"agent_name": "copy_Customer Service Q&A Assistant v2",
"agent_version": "beta",
"agent_status": "draft"
}
}
Response fields
| Field | Type | Description |
|---|---|---|
request_id | string | Unique request identifier. Provide this ID when troubleshooting issues. |
status_code | integer | HTTP status code. |
code | string | Response code. Success on success. |
message | string | Informational message. |
status | string | Request status: SUCCESS or FAILED. |
success | boolean | Whether the request succeeded. |
data.agent_id | string | ID of the newly created Agent. |
data.agent_name | string | New Agent name, automatically prefixed with copy_. |
data.agent_version | string | Agent version number. beta after copying. |
data.agent_status | string | Agent status. draft after copying. |
Error codes
| HTTP status code | Error code | Description |
|---|---|---|
| 400 | Index.InvalidParameter | Invalid request parameters. Please check that all parameters are complete and correctly typed. |
Error response example:
{
"request_id": "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx",
"status_code": 400,
"code": "Index.InvalidParameter",
"message": "Invalid request parameters. Please check that all parameters are complete and correctly typed.",
"status": "FAILED",
"success": false
}