AI Agent Infrastructure
Token budgets
Explains why token budgets must be enforced in code, how input and output tokens differ, and how to find the tasks that use the most tokens.
What you will be able to do
- Explain why a per-reply limit does not cap a whole agent run.
- Decide which task measures need a budget counter inside the loop.
What is in the lesson
- A real situation where this goes wrong
- How it works, step by step
- A walkthrough with commands you can run
- How it fails in production, and how to tell
- Three quiz questions with explanations
Read this lessonFree. No account needed.
More in AI Agent Infrastructure
- Queue based agent jobsIntermediate · 4 min
Explain why standard SQS queues deliver at least once, how the visibility timeout makes a message reappear, and how a job record stops duplicate effects.
- Concurrency limitsAdvanced · 5 min
Explains how concurrency caps and provider rate limits differ, and how a client should react to 429 responses with retry-after and backoff rather than more retries.
- Cost per taskAdvanced · 5 min
Shows how to calculate cost per task from billing tags and completed-run counts for each task type, and why failed runs must stay in the spend figure.
- Context window managementAdvanced · 4 min
Explains what counts toward the context window, why more space does not fix missed details, and how to measure and trim input before each call.
- Retrieval permissionsAdvanced · 4 min
Shows how a retrieval step filters results by user identity before any passage reaches the model, and why prompt rules are not an access control.
- Vector index freshnessAdvanced · 5 min
Explains how pull indexers, schedules and change detection set the delay between a source change and a searchable update, and how to measure that delay.