# ai_agents.status_set

Ativar ou pausar agente de IA. Liga (`active`) ou pausa (`paused`) o agente. Agente nunca publicado responde `invalid_input` (publique antes).

- Endpoint: `POST https://app.atomiks.com.br/api/v1/ai_agents.status_set` (corpo JSON)
- Quem pode chamar: administrador da conta
- Escopo da chave: `crm:write`
- Grava dados: sim
- Pela chave de API: sim
- Ferramenta MCP: `ai_agents_status_set`
- Ficha em JSON: `https://app.atomiks.com.br/api/v1/openapi.json` (operationId `ai_agents.status_set`)

## Entrada

| Campo | Tipo | Obrigatório | Nota |
|---|---|---|---|
| `id` | string (uuid) | sim |  |
| `status` | "active" \| "paused" | sim |  |

<details><summary>JSON Schema</summary>

```json
{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "type": "object",
  "properties": {
    "id": {
      "type": "string",
      "format": "uuid",
      "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
    },
    "status": {
      "type": "string",
      "enum": [
        "active",
        "paused"
      ]
    }
  },
  "required": [
    "id",
    "status"
  ]
}
```

</details>

## Exemplo

```bash
curl -X POST https://app.atomiks.com.br/api/v1/ai_agents.status_set \
  -H "Authorization: Bearer $ATOMIKS_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"id":"00000000-0000-0000-0000-000000000000","status":"active"}'
```

CLI:

```bash
node cli/atomiks.mjs ai_agents.status_set --json '{"id":"00000000-0000-0000-0000-000000000000","status":"active"}'
```

MCP: ferramenta `ai_agents_status_set` com a mesma entrada.

## Saída

Sucesso: `{"data": ...}` com o formato abaixo.

```json
{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "type": "object",
  "properties": {
    "id": {
      "type": "string"
    },
    "ownerId": {
      "type": [
        "string",
        "null"
      ]
    },
    "name": {
      "type": "string"
    },
    "purpose": {
      "type": [
        "string",
        "null"
      ]
    },
    "avatarPreset": {
      "type": [
        "string",
        "null"
      ]
    },
    "avatarUrl": {
      "type": [
        "string",
        "null"
      ]
    },
    "status": {
      "type": "string",
      "enum": [
        "draft",
        "active",
        "paused"
      ]
    },
    "provider": {
      "type": "string",
      "enum": [
        "openai",
        "anthropic"
      ]
    },
    "credentialId": {
      "type": "string"
    },
    "modelId": {
      "type": "string"
    },
    "temperature": {
      "type": "number"
    },
    "persona": {
      "type": "string"
    },
    "tools": {
      "type": "array",
      "items": {
        "type": "string"
      }
    },
    "escalation": {
      "type": "array",
      "items": {
        "type": "object",
        "properties": {
          "trigger": {
            "type": "string",
            "maxLength": 300
          },
          "action": {
            "type": "string",
            "maxLength": 300
          },
          "enabled": {
            "default": true,
            "type": "boolean"
          }
        },
        "required": [
          "trigger",
          "action",
          "enabled"
        ],
        "additionalProperties": false
      }
    },
    "knowledgeStoreId": {
      "type": [
        "string",
        "null"
      ]
    },
    "primaryRole": {
      "type": "string",
      "enum": [
        "sdr_inbound",
        "sdr_outbound",
        "support"
      ]
    },
    "version": {
      "type": "number"
    },
    "publishedAt": {
      "type": [
        "string",
        "null"
      ]
    },
    "dirty": {
      "type": "boolean"
    },
    "conversationsCount": {
      "type": "number"
    },
    "resolvedCount": {
      "type": "number"
    },
    "scheduledCount": {
      "type": "number"
    },
    "escalatedCount": {
      "type": "number"
    },
    "createdAt": {
      "type": "string"
    },
    "updatedAt": {
      "type": "string"
    }
  },
  "required": [
    "id",
    "ownerId",
    "name",
    "purpose",
    "avatarPreset",
    "avatarUrl",
    "status",
    "provider",
    "credentialId",
    "modelId",
    "temperature",
    "persona",
    "tools",
    "escalation",
    "knowledgeStoreId",
    "primaryRole",
    "version",
    "publishedAt",
    "dirty",
    "conversationsCount",
    "resolvedCount",
    "scheduledCount",
    "escalatedCount",
    "createdAt",
    "updatedAt"
  ],
  "additionalProperties": false
}
```

## Erros

`{"error": {"code", "message", "requestId"}}`. Códigos: `invalid_input` (400), `unauthorized` (401), `forbidden` / `account_pending` / `scope_missing` (403), `not_found` (404), `limit_reached` (409), `internal` (500).
