Skip to content

Repository files navigation

CAR: Empowering Agents with Dynamic Tool Synthesis and Global Trajectory Rectification

Official implementation of CAR (Create And Replan), accepted to Findings of ACL 2026.

CAR is a tool-using agent framework for environments where the initial toolset may be incomplete or unreliable. It introduces two mechanisms:

  • Dynamic Tool Synthesis: creates a missing Python tool during inference and adds it to the current action space.
  • Global Trajectory Rectification: diagnoses failed execution, preserves successful steps, and replans only the remaining trajectory.

This repository also contains ToolHop-Pro, a benchmark derived from ToolHop for evaluating agents under tool scarcity and execution instability.

Project Structure

Path Description
car_agent.py Main CAR workflow: routing, planning, execution, and final synthesis
car/replanner.py Global trajectory rectification
car/reflector.py Invalid-result and failure detection
car/meta_tools/ Tool creation, schema conversion, and isolated execution
car/prompts.py Prompts for the CAR modules
ToolHopPro.json ToolHop-Pro benchmark
test_arc_mode.py Evaluation script
tool_set/ Runtime tool pool
results/ Experiment outputs

Installation

CAR requires Python 3.13 or later and uses uv for dependency management.

git clone https://github.com/Lancetwang/car.git
cd car
uv sync

Create an .env file for your OpenAI-compatible model provider:

OPENAI_API_KEY=your_api_key
OPENAI_BASE_URL=your_openai_compatible_endpoint

Model names and runtime limits are configured in config.yaml. Docker is required for isolated tool execution.

Usage

Run CAR interactively:

uv run car_agent.py

Evaluate ToolHop-Pro in the Complete or Missing setting:

uv run test_arc_mode.py --type complete
uv run test_arc_mode.py --type missing

Run selected examples:

uv run test_arc_mode.py --type missing --id 0 1 2 3

ToolHop-Pro

ToolHop-Pro contains 995 examples and 622 unique tools. It defines three evaluation settings:

  • Complete: all tools are available.
  • Missing: logical tools are removed and must be synthesized when needed.
  • Error: the complete toolset is retained, with execution failures injected into logical tools.

The released evaluation script currently provides the Complete and Missing settings. The paper does not specify the probability, seed, or timeout distribution used for Error-mode injection; these values are therefore not reconstructed in this repository.

Results

Pass rate on ToolHop-Pro with Qwen3-Plus:

Method Complete Missing Error
CAR 54.57 53.87 52.86

On the original ToolHop benchmark, CAR improves Qwen3-Plus from 47.94% to 54.57% pass rate. See the paper for the complete experimental setup, baselines, and ablations.

About

Code and data for CAR, an ACL 2026 Findings paper on dynamic tool synthesis and trajectory rectification for LLM agents.

Resources

Stars

Watchers

Forks

Releases

Packages

Contributors

Languages