Delete an agent
Delete an agent to stop it replying and remove it from lists. Before deleting it, check whether other agents use it as a subagent.
Deleting an agent can't be undone: the API has no operation to recover it. If you only want it to stop answering, deactivate it with Update an agent ("status": "inactive").
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
curl -X DELETE https://api.platic.ai/v1/agents/$AGENT_ID \
-H "Authorization: Bearer $PLATIC_API_KEY" await platic.agents.delete("agent_123"); Path parameters
| Parameter | Type | Description | Required |
|---|---|---|---|
agentId | string | Agent id | ✓ |
Query parameters
| Parameter | Type | Description | Required |
|---|---|---|---|
workspace | string | Only 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 }
} | Field | Description |
|---|---|
data.id | Id of the deleted agent |
data.deleted | true |
message | Fixed text that confirms the deletion |
Errors
| Status | details.code | When |
|---|---|---|
400 | INVALID_REQUEST | The credential covers several workspaces and workspace is missing, or isn't one of its own |
403 | FORBIDDEN | The credential can't edit this agent |
404 | AGENT_NOT_FOUND | The agent doesn't exist in the workspace |
503 | TEMPORARILY_UNAVAILABLE | The 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
404and the agent no longer appears in List agents.