License to Call: Introducing Transformers Agents 2.0
Transformers Agents 2.0 adds two iterative ReAct-style agents, ReactCodeAgent and ReactJsonAgent, which loop through thought, action and observation, alongside the existing single-shot CodeAgent. The framework is built from a few transparent pieces: Tool classes whose attributes generate the prompt's usage manual, reusable pre-instantiated Toolboxes, and a pluggable LLM engine. Worked examples include a self-correcting RAG agent that chooses its own source filters over a FAISS index, and a multi-agent setup that wraps a web-surfer agent as a tool. A Llama-3-70B-Instruct agent built this way outperforms GPT-4-based agents on the GAIA leaderboard; the functionality has since moved to the smolagents library.
Related posts
- Our Transformers Code Agent beats the GAIA benchmark 🏅
Hugging Face mediumAdeptA 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 mediumAdeptsmolagents 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.
- Open-source LLMs as LangChain Agents
Hugging Face mediumAdeptOpen-source LLMs can now serve as reasoning engines for tool-using ReAct agents, with Mixtral-8x7B outperforming GPT-3.5 out of the box on a mixed benchmark drawn from HotpotQA, GSM8K and GAIA, graded by GPT-4-as-a-judge. The ReAct loop works by prompting for a Thought plus a JSON tool call or a Final Answer, then parsing the output, running the tool and appending the Observation to the prompt. Agents are built in LangChain with the new ChatHuggingFace wrapper. Llama2-70b and Zephyr-7b perform poorly. About 10% of Mixtral's GAIA failures come from malformed tool arguments, so fine-tuning for function calling is the recommended next step. Giving models a calculator lifts zero-shot GSM8K scores, though only 20 questions were tested.
- Open-source DeepResearch – Freeing our search agents
Hugging Face mediumAdeptHugging 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.
- CodeAgents + Structure: A Better Way to Execute Actions
Hugging Face mediumAdeptForcing 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.