WRITE · TRACE · UNDERSTAND
Stop an agent loop before exceeding its execution budget
Implement admitted_steps(costs,max_steps,max_tokens), returning (number_admitted,tokens_used).
Read lesson: Stop an agent loop before exceeding its execution budget →
Your experiment
Implement admitted_steps(costs,max_steps,max_tokens), returning (number_admitted,tokens_used). Nonnegative integer costs and budgets only. Stop at the first exceeded limit; zero-cost steps still consume a step.
Python runs in your browser. Your draft stays on this device.
What to look for
A deterministic replay proves the admission arithmetic only. Actual tools still need authorization and outcome handling; provider usage, elapsed time and retries must be reconciled with the budget after every real operation.
Watch your code work
Ready to experimentWrite a solution or load the worked answer, then choose Trace & check.
Step through arrays, variables and training curves produced by your own Python.
