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
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.
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. |