Skip to content

In development. Expect rough edges and changes. The source code is not public yet.

Hugging Face 8 min read Research mediumAdept

CodeAgents + Structure: A Better Way to Execute Actions

Forcing code-writing agents to emit their reasoning and Python code as a structured JSON blob (thoughts + code) beats both markdown-parsed CodeAgents and JSON tool-calling agents by 2-7 percentage points on GAIA, MATH, SimpleQA and Frames for capable models. An analysis of 15,724 traces shows first-step parsing errors cut success from 51.3% to 42.3% and raise average steps from 3.18 to 4.63, which structured generation eliminates. Smaller models such as Mistral-7B pay a "structure tax", producing broken Python when juggling JSON escaping and code at once, so the approach is recommended for 32B+ or frontier models. In smolagents it is enabled with use_structured_outputs_internally=True.

Assumes: LLM tool callingstructured outputs / JSON modePython

Related posts

  • Our Transformers Code Agent beats the GAIA benchmark 🏅

    Hugging Face mediumAdept

    A ReactCodeAgent built with Transformers Agents and GPT-4o scored 44.2% on the GAIA validation set, ranking first, and 33.3% on the test set, ranking second overall with the best Level 3 score. Instead of JSON tool calls, the agent writes its actions as Python code, which is more concise, cuts steps by roughly 30%, and makes it easy to store intermediate results in named variables. Code runs in a custom AST-walking interpreter that only executes allowlisted imports and functions, with caps on operation count and print output. A manager agent delegates web browsing to a JSON-based search sub-agent, and the planning loop regenerates facts and a plan every N steps; leaving the previous plan out of the prompt raised the score.

  • Introducing smolagents: simple agents that write actions in code.

    Hugging Face mediumAdept

    smolagents is a minimal Python library from Hugging Face for building LLM agents, with first-class support for code agents that write their actions as Python code instead of JSON tool calls. Agency is framed as a spectrum from simple output processing to multi-step and multi-agent loops, and the post advises using deterministic workflows unless tasks genuinely need flexibility. Code actions are argued to beat JSON for composability, object handling, generality and training-data coverage. The library supports sandboxed execution via E2B, custom tools defined with a @tool decorator and shareable on the Hub, any LLM via transformers, the HF inference API or LiteLLM, and a benchmark shows open models competitive with closed ones on agentic tasks.

  • CoderForge-Preview: SOTA open dataset for training efficient coding agents

    Together AI hardMaster

    CoderForge-Preview is an open dataset of 258K test-verified coding agent trajectories (155K passing) covering 51K tasks across 1,655 repositories from R2E-Gym, SWE-Smith and SWE-Rebench. The trajectories were generated with Qwen3-Coder-480B in OpenHands Docker environments, filtered by rejection sampling and permissive-license audits, and cost about $130K to produce at a ~90% prompt cache hit rate. Fine-tuning Qwen3-32B on the passing trajectories, using Ulysses sequence parallelism, multipacking and token-level loss normalization at 128K context, reaches 59.4% pass@1 on SWE-Bench Verified, and a 4B model reaches 43.0%. Ablations show a repetition penalty helps only early checkpoints, so later checkpoints should be run without one.

  • Open-source DeepResearch – Freeing our search agents

    Hugging Face mediumAdept

    Hugging Face reproduced OpenAI's Deep Research agent in about 24 hours using the open smolagents framework and reached 55.15% on the GAIA validation set, up from roughly 46% for the previous open state of the art (Magentic-One). OpenAI reports 67.36%. Most of the gain comes from a CodeAgent that writes its actions as Python code instead of JSON tool calls. Swapping in JSON actions on the same setup drops the score to 33%. Code actions need about 30% fewer steps and tokens and handle multimodal state more easily. The toolset is deliberately simple: a text-based web browser and a file inspector borrowed from Magentic-One. Next steps are vision-based GUI browsing and benchmarking open models such as DeepSeek R1.

  • The Open Source AI Stack

    Together AI easyNovice

    Adopting open models for agentic coding is framed as a five-layer "MIGHT" stack: model, inference provider, gateways/routers, harness and tools (skills and MCP), with each layer swappable independently so new models can be tried in minutes. Large MoE models like Kimi K3 suit ambiguous multi-step work such as refactors and debugging, while small models like GLM 5.3 Flash are roughly 20x cheaper and match them on tightly scoped tasks. Gateways such as OpenRouter, Vercel AI Gateway and LiteLLM route across providers, and harnesses like OpenCode or Amp execute the tool calls the model requests. The practical advice is to treat model choice as tool selection and to start fresh sessions often to keep context clean.

The quest for software engineering knowledge.

Look:
Layout: