Scope is an identity decision, not only a traffic setting
Choosing where a rate limit is enforced determines whose traffic is counted together. A per-user limit assumes the gateway can identify the individual behind each request. A per-application limit counts everything a workload sends, and a per-team limit counts everything a group sends.
Because each scope depends on the identity available at the point of enforcement, the choice of scope follows from what your environment can reliably identify.
How the three scopes compare
| Scope | Primary purpose | Best suited to |
|---|---|---|
| Per user | Fairness between individuals and containment of individual misuse. | Interactive traffic where individual identity is reliable. |
| Per application | Workload isolation and cost attribution for services and agents. | Service workloads. |
| Per team | A shared budget ceiling across a group of users and applications. | Group-level budget control. |
Matching scope to workload and identity availability
- Interactive traffic: use per-user limits where individual identity is reliable.
- Service workloads and cost attribution: use per-application limits.
- Shared budgets: use per-team limits as a ceiling across users and applications.
Agents change what one identity means
Autonomous agents need their own identity and call-chain caps. When an agent acts on behalf of a user, a single request can involve an end user, an agent, an application, and a team. Treating the agent as a distinct identity keeps its traffic from being absorbed into a user or application limit.
This is also why audit records should capture the full identity chain, as described in the logging checklist below.
Layered and hierarchical limits in practice
Layer the limits so the narrowest limit contains misuse and the broadest limit protects shared provider quota. Each layer has a distinct job, and the gateway must stay under the upstream provider ceiling.
Rate limit scope as a layered policy
- Per userFairness between individuals and containment of individual misuse.
- Per applicationWorkload isolation and cost attribution for services and agents.
- Per teamA shared budget ceiling across a group of users and applications.
- Provider ceilingUpstream request and token limits that the gateway must stay under.
Which metrics to enforce
Provider ceilings are expressed as request and token limits, so limits at every layer should be defined with those in mind. Token counts (input, output, and total) and concurrency are the metrics to enforce alongside request counts, and each decision should record the current and maximum values for the limit that was hit.
What each rate-limit decision should log
- The identity chain: end user, agent, application, and team
- The scope and layer that made the decision
- The limit that was hit, with current and maximum values
- Input, output, and total token counts
- The policy version in effect and the decision timestamp
- The retention period, set to match your audit requirements