Delete an agent

SDK platic.agents.delete()

Delete an agent to stop it replying and remove it from lists. Before deleting it, check whether other agents use it as a subagent.

If it is another agent's subagent

Deleting an agent doesn't remove the links other agents have to it. Each parent's published version still names it, but no longer hands it conversations or consults it.

The parent's draft can still be edited. What you can't do until you remove the link is publish that version, roll back, restore or copy a version that has it: they answer 422 with details.code: "INVALID_SUBAGENT_LINK" and the message says which agent was deleted.

Before deleting it, unlink it from each parent and publish those parents. If you already deleted it, unlink it from the parent's draft and publish.

Example

await platic.agents.delete("agent_123");

Path parameters

ParameterTypeDescriptionRequired
agentIdstringAgent id✓

Query parameters

ParameterTypeDescriptionRequired
workspacestringOnly if the credential has access to several workspaces-

Response

200 OK. The response confirms the deletion:

{
  "status": "success",
  "message": "Agent deleted successfully",
  "data": { "id": "Xq8mTe2LwP4kZ1aB9cDf", "deleted": true }
}
FieldDescription
data.idId of the deleted agent
data.deletedtrue
messageFixed text that confirms the deletion

Errors

Statusdetails.codeWhen
400INVALID_REQUESTThe credential covers several workspaces and workspace is missing, or isn't one of its own
403FORBIDDENThe credential can't edit this agent
404AGENT_NOT_FOUNDThe agent doesn't exist in the workspace
503TEMPORARILY_UNAVAILABLEThe deletion couldn't be finished. Repeat the same request: it continues where it left off

What happens to its files

Before deleting the agent, the API disconnects all of its files. Only the connections are removed: the files stay in the workspace and remain connected to the other agents that use them. To delete a file, use Delete a file.

Notes

  • If disconnecting the files fails, the agent isn't deleted. Repeating the request picks it up again.
  • After deleting it, Get an agent answers 404 and the agent no longer appears in List agents.