Integration Guide

Get up and running in under 2 minutes.

1Quick Start

python
# Install
pip install agent-monitor

# Initialize
from agent_monitor import Monitor

monitor = Monitor(api_key="aw_live_your_key_here")

# Track events
monitor.track("my-agent", event="task_complete", metadata={
    "tokens": 150,
    "latency_ms": 340,
    "model": "gpt-4"
})

# Heartbeat (call periodically)
monitor.heartbeat("my-agent")

# Error tracking
try:
    result = agent.run(task)
    monitor.track("my-agent", event="success", metadata={"result": result})
except Exception as e:
    monitor.track("my-agent", event="error", metadata={"error": str(e)})

2Webhook Configuration

Receive real-time event notifications via webhooks. Configure in your dashboard or via API:

POST /api/v1/webhooks
{
  "url": "https://your-server.com/webhooks/agentwatch",
  "events": ["agent.down", "agent.error", "agent.budget_exceeded"],
  "secret": "whsec_your_signing_secret",
  "headers": {
    "X-Custom-Header": "value"
  }
}
Available Events
agent.upagent.downagent.erroragent.recoveredagent.budget_exceededagent.latency_spike

3Alert Rules

Define custom alert rules using simple YAML syntax or the dashboard UI:

agentwatch.yaml
rules:
  - name: "Agent Down"
    condition: heartbeat_missing > 60s
    severity: critical
    notify: [slack, email]

  - name: "High Error Rate"
    condition: error_rate > 5%
    window: 5m
    severity: warning
    notify: [slack]

  - name: "Budget Alert"
    condition: daily_tokens > 500000
    severity: warning
    notify: [email]

4API Reference

POST/api/v1/trackSend an event for an agent
POST/api/v1/heartbeatSend agent heartbeat
GET/api/v1/agentsList all agents
GET/api/v1/agents/:id/metricsGet agent metrics
GET/api/v1/alertsList recent alerts
POST/api/v1/webhooksCreate webhook endpoint