Skip to content

feat: per-agent daily token limit enforcement (fails open) - #102

Open
fepfitra wants to merge 6 commits into
anvie:mainfrom
fepfitra:feat/token-limit-daily-upstream
Open

feat: per-agent daily token limit enforcement (fails open)#102
fepfitra wants to merge 6 commits into
anvie:mainfrom
fepfitra:feat/token-limit-daily-upstream

Conversation

@fepfitra

@fepfitra fepfitra commented Aug 7, 2026

Copy link
Copy Markdown
Contributor

Per-agent daily token cap for LLM usage, using the existing token_monitor telemetry.

  • handle_message blocks turns when the agent's today-token sum >= limit (super agents exempt)
  • Config: per-agent token_limit_daily column (NULL = env default EVONIC_TOKEN_LIMIT_DAILY_DEFAULT, default 500k tokens/day)
  • Emits limit_hit event on block; fails open on any limiter error (never breaks the agent path)
  • Reads the existing token_monitor token_usage table — no new storage

Verified: token_monitor tests pass (4), block logic tested end-to-end (over/under/super/custom limit), schema migration applies at startup.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant