Pre-execution contract checks for code-mode tool-use agents
Teams running code-mode agents against live tools can add a verification pass before the first environment action. The verifier should read the task instruction and tool registry, then check the generated program for output shape, tool choice, call signatures, argument provenance, and call order. Failed checks should produce concrete repair instructions and rerun generation without executing the tool call.
RubricRefine is a useful template because it targets failures that can complete without runtime exceptions: wrong routing, broken data flow between tools, and valid-looking final answers built from the wrong intermediate values. On M3ToolEval, it reports 0.86 average success across seven models, compared with 0.62 for single-pass CodeAct, with no execution attempts during refinement. The first internal test should use multi-step tasks where a bad live call can change state, spend money, hit a rate limit, or expose data.