By Abhijith N M · Reviewed 24 October 2026 · Editorial standards
Complete the code challenge below. Read the instructions carefully and use the integrated editor on the right to write and run your solution.
Given the ordered list of tools an agent called, decide whether the trace is acceptable. This is the assertion that stops an agent from issuing a refund it was never allowed to issue — and unlike a judge call, it is free.
Implement check_trace(calls, max_steps). Check in this order and return the first problem found:
"refund.execute" is in the calls → "FORBIDDEN:refund.execute""LOOP:<tool>" (the earliest such tool)len(calls) > max_steps → "TOO_LONG:<len(calls)>""OK"Written and edited by the nexGenCoders team. Spotted a mistake? Tell us and we will fix it.
Don't lose this lesson
Create a free account to save your progress, keep your streak, and work toward a shareable certificate.