Write summarize_trace(trace) that produces a one-line bug-ticket
summary. The function:
- Takes a trace (list of turn dicts).
- Returns a string formatted exactly:
"<N> turns, <M> tools, <V> validation_errors, final stop=<stop_reason>". Where:<N>is the number of turns.<M>is the total number of tool calls across all turns (sum oflen(t["tools_called"])).<V>is the totalvalidation_errorssummed across turns.<stop_reason>istrace[-1]["stop_reason"].
Three traces run for you. Expected output:
4 turns, 3 tools, 0 validation_errors, final stop=end_turn
3 turns, 2 tools, 1 validation_errors, final stop=end_turn
2 turns, 0 tools, 0 validation_errors, final stop=max_tokens