Investigador de falhas de pagamento com IA: por que este pagamento falhou?

Um agente lê um pagamento, as tentativas e a página de status do processador, e então explica a causa e o próximo passo para sua equipe de suporte.

  • Arquivos
  • Conexão somente leitura
  • Web
  • Callback
  • Limite de orçamento

Veja uma execução real

Uma execução real em 7 de out. de 2026, reproduzida. Modelo: openai/gpt-6-luna.

Entrada
{
  "payment_id": "pay_123"
}
Concluídarun_80b0a7e12e1b4ee6bc00299ba70cd933$0.004055 de $0.04
  1. Na filaorçamento de $0.04 reservado
  2. MicroVMmicroVM ready
  3. MicroVMworker started · shell off · web on
  4. Arquivoread playbook.md
  5. Conexãopayments GET /payments/pay_123
  6. Resultadopayments GET → 200
  7. Conexãopayments GET /payments/pay_123/attempts
  8. Resultadopayments GET → 200
  9. MicroVMmicroVM destroyed
  10. Concluída4 chamadas ao modelo, 6,787 tokensSaída gravada (em inglês)

    Cause: The card issuer declined the payment for insufficient funds.
    Evidence: failure_code=insufficient_funds; failure_message=The card issuer declined the charge: insufficient funds. Both attempts failed for the same reason.
    Next step: Suggest the customer retry or use another card.

  11. Worker destruído$0.004055 cobrados, $0.035945 liberados
Modelo $0.000255 · Web $0.00 · Computação $0.0038

Execute você mesmo

Abra o exemplo no playground com a requisição inteira preenchida. Ele roda na sua própria conta, dentro do orçamento indicado, contra os mesmos sistemas de exemplo somente leitura.

Orçamento deste exemplo: $0.04

Como funciona

Informe o ID de um pagamento e um breve playbook. O agente chama sua API de pagamentos com uma conexão somente leitura, consulta a página de status quando a falha parece uma indisponibilidade e responde em seis linhas. Ele não consegue reembolsar nem tentar de novo, porque a conexão só permite GET.

O que o agente pode e não pode fazer

As permissões fazem parte da requisição. Tudo o que não está listado aqui não está disponível para a execução.

ConfiguraçãoPermitido
Conexões
payments: somente GET, em ephemer.al/api/samples/payments-api
WebSomente ephemer.al
ShellDesativado
Arquivosplaybook.md (somente leitura)
Retenção zero de dadosDesativada: o registro é mantido por 30 dias
Orçamento$0.04, um limite rígido
Tempo limite90 segundos

As credenciais nunca entram na máquina: um broker as adiciona a cada chamada e aplica os métodos acima.

O código

Esta é a requisição exata que o exemplo envia. Defina EPHEMERAL_API_KEY com uma chave de membro da sua organização.

curl -X POST $EPHEMERAL_URL/v1/runs \
  -H "Authorization: Bearer $EPHEMERAL_API_KEY" \
  -H "Content-Type: application/json" \
  -H "Idempotency-Key: $(uuidgen)" \
  -d @request.json

Arquivos na requisição

Enviados inline, então nada é carregado antes. O agente vê cada um como um arquivo somente leitura.

playbook.md
playbook.md
# Failed payment playbook

You can only read. The payments connection allows GET, and web access is limited to ephemer.al.

1. GET /payments/{payment_id}. Note status, amount, currency, failure_code and failure_message.
2. GET /payments/{payment_id}/attempts. Check whether earlier attempts failed for the same reason.
3. If failure_code is processor_error or timeout, read https://ephemer.al/api/samples/status for incidents around that time.
4. Decide the cause:
   - card_declined, insufficient_funds, expired_card: the customer's bank or card. Suggest a retry or another card.
   - processor_error, timeout: ours or the processor's. Say whether the status page shows an incident.
   - fraud_review: a risk rule held it. Do not suggest bypassing it.
5. Never guess. If a call fails or a field is missing, say so.

Answer in at most six lines: the cause, the evidence (field and value) and the next step for the support agent.
Do not include card numbers or customer email addresses.
Corpo completo da requisição request.json

O mesmo corpo, com os arquivos inline.

request.json
{
  "prompt": "Find out why the payment in input.payment_id failed. Follow playbook.md exactly. Use only what the data returns and never guess; if a call fails or a field is missing, say so.",
  "input": {
    "payment_id": "pay_123"
  },
  "files": [
    {
      "path": "playbook.md",
      "content": "# Failed payment playbook\n\nYou can only read. The payments connection allows GET, and web access is limited to ephemer.al.\n\n1. GET /payments/{payment_id}. Note status, amount, currency, failure_code and failure_message.\n2. GET /payments/{payment_id}/attempts. Check whether earlier attempts failed for the same reason.\n3. If failure_code is processor_error or timeout, read https://ephemer.al/api/samples/status for incidents around that time.\n4. Decide the cause:\n   - card_declined, insufficient_funds, expired_card: the customer's bank or card. Suggest a retry or another card.\n   - processor_error, timeout: ours or the processor's. Say whether the status page shows an incident.\n   - fraud_review: a risk rule held it. Do not suggest bypassing it.\n5. Never guess. If a call fails or a field is missing, say so.\n\nAnswer in at most six lines: the cause, the evidence (field and value) and the next step for the support agent.\nDo not include card numbers or customer email addresses.\n"
    }
  ],
  "connections": {
    "payments": {
      "type": "http",
      "url": "https://ephemer.al/api/samples/payments-api",
      "auth": {
        "type": "bearer",
        "token": "sample_read_key"
      },
      "allowed_methods": [
        "GET"
      ],
      "instructions": "GET /payments/{id} returns a payment (status, amount in cents, currency, failure_code, failure_message, attempt_count). GET /payments/{id}/attempts returns its attempts."
    }
  },
  "web": {
    "allow": [
      "ephemer.al"
    ],
    "search": false
  },
  "shell": false,
  "timeout_seconds": 90,
  "max_cost_micros": 40000
}

Saiba mais

Exemplos relacionados

esc

Nada corresponde a “”.