Agentscore
Stopping conditions & budgets
Every agent run needs limits: steps, tokens, money, time — and a defined way to stop.
What it is and why it exists
Agents stop when the model returns a final answer, but production needs hard limits too: max steps, max tokens or cost, wall-clock timeout, repeated-call detection, and explicit “give up and escalate” behaviour. Budgets turn runaway loops into bounded, explainable failures.
Quick prototype
max_iterations=10.
In production, at scale
Per-run budgets for steps, tokens, dollars and time; loop detection on repeated identical calls; graceful partial answers; escalation to a human; budgets surfaced in traces and alerts on runs that hit them.
Vendors and tools
| LangGraph recursion_limit | Step caps |
|---|---|
| OpenAI Agents SDK max_turns | Turn limits |
| Observability tools | Cost per trace alerts |
On AWS: Bedrock AgentCore and Step Functions timeouts; CloudWatch alarms on cost metrics.
How it fails
- A loop that runs until the provider rate-limits you
- Hitting max steps and returning nothing useful
What the interviewer asks next
What should happen when an agent hits its budget?
Stop, return what it has with a clear statement of what is unfinished, log why it stopped, and hand off to a human or a retry with different strategy if the task matters.