🛡️ AgentFlare Docs

GET /agents

List agents, get detailed cost breakdowns, and fetch hourly cost data.

GET /agents

Returns all agents that have sent events in the last 24 hours, along with their total cost and LLM call count.

GET /agents
x-api-key: ag_your_key_here

Response

[
  {
    "agent_id": "my-sales-agent",
    "total_cost_usd": 3.14,
    "llm_calls": 42,
    "cost_threshold_usd": 10.0,
    "is_paused": false
  },
  {
    "agent_id": "research-agent",
    "total_cost_usd": 9.87,
    "llm_calls": 156,
    "cost_threshold_usd": 5.0,
    "is_paused": true
  }
]
FieldDescription
agent_idAgent identifier
total_cost_usdCumulative USD cost in the last 24h
llm_callsNumber of llm_call events in the last 24h
cost_threshold_usdConfigured daily budget (if set)
is_pausedWhether the agent is currently paused

GET /agents/events

Returns the most recent events across all agents for the authenticated user.

GET /agents/events?limit=50
x-api-key: ag_your_key_here
Query paramDefaultDescription
limit50Max number of events to return (most recent first)

GET /agents/{agent_id}

Full detail for a single agent: cost breakdown by model, all events in the last 24h, and current config.

GET /agents/my-sales-agent
x-api-key: ag_your_key_here

Response

{
  "agent_id": "my-sales-agent",
  "total_cost_usd": 3.14,
  "llm_calls": 42,
  "total_input_tokens": 58000,
  "total_output_tokens": 24000,
  "cost_threshold_usd": 10.0,
  "is_paused": false,
  "model_breakdown": {
    "gpt-4o": {
      "calls": 30,
      "cost_usd": 2.10,
      "input_tokens": 42000,
      "output_tokens": 18000
    },
    "gpt-4o-mini": {
      "calls": 12,
      "cost_usd": 1.04,
      "input_tokens": 16000,
      "output_tokens": 6000
    }
  },
  "events": [
    {
      "id": "uuid-...",
      "agent_id": "my-sales-agent",
      "event_type": "llm_call",
      "model": "gpt-4o",
      "input_tokens": 800,
      "output_tokens": 400,
      "cost_usd": 0.006,
      "created_at": "2026-04-08T10:23:45Z"
    }
  ]
}

Returns 404 if the agent has no events and no config.


GET /agents/{agent_id}/hourly

Returns cost bucketed by hour for the last 24 hours (or hours param). Used by the dashboard chart.

GET /agents/my-sales-agent/hourly?hours=24
x-api-key: ag_your_key_here
Query paramDefaultDescription
hours24Number of hours to look back

Response

[
  { "hour": "2026-04-07T12:00", "cost_usd": 0.42 },
  { "hour": "2026-04-07T13:00", "cost_usd": 1.15 },
  { "hour": "2026-04-07T14:00", "cost_usd": 0.0 },
  ...
]

Every hour in the window is returned, including zero-cost hours. Hours are in UTC.

On this page