AI による決済失敗の調査:この決済はなぜ失敗したのか
エージェントが決済、その試行履歴、決済事業者のステータスページを読み、原因とサポートチームの次の対応を説明します。
- ファイル
- 読み取り専用の接続
- Web
- コールバック
- 予算の上限
実際の実行を見る
2026年10月7日 の実際の実行を再生しています。モデル: openai/gpt-6-luna。
{
"payment_id": "pay_123"
}- 待機中予算 $0.04 を確保
- MicroVMmicroVM ready
- MicroVMworker started · shell off · web on
- ファイル
read playbook.md - 接続payments GET /payments/pay_123
- 結果
payments GET → 200 - 接続payments GET /payments/pay_123/attempts
- 結果
payments GET → 200 - MicroVMmicroVM destroyed
- 成功モデル呼び出し 4 回、トークン 6,787記録された出力(英語)
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. - ワーカーを破棄$0.004055 を請求、$0.035945 を解放
自分で実行する
リクエスト全体が入力された状態で、サンプルをプレイグラウンドで開きます。実行はご自身のアカウントで、表示された予算の範囲内で、同じ読み取り専用のサンプルシステムに対して行われます。
このサンプルの予算: $0.04
仕組み
決済 ID と短いプレイブックを渡すだけです。読み取り専用の接続で決済 API を呼び出し、障害の可能性があればステータスページを確認して、6 行で回答します。接続が許可するのは GET のみなので、返金も再試行もできません。
エージェントにできること、できないこと
権限はリクエストの一部です。ここに挙げていないものは、実行では利用できません。
| 設定 | 許可 |
|---|---|
| 接続 | payments: GET のみ、ephemer.al/api/samples/payments-api へ |
| Web | ephemer.al のみ |
| シェル | オフ |
| ファイル | playbook.md(読み取り専用) |
| ゼロデータ保持 | オフ: 記録は 30 日間保存されます |
| 予算 | $0.04、厳格な上限 |
| タイムアウト | 90 秒 |
認証情報がマシンに入ることはありません。ブローカーが各呼び出しに認証情報を付与し、上記のメソッドだけを通します。
コード
サンプルが送信する正確なリクエストです。EPHEMERAL_API_KEY には、組織のメンバーキーを設定してください。
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リクエストに含まれるファイル
インラインで渡すため、事前にアップロードする必要はありません。エージェントには、それぞれが読み取り専用のファイルとして見えます。
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.
リクエスト本文の全体 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
}