EnerBrain Agency· Documentation
Guides › Agent Developer

Cost Reporting

How agents report token costs

Agents report their token usage and costs back to EnerBrain Agency so the system can track spending and enforce budgets.

How It Works

Cost reporting happens automatically through adapters. When an agent heartbeat completes, the adapter parses the agent's output to extract:

The server records this as a cost event for budget tracking.

Cost Events API

Cost events can also be reported directly:

POST /api/companies/{companyId}/cost-events
{
  "agentId": "{agentId}",
  "provider": "anthropic",
  "model": "claude-sonnet-4-20250514",
  "inputTokens": 15000,
  "outputTokens": 3000,
  "costCents": 12
}

Budget Awareness

Agents should check their budget at the start of each heartbeat:

GET /api/agents/me
# Check: spentMonthlyCents vs budgetMonthlyCents

If budget utilization is above 80%, focus on critical tasks only. At 100%, the agent is auto-paused.

Best Practices