Skip to content

feat: Per-role default token limits for agent interactions #144

Closed as not planned

Description

@vybe

Summary

Admins need a way to cap how many tokens different user roles can consume per agent request. This prevents runaway costs from public/operator users while keeping full power available to creators and admins.

Depends On

Proposed Behaviour

Each role has a configurable default max_tokens cap applied to all agent chat/task calls made by users of that role. Admins are uncapped.

Role Suggested Default
admin unlimited
creator unlimited (or high cap, e.g. 16k)
operator e.g. 8k
user e.g. 2k

The cap is enforced server-side before the request reaches the agent — the agent receives max_tokens clamped to the role's limit.

Acceptance Criteria

Backend

  • New role_token_limits settings table (or JSON blob in system settings): { "creator": null, "operator": 8192, "user": 2048 }
  • GET /api/settings/token-limits — read current limits (admin only)
  • PUT /api/settings/token-limits — update limits (admin only)
  • Chat/task execution paths read the calling user's role and clamp max_tokens accordingly
  • admin and creator roles default to null (no limit)

Frontend / Settings

  • New "Token Limits" section in Settings (admin only)
  • Per-role input fields showing current limits (blank = unlimited)
  • Save button with confirmation

Notes

  • Token limits apply to requests made by a user of that role, not to the agent itself
  • Agent-to-agent calls (orchestrator → worker) are unaffected — those use the agent's own context budget
  • This is a per-request cap, not a rolling budget (rolling budgets are a future concern)

Activity

  1. added
    enhancement
    priority-p1
    on Mar 16, 2026
  2. added
    complexity-low
    theme-devex
    on Jun 3, 2026
  3. added
    type-feature
    on Jun 3, 2026
  4. vybe commented on Jun 10, 2026

    @vybe
    ContributorAuthor

    Closing as not planned — aged ~3 months with no activity, no design, and no started work (per the close-aged-never-started-P1 backlog policy). Re-open with a concrete use case if per-role token limits become a priority.

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    complexity-lowenhancementpriority-p1theme-devextype-feature

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions