Rate Limits and Budgets
For Agent-to-Agent (A2A) traffic, the caller API key remains the traffic-control boundary. A2A calls share the key's request limits, concurrency limits, and budgets with model traffic, but they do not consume model tokens.
There is no separate A2A rate-limit or budget resource. Configure the caller API key, then verify the behavior on the A2A path.
Where Controls Apply
The gateway applies rate-limit and budget checks to each JSON-RPC call at /a2a/<agent>. Agent-card discovery at /a2a/<agent>/.well-known/agent-card.json is not rate-limited. A throttled caller can still fetch the card of an agent its key allows, but cannot invoke the agent again until the window resets.
When a rate limit or budget rejects an A2A call, AISIX returns before contacting the upstream agent and still records the rejected call as a usage event.
Because an A2A call resolves no model, model-scoped rate-limit policies do not apply to it. Request-level controls do apply, including the caller API key's inline rate_limit and policies scoped to the API key, team, member, or each member in a team.
Applicable Rate Limits
A caller API key's rate_limit object can define request-rate, token-rate, and concurrency limits. On the A2A path, only request-rate and concurrency limits directly meter A2A calls:
| Limit | Applies to A2A calls | Notes |
|---|---|---|
rps, rpm, rph, rpd | Yes | Each /a2a/<agent> call counts as one request in the matching window. |
concurrency | Yes | Each in-flight A2A call holds one concurrency permit until it returns. |
tpm, tpd | No | A2A calls carry no model tokens, so they do not add to token windows. If the caller key's model traffic already exhausted a token window, the key's A2A calls are still rejected with HTTP 429 until the window resets. |
Each field is optional. When a field is omitted, AISIX does not enforce that limit.
Use request-rate limits or concurrency to throttle A2A call volume. A token limit alone does not cap A2A calls.
For the full rate-limit field reference and counter-storage options, see Rate Limits.
Set a Caller Rate Limit
Update the caller API key with a rate_limit. The following self-hosted example keeps the key agent-only and limits it to one A2A call per minute. Include any existing key fields that should remain; the Admin API PUT replaces the key resource.
# Replace with your values
export AISIX_ADMIN_KEY="YOUR_ADMIN_KEY"
curl -sS -X PUT "http://127.0.0.1:3001/admin/v1/apikeys/YOUR_API_KEY_ID" \
-H "Authorization: Bearer ${AISIX_ADMIN_KEY}" \
-H "Content-Type: application/json" \
-d '{
"key_hash": "'"${AISIX_API_KEY_HASH}"'",
"allowed_models": [],
"allowed_agents": ["invoice-processor"],
"rate_limit": {
"rpm": 1
}
}'
❶ Use an empty model allowlist when the key is only for A2A traffic.
❷ rpm: 1 limits this caller API key to one request per minute.
To verify the limit, call the agent twice within the same minute:
export AISIX_API_KEY="sk-demo-caller"
for call in 1 2; do
curl -sS -o /tmp/a2a-rate-limit-${call}.json -w "call ${call}: HTTP %{http_code}\n" \
-X POST "http://127.0.0.1:3000/a2a/invoice-processor" \
-H "Authorization: Bearer ${AISIX_API_KEY}" \
-H "Content-Type: application/json" \
-d '{
"jsonrpc": "2.0",
"id": "req-rate-limit",
"method": "message/send",
"params": {
"message": {
"role": "user",
"parts": [{"kind": "text", "text": "Review this vendor invoice."}],
"messageId": "msg-rate-limit"
}
}
}'
done
The command should print a successful status for the first call and HTTP 429 for the second call. The second call is rejected before AISIX contacts the upstream agent. Fetching the agent card still succeeds while the caller is throttled.
In managed deployments, configure the same caller API key limit in the AISIX managed control plane.
Apply Budgets in Managed Deployments
Budgets are configured in the AISIX managed control plane and enforced by the managed gateway. When a budget that covers the caller API key is exhausted, the gateway rejects that key's A2A calls with a budget_exceeded error before contacting the upstream agent. This is the same check the model path runs.
A2A calls carry no token cost, so they do not add to token-based spend themselves. A budget exhausted by the caller's model traffic still blocks that caller's A2A calls, because both share one caller API key and one budget. See Budgets for budget targets, the rejection response, and caching behavior.
In self-hosted deployments, use caller API key rate limits to govern A2A call volume. For budget configuration details, see Budgets.
Next Steps
You have now applied caller API key controls to A2A traffic. Use these guides to observe the result or refine the shared traffic-control settings:
- Observability: review the usage events and metrics emitted by A2A calls.
- Control agent access: scope caller API keys to specific agents or every agent.
- Rate Limits: review the full rate-limit field reference and counter-storage options.
- Budgets: configure budget targets, rejection behavior, and cache settings.