---
question: Does deleting an agent in Settings remove the class?
kind: task
via_web: available
via_cli: na
via_python: available
via_api: available
via_config: na
ref_web: Settings › Agents
ref_python: agents/
ref_api: DELETE /api/agents/{id}
next:
  - /capabilities/build/agents/enable-in-a-workspace
  - /capabilities/build/agents/creating-an-agent
---

# Delete an agent

Deleting a workspace agent removes its record for good. An engine agent is a class in a module: Nexus keeps one record of it per workspace and creates it again at that workspace's next [sync](/user-guide/build/agents/enable-in-a-workspace#when-a-workspace-syncs) while the class exists. To stop offering an engine agent in a workspace, turn it off instead; for the default agent, change `default_agent` first, since every sync turns it back on. To remove an engine agent, delete the class.

## Web UI

### Open the agent list

In the workspace, open Settings › Agents.

### Delete the row

Click the trash icon (**Delete**) on the agent's row, then **Delete** in the **Delete agent?** dialog.

A workspace agent is gone. An engine agent comes back at the workspace's next [sync](/user-guide/build/agents/enable-in-a-workspace#when-a-workspace-syncs): [turn it off](/user-guide/build/agents/enable-in-a-workspace) to hide it, or delete its class.

![Workspace Settings on Agents, enabled agents](/abi/Screenshot_Agents.png)

*Settings › Agents, filtered to enabled agents. The trash icon in Actions deletes a row.*

## CLI

Not applicable. No `abi` command deletes an agent: delete the class file, as in the Python steps.

## Python

### Delete the class

Remove the agent's file from the module's `agents/` folder, or the class from that file:

```bash
rm src/my_module/agents/ReviewerAgent.py
```

Remove what refers to it too: a parent's `agents` list, an intent that targets it, a `default_agent` or workspace `agents:` entry in `config.yaml`. While `default_agent` names a missing class, `abi chat` with no arguments opens no chat.

### Restart the engine

The engine reads `agents/` at startup. After a restart, its REST route is gone. Each workspace keeps the agent's record until that workspace [syncs](/user-guide/build/agents/enable-in-a-workspace#when-a-workspace-syncs), which deletes it.

## REST API

### Delete the record

```http
DELETE /api/agents/{id}
```

`{id}` is the agent's id from `GET /api/agents/?workspace_id=<id>`. Auth: a Nexus session with access to the workspace. The response is `{"status": "deleted"}`.

As in the Web UI, the record of an engine agent is created again by the workspace's next sync, such as `POST /api/agents/sync?workspace_id=<id>`. To hide it, send `PATCH /api/agents/{id}` with `{"enabled": false}`; the default agent is turned back on at each sync.

## Config

Not applicable: `config.yaml` lists modules, not agent classes, and `enabled: false` on a module drops all of its agents. To hide one agent, leave it out of the workspace's `agents:` list ([Enable in a workspace](/user-guide/build/agents/enable-in-a-workspace?via=config)).
