Copy an agent
SDK platic.agents.copy()
Create a new agent with another agent’s configuration. Send the copy’s name and, to choose a specific version, fromVersionId. If you omit the version, the published version is copied. The copy is published as v1.
Copy the files too
With "files": { "include": true }:
- Nothing is duplicated. The copy is connected to the same files as the original. Changing a file's content or name changes it for both agents; pausing or disconnecting it only affects the agent where you do it.
- The copy is created inactive (
status: "inactive"), while its files are being connected. When the request finishes successfully, activate it. - If the response is
503withdetails.code: "KNOWLEDGE_ENGINE_UNAVAILABLE", the copy already exists, but its files didn't finish connecting: activating or publishing it answers409withdetails.code: "COPY_INCOMPLETE". Its id comes indetails.agentId: delete it and copy again in a few minutes. - Required permission: being able to edit the original agent or having the Integrations permission. Without it, the response is
403and nothing is created: copy only the configuration.
Example
curl https://api.platic.ai/v1/agents/$AGENT_ID/copies \
-H "Authorization: Bearer $PLATIC_API_KEY" \
-H "Content-Type: application/json" \
-d '{ "name": "Sales (copy)" }' await platic.agents.copy("agent_123", { name: "Sales (copy)" }); Path parameters
| Parameter | Type | Description | Required |
|---|---|---|---|
agentId | string | Id of the agent being copied | ✓ |
Request body
| Field | Type | Description | Required |
|---|---|---|---|
name | string | Name of the new agent, 1 to 100 characters | ✓ |
fromVersionId | string | Version to copy, for example v3. Defaults to the published one | - |
files | object | { "include": true } connects the copy to the same files as the original, each with the same active or paused state. If you omit files or use false, the copy has no files | - |
{
"name": "Sales (copy)",
"fromVersionId": "v3",
"files": { "include": true }
} Response
201 Created with the new agent:
{
"status": "success",
"data": {
"id": "Cp7nRe5KwT2jY8bA3dGh",
"name": "Sales (copy)",
"imageUrl": "/images/agents/avatars/p12.jpg",
"status": "inactive",
"owners": [],
"draft": { "versionId": "v1", "number": 1 },
"publication": { "versionId": "v1", "number": 1 },
"hasUnpublishedChanges": false,
"createdAt": "2026-10-28T13:00:00.000Z"
}
} The fields are those from Get an agent. In the example the copy is inactive because it was requested with files.include; without it, the copy is created active.
Errors
| Status | details.code | When |
|---|---|---|
400 | INVALID_REQUEST | The body doesn't have the expected shape, for example name is missing |
403 | RESOURCE_NOT_ACCESSIBLE | You asked for files.include without being able to edit the original agent or having the Integrations permission |
404 | AGENT_NOT_FOUND | The original agent doesn't exist in the workspace or was deleted |
404 | VERSION_NOT_FOUND | fromVersionId doesn't exist on that agent |
409 | KNOWLEDGE_NOT_ENABLED | You asked for files.include and files aren't enabled in this workspace. Copy only the configuration |
422 | INVALID_SUBAGENT_LINK | The version you copy links a subagent that was already deleted. Copy another version, or remove the link and copy the new version. Nothing is created |
422 | INVALID_ESCALATION | An escalation in the version you copy no longer exists or is archived. details.escalations carries each one with escalationId and reason. Nothing is created |
503 | SUPPORT_SERVICE_UNAVAILABLE | The version's escalations couldn't be checked. Nothing is created; try again |
503 | KNOWLEDGE_ENGINE_UNAVAILABLE | The copy exists, but its files didn't finish connecting. Delete it and copy again |
{
"code": 404,
"error": "Not Found - The resource doesn't exist",
"details": {
"code": "VERSION_NOT_FOUND",
"message": "Version v9 of agent Xq8mTe2LwP4kZ1aB9cDf not found"
}
} Notes
- The copy's
v1records where it comes from incopiedFrom(agentIdandversionId). See Get a version. - It doesn't copy the version history, channels or tools. Files only with
files.include. - The copy uses the same photo as the original. Change it with Update an agent.
- If you create it with an OAuth token, the person who owns the token becomes the copy's owner.