# Eliminar agente

> Elimina un agente de IA del workspace activo.

Fuente: https://developers.plazbot.com/cli/agent/delete/

### Eliminar agente

Elimina un agente de forma permanente. Antes de borrar, el CLI carga el agente, muestra su ID, nombre y descripción, y pide confirmación mostrando su nombre.

```bash
plazbot agent delete <agentId> [options]
```

### Parámetros

| Parámetro | Flag | Requerido | Descripción |
|-----------|------|-----------|-------------|
| `agentId` | (posicional) | Sí | ID del agente a eliminar. |
| JSON | `--json` | No | Imprime el resultado como JSON (`{"id","name","deleted"}`). Por defecto: `false`. |
| Confirmar | `-y, --yes` | No | Omite la confirmación (scripts y CI). Alias: `--confirm`. Por defecto: `false`. |

### Ejemplos

```bash
# Eliminar un agente (pide confirmación)
plazbot agent delete age_AbcDef123

# Eliminar sin preguntar (scripts y CI)
plazbot agent delete age_AbcDef123 --yes

# Eliminar y obtener el resultado en JSON
plazbot agent delete age_AbcDef123 --yes --json
```

### Resultado

```text
You are about to delete the following agent:
ID: age_AbcDef123
Name: Sales Plazbot
Description: Asistente virtual de ventas

? Delete agent "Sales Plazbot" (age_AbcDef123)? This cannot be undone. (y/N) y
✔ Agent "Sales Plazbot" deleted
```

Si respondes que no, se imprime `Aborted.` y el comando termina con código 1.

### Salida JSON

```json
{
"id": "age_AbcDef123",
"name": "Sales Plazbot",
"deleted": true
}
```

> **Importante:** La eliminación no se puede deshacer. Si podrías necesitar el agente otra vez, expórtalo antes: `plazbot agent export age_AbcDef123 -o agent.json` (ver [export](https://developers.plazbot.com/cli/agent/export)).

### Errores comunes

| Mensaje | Causa | Solución |
|---------|-------|----------|
| `This action needs confirmation and there is no interactive terminal.` | Se ejecutó sin terminal (CI, pipes) o con `--json` y sin `--yes`. | Agrega `--yes`. |
| `Resource not found.` | El ID no existe en el workspace activo. | Revisa el ID con `plazbot agent list`. |
| `You are not signed in.` | No hay sesión activa. | Ejecuta [`plazbot login`](https://developers.plazbot.com/cli/login). |
