Skip to main content

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

FieldRequiredTypeDescription
agent_idYesstringSource 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

FieldTypeDescription
request_idstringUnique request identifier. Provide this ID when troubleshooting issues.
status_codeintegerHTTP status code.
codestringResponse code. Success on success.
messagestringInformational message.
statusstringRequest status: SUCCESS or FAILED.
successbooleanWhether the request succeeded.
data.agent_idstringID of the newly created Agent.
data.agent_namestringNew Agent name, automatically prefixed with copy_.
data.agent_versionstringAgent version number. beta after copying.
data.agent_statusstringAgent status. draft after copying.

Error codes

HTTP status codeError codeDescription
400Index.InvalidParameterInvalid 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
}
Managed Agent API
Flow Agent API
Sandbox API
RAG API
Long-term Memory
ParseX API
Security API
Framework Integration