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 503 with details.code: "KNOWLEDGE_ENGINE_UNAVAILABLE", the copy already exists, but its files didn't finish connecting: activating or publishing it answers 409 with details.code: "COPY_INCOMPLETE". Its id comes in details.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 403 and nothing is created: copy only the configuration.

Example

await platic.agents.copy("agent_123", { name: "Sales (copy)" });

Path parameters

ParameterTypeDescriptionRequired
agentIdstringId of the agent being copied✓

Request body

FieldTypeDescriptionRequired
namestringName of the new agent, 1 to 100 characters✓
fromVersionIdstringVersion to copy, for example v3. Defaults to the published one-
filesobject{ "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

Statusdetails.codeWhen
400INVALID_REQUESTThe body doesn't have the expected shape, for example name is missing
403RESOURCE_NOT_ACCESSIBLEYou asked for files.include without being able to edit the original agent or having the Integrations permission
404AGENT_NOT_FOUNDThe original agent doesn't exist in the workspace or was deleted
404VERSION_NOT_FOUNDfromVersionId doesn't exist on that agent
409KNOWLEDGE_NOT_ENABLEDYou asked for files.include and files aren't enabled in this workspace. Copy only the configuration
422INVALID_SUBAGENT_LINKThe 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
422INVALID_ESCALATIONAn escalation in the version you copy no longer exists or is archived. details.escalations carries each one with escalationId and reason. Nothing is created
503SUPPORT_SERVICE_UNAVAILABLEThe version's escalations couldn't be checked. Nothing is created; try again
503KNOWLEDGE_ENGINE_UNAVAILABLEThe 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 v1 records where it comes from in copiedFrom (agentId and versionId). 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.