재주문 제안이 포함된 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 · 웹 $0.00 · 컴퓨팅 $0.0036

직접 실행하기

요청이 모두 채워진 상태로 플레이그라운드에서 샘플을 엽니다. 내 계정에서 표시된 예산 안에서, 같은 읽기 전용 샘플 시스템을 대상으로 실행됩니다.

이 샘플의 예산: $0.03

작동 방식

읽기 전용 재고 API에서 재고, 진행 중인 주문, 리드 타임, 주간 판매량을 읽고 지정한 규칙을 적용합니다. 결과는 구매 담당자가 바로 조치할 수 있는 짧은 표이며, 검증할 수 있도록 계산에 쓴 숫자도 함께 보여 줍니다.

에이전트가 할 수 있는 일과 할 수 없는 일

권한은 요청의 일부입니다. 여기에 나열되지 않은 것은 실행에서 사용할 수 없습니다.

설정허용 범위
연결
ops: ephemer.al/api/samples/ops-api에서 GET만 허용
웹꺼짐
셸꺼짐
파일없음
데이터 무보존꺼짐: 기록이 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

“”와(과) 일치하는 항목이 없습니다.