AI で経費精算を社内規定に照らしてチェックする

エージェントが規定と経費の一覧を読み、違反ごとに、抵触する条項を添えてフラグを立てます。

  • ファイル
  • 予算の上限

実際の実行を見る

2026年10月7日 の実際の実行を再生しています。モデル: openai/gpt-6-luna。

成功run_ae931be673f63d34dfc866fd9f435b33$0.03 のうち $0.00491
  1. 待機中予算 $0.03 を確保
  2. MicroVMmicroVM ready
  3. MicroVMworker started · shell off · web off
  4. ファイルread expense-policy.md
  5. ファイルread expenses.csv
  6. MicroVMmicroVM destroyed
  7. 成功モデル呼び出し 2 回、トークン 3,564記録された出力(英語)
    json
    {
      "violations": [
        {
          "line": 2,
          "clause": 1,
          "reason": "The expense includes wine, and alcohol is never reimbursed."
        },
        {
          "line": 6,
          "clause": 2,
          "reason": "The $52 expense is missing a receipt."
        },
        {
          "line": 7,
          "clause": 5,
          "reason": "The Sunday ride has no note naming a business reason."
        },
        {
          "line": 9,
          "clause": 6,
          "reason": "This expense is an exact duplicate of line 10."
        },
        {
          "line": 10,
          "clause": 6,
          "reason": "This expense is an exact duplicate of line 9."
        },
        {
          "line": 5,
          "clause": 4,
          "reason": "$410 for two nights is $205 per night, exceeding the $180 limit."
        },
        {
          "line": 12,
          "clause": 4,
          "reason": "$205 for one night exceeds the $180 per-night limit."
        }
      ],
      "needs_human": [
        {
          "line": 2,
          "question": "How many people were covered by this meal, so the $60 per-person daily limit can be checked?"
        },
        {
          "line": 3,
          "question": "Was this 11-hour business-class flight approved in advance by a director?"
        },
        {
          "line": 6,
          "question": "Was the airport taxi taken for a business trip?"
        },
        {
          "line": 7,
          "question": "Was this ride part of a business trip?"
        }
      ],
      "compliant_lines": 4
    }
  8. ワーカーを破棄$0.00491 を請求、$0.02509 を解放
モデル $0.00091 · Web $0.00 · コンピュート $0.004

自分で実行する

リクエスト全体が入力された状態で、サンプルをプレイグラウンドで開きます。実行はご自身のアカウントで、表示された予算の範囲内で、同じ読み取り専用のサンプルシステムに対して行われます。

このサンプルの予算: $0.03

仕組み

規定も経費の明細も、読み取り専用のファイルです。回答には、フラグごとに行番号と条項番号が示されるので、確認者は数秒で検証できます。規定に沿っている明細は挙げられません。

エージェントにできること、できないこと

権限はリクエストの一部です。ここに挙げていないものは、実行では利用できません。

設定許可
接続なし
Webオフ
シェルオフ
ファイルexpense-policy.md, expenses.csv(読み取り専用)
ゼロデータ保持オフ: 記録は 30 日間保存されます
予算$0.03、厳格な上限
タイムアウト60 秒

認証情報がマシンに入ることはありません。ブローカーが各呼び出しに認証情報を付与し、上記のメソッドだけを通します。

コード

サンプルが送信する正確なリクエストです。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

リクエストに含まれるファイル

インラインで渡すため、事前にアップロードする必要はありません。エージェントには、それぞれが読み取り専用のファイルとして見えます。

expense-policy.md
expense-policy.md
# Expense policy

