When alerts are triggered or resolved in your AgentMark platform, it sends notifications to your webhook endpoint. This allows you to integrate with your monitoring systems and take appropriate actions.

Notification is only triggered for alerts for which the webhook is configured.

Code

if (event.type === "alert") {
  const alertData = event.data;
  console.log('Alert received:', alertData);
  
  // Process alert based on status and type
  if (alertData.alert.status === "triggered") {
    // Handle triggered alert
  } else if (alertData.alert.status === "resolved") {
    // Handle resolved alert
  }
  
  return NextResponse.json({ message: "Alert processed" });
}

Event Format

{
  "event": {
    "type": "alert",
    "data": {
      "alert": {
        "id": string,
        "currentValue": number,
        "threshold": number,
        "status": "triggered | resolved",
        "timeWindow": string,
        "type": "cost | latency | error_rate"
      },
      "message": string,
      "timestamp": string
    }
  }
}

Alert Types

AgentMark supports three types of alerts:

  1. Cost Alerts

    • Monitor API usage costs
    • Set thresholds for spending
    • Track cost trends
  2. Latency Alerts

    • Monitor response times
    • Set performance thresholds
    • Track latency issues
  3. Error Rate Alerts

    • Monitor error frequencies
    • Set error rate thresholds
    • Track system reliability

Have Questions?

We’re here to help! Choose the best way to reach us: