{
  "workflow_id": "competitor-price-tracker",
  "description": "Pulls current cryptocurrency price or competitor pricing data, extracts it, and logs a historical entry to a CSV file.",
  "tasks": [
    {
      "id": "fetch_pricing",
      "trigger": "manual",
      "action_type": "http_request",
      "target": "https://api.coingecko.com/api/v3/simple/price?ids=bitcoin,ethereum&vs_currencies=usd",
      "payload": {
        "method": "GET"
      },
      "next": "ai_format_csv_row"
    },
    {
      "id": "ai_format_csv_row",
      "trigger": "after:fetch_pricing",
      "action_type": "ai_call",
      "target": "local",
      "payload": {
        "model": "llama3.2:3b",
        "system": "You are a data formatting assistant. Output ONLY a single line of CSV text containing timestamp, bitcoin price, and ethereum price. Do NOT include markdown code blocks, do NOT include explanations, do NOT include headings.",
        "prompt": "Current timestamp: {{current_time}}\nRaw prices: {{prev_output}}\n\nFormat this into a single CSV row: Timestamp,BTC_USD,ETH_USD"
      },
      "next": "append_to_csv"
    },
    {
      "id": "append_to_csv",
      "trigger": "after:ai_format_csv_row",
      "action_type": "file_op",
      "target": "{{desktop_dir}}\\price_history.csv",
      "payload": {
        "operation": "write",
        "content": "{{prev_output}}"
      },
      "next": "notify_done"
    },
    {
      "id": "notify_done",
      "trigger": "after:append_to_csv",
      "action_type": "notify",
      "target": "stdout",
      "payload": {
        "message": "\u2713 Price history logged to Desktop: price_history.csv"
      }
    }
  ]
}
