Two agents can both solve a task, but one in 4 steps and the other in 40, repeating searches, re-reading the same file and retrying a failing command unchanged. The slow agent costs ten times more, takes ten times longer and is more likely to wander off. Evaluation therefore measures not only whether a task succeeded but how efficiently. Step efficiency compares the number of steps taken with the minimum known for the task (and is zero if the task failed, since an efficient failure is not a virtue). Redundancy counts actions that exactly repeat an earlier action, the signature of a stuck loop.
Implement step_efficiency and redundancy_rate.
step_efficiency(n_steps, n_optimal, succeeded) returns 0.0 if succeeded is false, else min(1.0, n_optimal / n_steps). n_steps >= 1.redundancy_rate(actions) takes a list of (name, args) pairs (args is a dict) and returns the fraction of actions that exactly repeat an earlier action (same name and equal args). Return 0.0 for an empty list.(name, json.dumps(args, sort_keys=True)).The first occurrence of an action is never redundant, only later copies.
An agent can beat the recorded optimum (n_steps < n_optimal), which the cap at 1.0 handles.
No results yet
Run your code to check it against the examples, or submit to run every test.