Usage Policies
Usage policies 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 policy watches a single metric - tokens, messages, or conversations - against a threshold you set over a rolling time window, and the moment the threshold is crossed 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, so enforcement is immediate.
What You Can Do
- Watch a metric: Track tokens, messages, or conversations against a threshold over a rolling window.
- Send alerts: Email the account owner or a specific list of recipients, deduplicated to once per window so a sustained breach sends a single heads-up.
- Block automatically: Temporarily pause a bot for a duration you choose to stop spend before usage keeps climbing.
- Scope policies: Attach a policy to a single bot, or leave it global to cover every bot in the account.
- Configure programmatically: Manage policies through the dashboard or the Policy API.
How It Works
As usage is recorded, ChatBotKit counts it against each policy in a fixed window. A policy must define at least one action, and you can combine alerting and blocking. Both a bot's own policies and account-wide policies are evaluated together on each usage event, so a misconfigured prompt, a traffic spike, or an agent stuck in a loop is caught the moment it happens - and the bot can pause itself automatically until you take a look.
Setup
Open the Policies section of the dashboard and create a usage policy. Choose the metric, threshold, and time window, then add an email action, a block action, or both. Attach it to a specific bot or leave it global. The Policy API is available for programmatic setup.
Practical Uses
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 pair well with usage analytics, giving you both visibility into consumption and automatic guardrails against overspend.