# ai_agents.list

Listar agentes de IA. Agentes de IA da conta (sem os excluídos), do mais antigo ao mais novo, em páginas (`page` a partir de 1, `perPage` até 100, padrão 48). Cada agente traz nome, objetivo (`purpose`), rosto (`avatarPreset`, chave de um rosto pronto, ou `avatarUrl`), `status` (`draft`, `active`, `paused`), provedor, `credentialId`, modelo, temperatura (0 a 1), persona, ferramentas, regras de escalonamento, `primaryRole`, versão publicada, `dirty` (há alterações não publicadas) e os contadores de conversas. Sem a migration, a lista vem vazia.

- Endpoint: `POST https://app.atomiks.com.br/api/v1/ai_agents.list` (corpo JSON)
- Quem pode chamar: membro da conta
- Escopo da chave: `crm:read`
- Grava dados: não
- Pela chave de API: sim
- Ferramenta MCP: `ai_agents_list`
- Ficha em JSON: `https://app.atomiks.com.br/api/v1/openapi.json` (operationId `ai_agents.list`)

## Entrada

| Campo | Tipo | Obrigatório | Nota |
|---|---|---|---|
| `page` | integer | não | padrão 1 |
| `perPage` | integer | não | padrão 48 |
| `status` | "draft" \| "active" \| "paused" | não |  |

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

```json
{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "type": "object",
  "properties": {
    "page": {
      "default": 1,
      "type": "integer",
      "minimum": 1,
      "maximum": 9007199254740991
    },
    "perPage": {
      "default": 48,
      "type": "integer",
      "minimum": 1,
      "maximum": 100
    },
    "status": {
      "type": "string",
      "enum": [
        "draft",
        "active",
        "paused"
      ]
    }
  }
}
```

</details>

## Exemplo

```bash
curl -X POST https://app.atomiks.com.br/api/v1/ai_agents.list \
  -H "Authorization: Bearer $ATOMIKS_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"page":1,"perPage":48}'
```

CLI:

```bash
node cli/atomiks.mjs ai_agents.list --json '{"page":1,"perPage":48}'
```

MCP: ferramenta `ai_agents_list` 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": {
    "items": {
      "type": "array",
      "items": {
        "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
      }
    },
    "meta": {
      "type": "object",
      "properties": {
        "page": {
          "type": "number"
        },
        "perPage": {
          "type": "number"
        },
        "countPages": {
          "type": "number"
        },
        "countItens": {
          "type": "number"
        }
      },
      "required": [
        "page",
        "perPage",
        "countPages",
        "countItens"
      ],
      "additionalProperties": false
    }
  },
  "required": [
    "items",
    "meta"
  ],
  "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).
