Research map / Multi-agent systems and games / LLM agents
Executable Code Actions Elicit Better LLM Agents
Read the paperCheck your idea against 108,967 papers
AI-extracted summary. Written by AI from the paper's full text. Numbers and claims can be wrong or missing context, so check the paper before you cite or build on it.
Proposes CodeAct, which has LLM agents act by emitting executable Python code in a Python interpreter with multi-turn feedback, and builds CodeActInstruct (7k trajectories) to fine-tune open-source CodeActAgent models from Llama-2 and Mistral 7B.
Problem
LLM agents usually emit actions as JSON or text in predefined formats, which limits the action space to pre-defined tools and restricts composition (no control or data flow), and open-source models are weak at tool use.
Approach
Use executable Python code as the unified action space for LLM agents, executed in an interpreter so that agents can use existing packages, compose tools with control and data flow, and self-debug from execution feedback over multiple turns; then instruction-tune open models on filtered multi-turn code-action trajectories.
Key results
- On M3ToolEval, CodeAct achieves up to 20.7% absolute higher success rate than the next-best format for gpt-4-1106-preview (74.4% vs text) while using about 2.1 fewer turns.
- CodeActAgent (Mistral) reaches 57.4% MINT in-domain and 32.4% out-of-domain success, with an overall average of 42.5 versus 25.6 for Mistral Instruct.
- CodeActInstruct-trained models achieve 24% and 119% relative improvement over AgentInstruct and FireAct under the same backbone.
Measured effects reported in the paper
| What was changed | Where | Measured | Effect |
|---|---|---|---|
| Use CodeAct instead of text actions | GPT-4-1106-preview · M³ToolEval | success rate (%): 53.7 -> 74.4 | Helped |
| Use CodeAct instead of text actions | GPT-4-1106-preview · M³ToolEval | avg. turns: 7.7 -> 5.5 | Helped |
| Use CodeAct instead of text actions | Llama-2-7B-chat · API-Bank level-1 | correctness (%): 25.8 -> 28.8 | Helped |
| Add CodeActInstruct to fine-tuning data (ablation) | CodeActAgent (LLaMA-2) · MINT (ID) | success rate: 17.0 -> 51.3 | Helped |
| Add CodeActInstruct to fine-tuning data (ablation) | CodeActAgent (LLaMA-2) · MINT (OD) | success rate: 15.5 -> 20.4 | Helped |
| Add CodeActInstruct to fine-tuning data (ablation) | CodeActAgent (Mistral) · MINT (ID) | success rate: 32.9 -> 57.4 | Helped |
| Add CodeActInstruct to fine-tuning data (ablation) | CodeActAgent (Mistral) · MINT (OD) | success rate: 23.0 -> 32.4 | Helped |
| Add general conversation data to fine-tuning (ablation) | CodeActAgent (LLaMA-2) · Miniwob++ (OD) | success rate: 0.0 -> 25.5 | Helped |
| Add general conversation data to fine-tuning (ablation) | CodeActAgent (Mistral) · GSM8K (OD) | score: 26.8 -> 58.0 | Helped |
| Add general conversation data to fine-tuning (ablation) | CodeActAgent (LLaMA-2) · MINT (ID) | success rate: 29.2 -> 51.3 | Helped |
| Add general conversation data to fine-tuning (ablation) | CodeActAgent (Mistral) · MINT (ID) | success rate: 50.5 -> 57.4 | Helped |
| Add CodeActInstruct to fine-tuning data (ablation) | CodeActAgent (Mistral) · GSM8K (OD) | score: 59.5 -> 58.0 | No clear effect |
Surprising findings
- Llama-2-based CodeActAgent showed no improvement on M3ToolEval despite training, with the authors discussing possible reasons.
- Open-source models lag far behind closed-source ones with CodeAct (best open model 13.4% vs 74.4% for gpt-4-1106-preview) on zero-shot M3ToolEval.
Limitations
- Open-source models perform weakly on complex zero-shot tasks, leaving a large gap to closed-source models.
- Executing model-generated code raises safety concerns, requiring sandboxing and safety mechanisms.
- Llama-2 variant did not improve on M3ToolEval and the anomaly is not fully resolved.
Experimental setup
Datasets: CodeActInstruct HotpotQA MATH APPS WikiTableQuestions ALFWorld OpenOrca ShareGPT Capybara API-Bank
Benchmarks: API-Bank M3ToolEval MINT MiniWob++ SciWorld MMLU HumanEval GSM8K MT-Bench
Metrics: correctness success rate average turns accuracy pass rate MT-Bench score
Baselines: JSON action Text action AgentLM-7B FireAct Llama2 Chat Mistral Instruct gpt-3.5-turbo-0613 gpt-4-0613
Builds on: MINT ReAct FireAct AgentInstruct ToolBench
Closest papers by meaning
- Generalizable End-to-End Tool-Use RL with Synthetic CodeGym (ICLR 2026 · similarity 0.88)
- Enhancing Decision-Making for LLM Agents via Step-Level Q-Value Models (AAAI 2025 · similarity 0.87)
- AgentBench: Evaluating LLMs as Agents (ICLR 2024 · similarity 0.87)
- Frontier Coding Agents Use Metaprogramming to Adapt to Unfamiliar Programming Languages (NeurIPS 2026 · similarity 0.87)
- LLM+AL: Bridging Large Language Models and Action Languages for Complex Reasoning About Actions (AAAI 2025 · similarity 0.87)
- CORVUS: Context Optimization and Reduction Via Underlying Synchronization for LLM Coding Agents (NeurIPS 2026 · similarity 0.87)
Writing a paper in this area? scime draft is a free LaTeX editor with AI included, real-time co-authors and a check of your references and venue rules before you submit. It also imports OpenAI Prism projects.
