Token management policies
One LLM request can cost a dozen tokens or over 100,000, so counting requests doesn't control spend. Watch Agent Gateway classify a request into a token group, check its budget before the call, count the real tokens after it, and stop a runaway loop with HTTP 429.
9 minPro
Checking your access…
Inside this lesson
- An animation you play, pause and step through, with each part saying what it is doing.
- The real code beside it, with the lines for each step lit up.
- Practice mode, where you route each message yourself, and a short quiz.
- About 9 minutes.
Written from the official documentation
In this module: Agent Gateway and policies
- Agent Gateway overviewOne governed path for all agent traffic.Pro
- Set up Agent GatewayManaged gateway, VPC connectivity and routing.Pro
- Route Agent Runtime traffic through the gatewayPutting deployed agents behind policy.Pro
- Delegate authorizationLetting an external system decide who gets in.Pro
- Extensible policiesService extensions on the gateway.Pro
- Unified Access PoliciesIAM policies and CEL conditions for agents.Pro
- Semantic governance policiesRules about what agents may say and do.Pro
- Token management policiesControlling token spend.Pro
- Model Armor on the gatewayScreening prompts and responses in transit.Pro
- Dry runs and security findingsTesting policies before enforcing them.Pro
- Agent anomaly detectionSpotting agents that behave unusually.Pro