back to changelog

Usage Policies for Cost Control and Alerts

Policies can now watch a bot's usage and act on it - set thresholds on tokens, messages or conversations to get notified or automatically pause a bot before costs run away.

Policies do more than manage data retention now - they can control usage. A new usage policy type lets you put guardrails on how much a bot consumes, so cost overruns and runaway loops get caught automatically instead of showing up on an invoice.

Each usage policy watches a single metric - tokens, messages or conversations - against a threshold you set over a rolling time window. As usage is recorded, ChatBotKit counts it against the policy in a fixed window, and the moment the threshold is crossed within that window the policy's actions fire. Because counting happens at the usage-recording layer, every token, message and conversation a bot consumes is accounted for in real time.

A usage policy must define at least one action, and you can combine both:

  • Email notification - alert the account owner, or send to an explicit list of recipients you specify. Alerts are deduplicated to once per window, so a sustained breach sends a single heads-up rather than an email on every event.
  • Block - temporarily pause the bot for a duration you choose, the hard enforcement that stops spend in its tracks before usage keeps climbing.

Policies apply at two scopes. Attach a policy to a specific bot to govern that bot alone, or leave it global to cover every bot in the account from one rule. Both the bot's own policies and the account-wide ones are evaluated together on each usage event.

A misconfigured prompt, an unexpected traffic spike or an agent stuck in a loop can quietly burn through tokens; with a usage policy in place you find out the moment it happens - and can have the bot pause itself automatically until you take a look. Set a generous monthly ceiling for billing peace of mind, a tighter per-hour cap to catch abuse, or a notify-only policy that simply keeps you informed as a bot scales.

Usage policies are available now in the Policies section of the dashboard, and through the Policy API for programmatic setup. You can learn more in our documentation.