1. Meals: at most 60 USD per person per day. Alcohol is never reimbursed.
2. Every expense of 25 USD or more needs a receipt.
3. Flights: economy class only, unless the flight is longer than 8 hours and a director approved it in advance.
4. Hotels: at most 180 USD per night.
5. Taxis and rides: only for business trips; weekend rides need a note naming the business reason.
6. The same expense must not be claimed twice.
expenses.csv
expenses.csv
line,date,employee,category,description,amount_usd,receipt,approved_by
1,2026-09-14,a.nguyen,meal,Team lunch (4 people),88.00,yes,
2,2026-09-14,a.nguyen,meal,Wine with client dinner,64.00,yes,
3,2026-09-15,b.keller,flight,Frankfurt to Tokyo business class (11h),4210.00,yes,
4,2026-09-15,b.keller,flight,Tokyo to Frankfurt economy (11h),980.00,yes,
5,2026-09-16,c.ortiz,hotel,Hotel Osaka 2 nights,410.00,yes,
6,2026-09-17,c.ortiz,taxi,Airport taxi,52.00,no,
7,2026-09-20,d.smith,taxi,Sunday ride home,31.00,yes,
8,2026-09-21,a.nguyen,meal,Breakfast,14.50,no,
9,2026-09-22,e.rossi,flight,Milan to Berlin economy,210.00,yes,
10,2026-09-22,e.rossi,flight,Milan to Berlin economy,210.00,yes,
11,2026-09-23,f.hall,meal,Dinner (1 person),47.00,yes,
12,2026-09-24,c.ortiz,hotel,Hotel Kyoto 1 night,205.00,yes,
リクエスト本文の全体 request.json

同じ本文を、ファイルをインラインにした形で示します。

request.json
{
  "prompt": "Check every line of expenses.csv against expense-policy.md. Reply with one JSON object and nothing else: {\"violations\": [{\"line\": number, \"clause\": number, \"reason\": string}], \"needs_human\": [{\"line\": number, \"question\": string}], \"compliant_lines\": number}. Report a violation only when the file proves it. When a rule cannot be checked from the data (for example advance approval), put the line in needs_human instead of guessing. A line can appear more than once if it breaks several clauses.",
  "files": [
    {
      "path": "expense-policy.md",
      "content": "# Expense policy\n\n1. Meals: at most 60 USD per person per day. Alcohol is never reimbursed.\n2. Every expense of 25 USD or more needs a receipt.\n3. Flights: economy class only, unless the flight is longer than 8 hours and a director approved it in advance.\n4. Hotels: at most 180 USD per night.\n5. Taxis and rides: only for business trips; weekend rides need a note naming the business reason.\n6. The same expense must not be claimed twice.\n"
    },
    {
      "path": "expenses.csv",
      "content": "line,date,employee,category,description,amount_usd,receipt,approved_by\n1,2026-09-14,a.nguyen,meal,Team lunch (4 people),88.00,yes,\n2,2026-09-14,a.nguyen,meal,Wine with client dinner,64.00,yes,\n3,2026-09-15,b.keller,flight,Frankfurt to Tokyo business class (11h),4210.00,yes,\n4,2026-09-15,b.keller,flight,Tokyo to Frankfurt economy (11h),980.00,yes,\n5,2026-09-16,c.ortiz,hotel,Hotel Osaka 2 nights,410.00,yes,\n6,2026-09-17,c.ortiz,taxi,Airport taxi,52.00,no,\n7,2026-09-20,d.smith,taxi,Sunday ride home,31.00,yes,\n8,2026-09-21,a.nguyen,meal,Breakfast,14.50,no,\n9,2026-09-22,e.rossi,flight,Milan to Berlin economy,210.00,yes,\n10,2026-09-22,e.rossi,flight,Milan to Berlin economy,210.00,yes,\n11,2026-09-23,f.hall,meal,Dinner (1 person),47.00,yes,\n12,2026-09-24,c.ortiz,hotel,Hotel Kyoto 1 night,205.00,yes,\n"
    }
  ],
  "shell": false,
  "timeout_seconds": 60,
  "max_cost_micros": 30000
}

さらに読む

関連するサンプル

esc

「」に一致する項目はありません。