Give every agent a budget before it runs
Most teams find out what their agent costs from the monthly bill. By then the one task that looped all night has already been paid for. Set the limit per run, in code, before the first call.
The 60-second version
- An agent decides how many calls to make, so its cost is not fixed per request the way a chatbot’s is.
- Give each run three limits, in code: money, steps and time. Stop cleanly when any one is reached.
- Record the cost of every run, split into model, tools and retries, so you can see which task is expensive.
- Set the limit from your own numbers: a little above what a normal run costs, never “unlimited”.
This week AWS added a cost line to every agent session in Bedrock AgentCore: an estimate per agent and per session, split into model calls, compute, memory and tools, with alarms when it crosses a number you set. It is a useful feature. It is also a reminder that most teams running agents today cannot answer a simple question: what did that one run cost?
A chatbot costs roughly the same per message. An agent does not. It decides how many times to call the model, which tools to use and when to try again. A run that normally takes eight steps can take eighty when a tool keeps failing and the agent keeps retrying.
An agent without a budget is a loop with your card attached.
Three limits, not one
Give every run three limits, and check all three before each step:
- Money: total spend on the model and paid tools for this run.
- Steps: the number of model calls or tool calls.
- Time: wall-clock minutes from start to finish.
Money catches the expensive model call. Steps catch the loop that is cheap per call but never ends. Time catches the tool that hangs. Any one of them on its own leaves a gap.
Put the check in the code that runs the agent, not in the prompt. Telling the model “keep it under fifty cents” is advice; a counter that stops the loop is a rule.
Stop cleanly
When a run hits a limit, it should not just die. Save what it has done, mark the task as “stopped: over budget”, and hand it to a person or a queue. A stopped task you can see is cheap. A silent failure that a customer finds is not.
Set the number from your own runs
Don’t guess the limit. Run your agent on twenty normal tasks and record cost, steps and minutes for each. Set each limit a little above the highest normal run, perhaps one and a half times. Anything above that is not a normal run; it is something going wrong, and you want to see it.
Then record the cost of every run in production, split the way AWS now splits it: model, tools, retries. Once a week, sort by cost. The top five runs will tell you more about your agent than any dashboard average.
What to do this week
Add a step counter and a time limit to your agent loop today; they take ten lines. Then log the token cost of every run, and after a week, set the money limit from what you see.
AgentCore details from AWS’s announcement of 1 December 2026.