Skip to content
AI-generated research idea🟢Easy🔧Minor TweakRelated work found

Structured Tool-Call Recovery and Execution Middleware for Open-Weight Coding Agents

Add structured decoding and automated execution-recovery middleware to coding agent harnesses so open-weight models stop failing silently from malformed tool calls.

Time

a few days

Compute level

Single GPU or less

Resources

CPU-only Python sandbox, OpenCode harness, and API or local GPU access to open-weight models (e.g., Qwen3-32B, Llama 4 Maverick, Gemma 3 27B) on VBVR-Pro-Bench

What the paper used

CPU-only Python sandbox with 30-minute wall-clock limit per instance; 500 instances evaluated via closed-model APIs (Codex, Claude Code, Gemini CLI) and 23 open-weight models via Amazon Bedrock; video model baselines taken from published leaderboard without rerunning.

Prerequisites

LLM tool calling, constrained decoding, agent harness engineering

Scope

modify existing code

The Gap

In Section 3.3, open-weight coding models evaluated under OpenCode exhibit a steep rank correlation (Spearman rho = 0.93) between score and number of videos delivered: four models (Gemma 3 27B/12B, Llama 3.3 70B, Magistral Small) call zero tools across 500 attempts, while Qwen3-32B and Llama 4 Maverick terminate prematurely with fewer than three calls.

“Because an instance without a video scores 0, delivery failure is the primary driver of the lowest scores.”
From the paper, Section 3.3, page 6. Matched against the PDF text.

Limitation

Standard terminal agent harnesses discard prose responses and malformed tool syntax, causing open-weight models to score zero due to delivery failure even when they can reason about the visual problem.

Proposed Solution

Build a resilient harness adapter combining constrained grammar/JSON-schema decoding for tool invocations, automatic extraction and sandboxed execution of markdown Python blocks when a model responds in prose, automated error-traceback re-prompting on premature exits, and rejection of non-existent sub-agent delegations.

Why This Matters

Eliminating mechanical delivery failures should decouple tool-formatting compliance from true visual-reasoning capability, recovering substantial benchmark performance from existing open-weight models at minimal engineering cost.

How to Get Started

How to test it: Test whether execution-recovery middleware raises video delivery rate from 0%-5% to >90% and improves overall VBVR-Pro-Bench scores on Gemma 3 27B, Llama 3.3 70B, Qwen3-32B, and Llama 4 Maverick; stop if recovered videos still yield near-zero content scores.

  1. Clone the OpenCode harness and reproduce the zero-delivery and premature-termination failures on a 50-instance stratified sample using Qwen3-32B, Llama 4 Maverick, and Gemma 3 27B.
  2. Implement a response parser and guardrail loop that intercepts prose code blocks or invalid sub-agent calls, executes valid Python code in the sandbox, and returns stdout/stderr or missing-video reminders until `video.mp4` is written.
  3. Add constrained tool-call formatting or few-shot tool-use exemplars for models without native Bedrock tool-calling support.
  4. Benchmark video delivery rate and final VBVR-Pro-Bench content scores across all 500 instances against the unmodified OpenCode baseline.

Suggested by AI. Adapt it to your setup.

Has This Been Done?

Related work found

Works such as Beyond Prompts: Measuring and Optimizing LLM Tool-Agent Harnesses and Agentic Harness Engineering explore harness engineering, tool use, and execution integrity for LLM agents. They leave open the specific combination of constrained grammar decoding, automatic markdown python block extraction, error-traceback re-prompting, and rejection policies tailored for open-weight coding agents.

We searched OpenAlex and arXiv for “open-weight LLM agent tool-call recovery execution harness” and “Structured Tool-Call Recovery and Execution Middleware for Open-Weight Coding Agents” and an AI compared the idea with the top 10 results. A small search can miss relevant work.

Source Paper

Solve Vision with Code: Coding Agents Are Stronger Visual Reasoners Than Video Models

Dezhi Luo, Fengyuan Yu, Haotian Zhang +11 more · 2026

This paper evaluates whether off-the-shelf coding agents outperform native video generation models on visual reasoning tasks when evaluated under identical inputs, output video format, and an unmodified deterministic evaluator on VBVR-Pro-Bench. By writing Python programs that render answer videos in a CPU sandbox, three closed-model coding agents achieve scores of 0.893 to 0.923, surpassing the best RL-trained video model (0.670) by over 0.22, while the strongest open-weight model (GLM-5) reaches 0.572.

Related Ideas

Is this a good idea?

Share onXLinkedIn