AI による在庫不足アラートと発注の提案

エージェントが在庫と 8 週間分の販売実績を読み、まもなく在庫が切れる SKU を挙げて、発注の提案をします。

  • 読み取り専用の接続
  • スケジュール実行
  • コールバック
  • 予算の上限

実際の実行を見る

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

入力
{
  "threshold_days": 14
}
成功run_140400c56f2633ed9b2e58f2b62a6e23$0.03 のうち $0.004414
  1. 待機中予算 $0.03 を確保
  2. MicroVMmicroVM ready
  3. MicroVMworker started · shell off · web off
  4. 接続ops GET /inventory
  5. 結果ops GET → 200
  6. MicroVMmicroVM destroyed
  7. 成功モデル呼び出し 2 回、トークン 4,167記録された出力(英語)
    SKUStockDaily rate (units/day)Days of coverReorder quantity
    TEE-BLK-M645.8610.9230
    CAP-NVY-0191.297.070
    NTBK-A5-0103.540.00

    Human look:

    • NTBK-A5-01: Sales fell from 26 to 14 in the latest week while stock is 0; the data doesn’t establish the cause.
    • BAG-CNV-01: Sales declined across the last four weeks (8, 6, 5, 4) despite stock of 250.
  8. ワーカーを破棄$0.004414 を請求、$0.025586 を解放
モデル $0.000814 · Web $0.00 · コンピュート $0.0036

自分で実行する

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

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

仕組み

読み取り専用の在庫 API から、在庫、未処理の注文、リードタイム、週次の販売数を読み、指定されたルールを適用します。回答は購買担当者がそのまま動ける短い表で、検算できるよう数値も示されます。

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

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

設定許可
接続
ops: GET のみ、ephemer.al/api/samples/ops-api へ
Webオフ
シェルオフ
ファイルなし
ゼロデータ保持オフ: 記録は 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
リクエスト本文の全体 workflow.json

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

workflow.json
{
  "prompt": "Read GET /inventory on the ops connection. For each SKU, daily_rate is the average of the last 4 values of weekly_sales divided by 7, and days_of_cover is stock divided by daily_rate (treat a daily_rate of 0 as unlimited cover). Flag every SKU whose days_of_cover is below input.threshold_days. For each flagged SKU suggest a reorder quantity: daily_rate times (lead_time_days plus 28), minus stock, minus on_order, rounded up to the next 10, and never below 0 (when stock plus on_order already covers it, the reorder quantity is 0). Reply in Markdown: a table with SKU, stock, daily_rate, days_of_cover and reorder quantity, then one line per SKU that deserves a human look (for example a sales dip caused by a stockout). Use only what the data returns and never guess; if a call fails or a field is missing, say so.",
  "connections": {
    "ops": {
      "type": "http",
      "url": "https://ephemer.al/api/samples/ops-api",
      "auth": {
        "type": "bearer",
        "token": "sample_read_key"
      },
      "allowed_methods": [
        "GET"
      ],
      "instructions": "GET /inventory returns as_of, the week start dates, and items with sku, name, stock, on_order, lead_time_days, unit_cost_usd and weekly_sales (units per week, oldest first, the last entry is the most recent week)."
    }
  },
  "shell": false,
  "timeout_seconds": 60
}

このサンプルはスケジュールで実行されます。Europe/Berlin の 0 8 * * 1-5。スケジュールは保存済みのワークフローを開始するため、まずリクエストをワークフローとして保存し、その後スケジュールを作成してください。

さらに読む

関連するサンプル

esc

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