Skip to content

feat: Token velocity alert — detect runaway agent loops #71

@vivekchand

Description

@vivekchand

Overview

Detect and alert when token consumption rate spikes abnormally — the classic sign of an agent stuck in a loop.

Detection logic

  • Sliding 2-minute window: if tokens > configurable threshold (default: 5k/2min), trigger alert
  • Consecutive tool-call chains with no human turn > N steps — flag as potential loop
  • Cost velocity: if $X spent in < Y minutes, alert

Alert channels

  • In-dashboard banner (red, dismissible)
  • Browser notification
  • Telegram/email via OpenClaw channel (cloud tier)

Configuration

{ "velocity_alert": { "tokens_per_2min": 5000, "cost_per_5min": 0.50 } }

Why

Real incident from the community: user hit $60 in minutes from a runaway model/thread bug. Velocity tracking catches this; total tracking does not.

References

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions