Category Trends Agent
Macro Demand Aggregation & Category Momentum Analysis · POST /v1/agent/trends/run

Category: Knowledge Aggregation · Execution Model: Deterministic, Batch-Oriented, Append-Only

Purpose

The Category Trends Agent aggregates normalized experiential events into weekly, city-level category trend metrics. It transforms individual session-level signals into macro indicators of category momentum, pricing behavior, attendance density, and growth rate. These aggregated signals serve as a core input for downstream learning, geospatial heat mapping, demand pooling, and strategic expansion decisions.

Expected Inputs

  • weekOverride ISODate
    Optional override for the aggregation window. If omitted, the agent aggregates events for the current calendar week.

Outputs

  • HTTP Response
    {
      "success": "boolean",
      "message": "string",
      "inserted": "number"
    }
  • Side Effect
    Reads from events_normalized collection
  • Side Effect
    Writes CategoryTrend documents to category_trends collection

Responsibilities

Lifecycle

Downstream Dependencies

Guarantees

Failure Model

If no normalized events are found for the aggregation window, the agent exits successfully without writing any records. If database access fails or aggregation errors occur, the agent returns a 500 response and no partial trend documents are persisted.

Internal State

{
  "persistence": [
    "events_normalized",
    "category_trends"
  ],
  "aggregationRules": [
    "Weekly window (startOfWeek → endOfWeek)",
    "Grouping key = category + city",
    "Append-only trend records"
  ]
}

Sample cURL


curl -X POST https://api.whook.ai/v1/agent/trends/run \
  -H "Content-Type: application/json"