> ## Documentation Index
> Fetch the complete documentation index at: https://dev.docs.1to1ai.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Executar funcionário AI

> Executa o funcionário AI atribuído (ou um explícito)

<Info>
  **Endpoint** · `POST /conversation/actions`
</Info>

Executa um funcionário AI. `ai_employee` é opcional — sem ele usa o atribuído à
conversa. `instructions` é opcional.

**Campos**

* `ai_employee` — objeto `{ name }` do funcionário AI (opcional; sem ele usa o atribuído à conversa).
* `instructions` — texto livre (opcional).

```jsonc theme={null}
{
  "type": "run_ai",
  "ai_employee": { "name": "Agente Ventas" },
  "instructions": "Ofereça 10% de desconto e confirme o horário de entrega"
}
```

```jsonc theme={null}
// sem ai_employee: usa o funcionário AI atribuído à conversa
{
  "type": "run_ai"
}
```

Em uma lista, este objeto vai no array `actions` de um `POST /conversation/actions` — veja [Montar uma lista de ações](/pt/action-groups/overview#montar-uma-lista-de-ações).

## Exemplo executável

Um `run_ai` em uma conversa identificada por telefone e canal. Com `ai_employee`
executa um funcionário explícito; sem ele, executa o funcionário AI atribuído à
conversa. `instructions` é opcional.

### Request

<CodeGroup>
  ```bash Funcionário explícito theme={null}
  curl -X POST "https://app.1to1.ai/api/v1/public/{slug}/conversation/actions" \
    -H "Authorization: Bearer sk_1to1_sua_api_key" \
    -H "Content-Type: application/json" \
    -d '{
      "conversation": {
        "phone": "+5215512345678",
        "channel": "ch_7A9K2M4Q"
      },
      "actions": [
        {
          "type": "run_ai",
          "ai_employee": { "name": "Agente Ventas" },
          "instructions": "Ofereça 10% de desconto e confirme o horário de entrega"
        }
      ]
    }'
  ```

  ```bash Funcionário atribuído theme={null}
  curl -X POST "https://app.1to1.ai/api/v1/public/{slug}/conversation/actions" \
    -H "Authorization: Bearer sk_1to1_sua_api_key" \
    -H "Content-Type: application/json" \
    -d '{
      "conversation": {
        "phone": "+5215512345678",
        "channel": "ch_7A9K2M4Q"
      },
      "actions": [
        {
          "type": "run_ai"
        }
      ]
    }'
  ```
</CodeGroup>

### Resposta

`202 Accepted` — o grupo foi aceito e roda em **background**. O resultado por
ação não viaja na resposta (consulte-o depois — veja [Como é executado](/pt/action-groups/overview#como-é-executado)).

```json theme={null}
{
  "status": "processing",
  "actions_accepted": 1
}
```

<ResponseField name="status" type="string">
  Sempre `processing`: confirma que o grupo foi aceito e está em execução.
</ResponseField>

<ResponseField name="actions_accepted" type="integer">
  Quantas ações do array foram **admitidas** para execução — não quantas tiveram
  sucesso.
</ResponseField>
