Base URL: http://127.0.0.1:3141
Returns complete dashboard data (agents, heartbeats, budget, trends).
Response:
{
"agents": [...],
"dailySummary": [...],
"budget": {...},
"trendData": [...]
}List all agents with summary statistics.
Response:
[
{
"id": "promo-assistant-reddit",
"name": "Reddit Assistant",
"emoji": "🤖",
"model": "sonnet-4-5",
"totalCost": 0.1234,
"totalErrors": 2,
"heartbeatCount": 45,
"lastRun": 1707756800000,
"avgCacheHit": 72,
"contextUsed": 45000,
"contextLimit": 200000
}
]Get detailed information for a specific agent.
Parameters:
:id- Agent ID (e.g.,promo-assistant-reddit)
Example:
curl http://127.0.0.1:3141/api/agent/promo-assistant-redditResponse: Full agent object with all heartbeats and statistics.
Query heartbeats with filters.
Query Parameters:
agent- Filter by agent ID (optional)limit- Number of heartbeats to return (default: 10)errors- Set totrueto only show heartbeats with errorsminCost- Minimum cost threshold (e.g.,0.001)
Examples:
# Get latest 5 heartbeats for Reddit agent
curl "http://127.0.0.1:3141/api/heartbeats?agent=promo-assistant-reddit&limit=5"
# Get heartbeats with errors
curl "http://127.0.0.1:3141/api/heartbeats?errors=true"
# Get expensive heartbeats (cost > $0.01)
curl "http://127.0.0.1:3141/api/heartbeats?minCost=0.01&limit=20"Response:
[
{
"agent": "promo-assistant-reddit",
"agentName": "Reddit Assistant",
"startTime": "2026-02-12T10:30:00Z",
"endTime": "2026-02-12T10:31:45Z",
"durationMs": 105000,
"cost": 0.0234,
"steps": 8,
"errors": 0,
"cacheHitRate": 75,
"context": 48000,
"summary": "Found 3 trending posts, commented on 2",
"wasteFlags": []
}
]Get the most recent heartbeat for a specific agent.
Query Parameters:
agent- Agent ID (required)errors_only- Set totrueto show only steps with errors (optional)
Examples:
# Get full latest heartbeat
curl "http://127.0.0.1:3141/api/latest?agent=promo-assistant-threads"
# Get only error steps from latest heartbeat
curl "http://127.0.0.1:3141/api/latest?agent=promo-assistant-threads&errors_only=true"Response: Full heartbeat object with all steps and details (or only error steps if filtered).
Get a specific heartbeat by index (matches UI hash navigation).
Query Parameters:
agent- Agent ID (required)indexorhb- Heartbeat index (0 = latest, 1 = second-to-latest, etc.)errors_only- Set totrueto show only steps with errors (optional)
Examples:
# Get latest heartbeat (same as /api/latest)
curl "http://127.0.0.1:3141/api/heartbeat?agent=promo-assistant-reddit&index=0"
# Get second-to-latest heartbeat (matches UI #agent=promo-assistant-reddit&hb=1)
curl "http://127.0.0.1:3141/api/heartbeat?agent=promo-assistant-reddit&hb=1"
# Get third heartbeat, showing only error steps
curl "http://127.0.0.1:3141/api/heartbeat?agent=promo-assistant-reddit&index=2&errors_only=true"Response: Full heartbeat object with all steps and details (or only error steps if filtered).
When errors_only=true, the response includes:
filteredToErrors: true- Indicates filtering is activetotalSteps- Original total number of steps before filtering
Note: This endpoint uses the same indexing as the UI hash navigation:
http://127.0.0.1:3141/#agent=promo-assistant-reddit&hb=0→/api/heartbeat?agent=promo-assistant-reddit&hb=0
Get current budget status and projections.
Example:
curl http://127.0.0.1:3141/api/budgetResponse:
{
"daily": 5.00,
"monthly": 100.00,
"todayCost": 2.34,
"avg7Days": 3.12,
"projectedMonthly": 93.60,
"dailyPct": 47,
"monthlyPct": 94,
"status": "ok"
}Status values:
ok- Under 70% of daily budgetwarning- 70-90% of daily budgetover- Over 90% of daily budget
Get daily cost breakdown.
Query Parameters:
days- Number of days to return (default: 7)
Example:
curl "http://127.0.0.1:3141/api/daily?days=14"Response:
[
{
"date": "2026-02-12",
"cost": 2.34,
"heartbeats": 45,
"byAgent": {
"promo-assistant-reddit": 0.89,
"promo-assistant-threads": 1.45
}
}
]Get overall system statistics.
Example:
curl http://127.0.0.1:3141/api/statsResponse:
{
"totalAgents": 10,
"totalCost": 45.67,
"totalHeartbeats": 892,
"totalErrors": 23,
"avgCostPerHeartbeat": 0.0512,
"budget": {...},
"dailySummary": [...]
}Export heartbeat data as CSV or JSON.
Query Parameters:
format-jsonorcsv(default: json)days- Number of days to export (default: 7)
Examples:
# Export last 7 days as CSV
curl "http://127.0.0.1:3141/api/export?format=csv" -o tokens.csv
# Export last 30 days as JSON
curl "http://127.0.0.1:3141/api/export?format=json&days=30" -o tokens.json#!/bin/bash
budget=$(curl -s http://127.0.0.1:3141/api/budget)
status=$(echo $budget | jq -r '.status')
if [ "$status" = "over" ]; then
echo "Budget exceeded, skipping run"
exit 1
ficurl -s "http://127.0.0.1:3141/api/latest?agent=promo-assistant-reddit" | jq '{
cost: .totalCost,
errors: .errorCount,
duration: .durationMs,
summary: .summary
}'errors=$(curl -s "http://127.0.0.1:3141/api/heartbeats?agent=promo-assistant-threads&limit=10&errors=true" | jq 'length')
echo "Recent errors: $errors"curl -s "http://127.0.0.1:3141/api/daily?days=1" | jq '.[0] | {
date,
cost,
heartbeats,
agents: (.byAgent | keys)
}'