Agent-STAR

August 23, 2026 ยท View on GitHub

This repository is the official implementation of our paper: Demystifying Reinforcement Learning for Long-Horizon Tool-Using Agents: A Comprehensive Recipe.

We use TravelPlanner as a long-horizon tool-use testbed, where agents must iteratively call tools to satisfy multifaceted constraints, i.e., commonsense and hard constraints. We implement STAR [Data Synthesis โ†’ SFT โ†’ RL], a unified post-training pipeline that systematically studies the agentic RL design space across five axes: reward shaping, model scaling, data composition, algorithm selection, and environmental stability.

Please consider citing or giving a ๐ŸŒŸ if Agent-STAR is helpful to your work!

@misc{wu2026agentstar,
      title={Demystifying Reinforcement Learning for Long-Horizon Tool-Using Agents: A Comprehensive Recipe}, 
      author={Xixi Wu and Qianguo Sun and Ruiyang Zhang and Chao Song and Junlong Wu and Yiyan Qi and Hong Cheng},
      year={2026},
      eprint={2603.21972},
      archivePrefix={arXiv},
      primaryClass={cs.LG},
      url={https://arxiv.org/abs/2603.21972}, 
}

๐ŸŽ™๏ธ News

๐ŸŽ‰ [2026-08-22] Our paper is accepted by EMNLP 2026!

๐Ÿ‹๏ธ [2026-08-22] We release the full RL training framework and scripts under RL/, covering TravelPlanner RL training and out-of-domain inference on BrowseComp-Plus and Knowledge-Intensive QA.

๐Ÿ“‘ [2026-03-24] Our paper is released on arXiv!

๐ŸŒฑ [2026-03-23] We release the data synthesis and inference framework of our STAR-pipeline, along with three STAR-SFT models and three STAR-RL models.

๐Ÿ‘€ Stay tuned for continuous updates, new STAR checkpoints will be added over time!


๐Ÿ‹๏ธ RL code is live โ€” start here

๐Ÿ“˜ RL Guide (English) ย โ€ขย  ๐Ÿ“— RL ไฝฟ็”จๆ–‡ๆกฃ (ไธญๆ–‡)

Environment setup ยท reward configuration ยท training scripts for 1.5B / 3B / 7B ยท checkpoint export ยท OOD inference


๐Ÿ“– Table of Contents

๐Ÿ“š Dataset

We open-source our data synthesis codes and 17K+ synthetic queries.

Synthetic datasets are available at https://huggingface.co/datasets/xxwu/Agent-STAR-TravelDataset.

DataDescription
TravelPlanner_Val180.jsonlOfficial TravelPlanner validation set of 180 instances
TravelTotal_17K.jsonlAll 17K+ synthetic queries after element sampling, feasibility checking, and back-translation
Travel_Mixed_1K_RL.jsonlDefault 1K RL training set with mixed difficulty
Travel_{Difficulty}_1K.jsonlDifficulty-specific 1K sets, i.e., Easy / Medium / Hard for controlled experiments

To generate your own training samples, follow the three-step pipeline:

  • Step 0 - Prepare the travel database

  • Step 1 - Element sampling

    cd DataSynthesis
    python3 step1_generate_dict.py --generate_dict --easy_num 1000 --medium_num 1000 --hard_num 1000
    
  • Step 2 - Feasibility checking

    Merge the sampled files into a single file, e.g., combine_3k.jsonl, then:

    python3 step2_dict_feasibility.py --path output/combine_3k.jsonl
    

    Output files: *_feasible.jsonl and *_failed.jsonl.

  • Step 3 - Query generation

    Use LLM back-translation to turn feasible JSON elements into natural language TravelPlanner queries

    Fill API keys in step3_generate_query.py first:

    python3 step3_generate_query.py --input_file output/combine_3k_feasible.jsonl --output_file output/combine_3k_final.jsonl
    

๐Ÿ”ง Environment

For inference, the required packages are:

vllm==0.11.0
transformers==4.57.3
torch==2.8.0

Before running the inference, you have to download the travel database, and put all the CSV files under the database folder.

If you use commercial LLMs like Gemini3-Pro, Seed-1.8 / Seed-2.0, Kimi-K2.5, DeepSeek-V3.2, Qwen3-397B-A17B, etc, fill up the corresponding API keys in Inference/config.json.

๐Ÿค— Model

We release both the STAR-SFT and STAR-RL tuned models across 1.5B / 3B / 7B scales for reproducing and further research.

Backbones: Qwen2.5-Instruct.

SFT: fine-tune from the Qwen2.5-Instruct base using 1K successful trajectories, which are generated by DeepSeek-V3.2-Exp-Thinking on synthetic queries. The corresponding SFT scripts are provided under SFTScripts/. The scripts are based on LLaMAFactory==0.9.4.dev0.

RL: we follow the paperโ€™s scale-aware recipe, as smaller models benefit from curriculum-style rewards and exploration-heavy algorithms, while 7B can leverage GRPO with the dense SUM reward for stronger performance and faster convergence.

ModelPath
Agent-STAR-SFT-1.5Bhttps://huggingface.co/xxwu/Agent-STAR-SFT-1.5B
Agent-STAR-SFT-3Bhttps://huggingface.co/xxwu/Agent-STAR-SFT-3B
Agent-STAR-SFT-7Bhttps://huggingface.co/xxwu/Agent-STAR-SFT-7B
Agent-STAR-RL-1.5Bhttps://huggingface.co/xxwu/Agent-STAR-RL-1.5B
Agent-STAR-RL-3Bhttps://huggingface.co/xxwu/Agent-STAR-RL-3B
Agent-STAR-RL-7Bhttps://huggingface.co/xxwu/Agent-STAR-RL-7B

The figure summarizes TravelPlanner test-set success across training variants and model scales.

๐Ÿš€ Run Inference

The inference code lives under Inference/. The pipeline is: ReAct inference โ†’ Post-processing [NL โ†’ structured JSON] โ†’ Evaluation.

Quick scripts

We provide ready-to-use scripts under Inference/scripts/:

  • infer_sotamodel.sh: run inference with strong commercial LLMs
  • infer_testset.sh: deploy a local model using vLLM and run inference on the TravelPlanner test set

Step-by-step

  • Step 0: Prepare the environment

    • Put the TravelPlanner travel CSVs under database/.
    • If you use commercial LLMs, fill Inference/config.json including API endpoints and keys.
  • Step 1: Run ReAct inference

    From the repo root, you can run:

    cd Inference
    python3 -u main.py \
      --model YOUR_MODEL_PATH_OR_NAME \
      --save_suffix YOUR_SUFFIX \
      --max_workers 20 \
      --split validation  # or test
      --max_context 32768 \
      --max_turns 60 
    

    If you want to run inference on your own synthesized dataset, add: --use_custom_query --input_file YOUR_FILE.jsonl.

  • Step 2: Post-processing to format plans into the evaluation JSON

    Set the DashScope API key used by Inference/utils.py:

    export DASHSCOPE_API_KEY="YOUR_DASHSCOPE_API_KEY"
    python3 -u post_process.py \
      --path PREDICTIONS.jsonl \
      --split validation  # or test
      --format_model deepseek-v3.2-exp
    

    post_process.py converts the modelโ€™s natural-language itinerary into the strict JSON format used by the evaluators.

    โš ๏ธ IMPORTANT & ๐Ÿšจ REWARD-HACKING PREVENTION

    • For test set, post_process.py runs utils.py::format_planning_for_official_test to normalize transportation, i.e., driving/... โ†’ Self-driving, so TravelPlannerโ€™s checker matches correctly.
    • For local evaluation like validation set, we use Inference/eval_commonsense.py::detect_transportation_type for stricter transport matching.
  • Step 3: Evaluation

    • Validation set:

      python3 -u eval.py --path YOUR_FORMATTED.jsonl --save_score
      
    • Test set:

      Use the official TravelPlanner leaderboard

๐Ÿ‹๏ธ RL Training

The RL code lives under RL/, built on rLLM with a lightly patched verl==0.5.0 vendored in RL/verl/.

๐Ÿ“˜ Full documentation: RL Guide (English) ยท RL ไฝฟ็”จๆ–‡ๆกฃ (ไธญๆ–‡)

The guides cover the local sandbox database, reward/API configuration, the complete variable cheat sheet, training dynamics, checkpoint export, and OOD inference.

Quick start

  • Step 1: Set up the environment

    conda create -n rllm_0511 python=3.10 && conda activate rllm_0511
    cd RL
    bash scripts/install_verl.sh
    pip install -e .
    pip install swanlab
    

    RL/rllm_env.txt records a known-good, fully reproducible environment.

  • Step 2: Verify tools and reward

    TravelPlanner tools read from the local sandbox at rllm/tools/travel_tools/database/. Smoke-test before training:

    export DEEPSEEK_API_KEY="YOUR_DEEPSEEK_API_KEY"   # used by the reward formatter
    python3 -m rllm.rewards.travel_reward
    python3 -m rllm.tools.travel_tools.search_restaurant
    
  • Step 3: Launch training

    Pick a script, fill in the model / data / logging variables at the top, then run it. Starting from a STAR-SFT checkpoint is recommended.

    bash examples/travel/3b_scripts/train_qwen2_5_sft_3b_curriculum.sh
    

    Scripts follow the paper's scale-aware recipe โ€” the staged Curriculum reward for smaller models, the dense Sum reward with GRPO at 7B:

    ScaleScriptRewardAlgorithm
    1.5Bexamples/travel/1_5b_scripts/train_qwen2_5_sft_1_5b_curriculum.shCurriculumGRPO
    3Bexamples/travel/3b_scripts/train_qwen2_5_sft_3b_curriculum.shCurriculumGRPO
    3Bexamples/travel/3b_scripts/train_qwen2_5_sft_3b_macro.shMacroGRPO
    3Bexamples/travel/3b_scripts/train_qwen2_5_sft_3b_macro_arpo.shMacroARPO
    3Bexamples/travel/3b_scripts/train_qwen2_5_sft_3b_macro_dapo.shMacroDAPO
    7Bexamples/travel/7b_scripts/train_qwen2_5_sft_7b_sum.shSumGRPO

    Reward designs are switched via REWARD_TYPE: SUM, MACRO, SUCCESS, and PLANNER_R1 for the Curriculum reward, which additionally requires TOTAL_STEPS.

  • Step 4: Export the checkpoint

    cd helper
    python3 convert_safetensor.py --local_dir /PATH/TO/SAVE_FOLDER/global_step_140/actor
    

Out-of-domain inference

To check whether the tool-use ability transfers beyond TravelPlanner, we evaluate on two retrieval-heavy suites. Both need at least 2 GPUs and their own corpus/index download โ€” see the RL Guide for details.

TaskLocationBenchmarks
Deep researchRL/examples/deepresearch/BrowseComp-Plus
Knowledge-intensive QARL/examples/searchqa/nq, triviaqa, popqa, hotpotqa, 2wikimultihopqa, musique, bamboogle

๐Ÿ“ฎ Contact

If you have any questions about usage, reproducibility, or would like to discuss, please feel free to open an issue on GitHub or contact the authors via email at xxwu@se.cuhk.edu.hk

๐Ÿ™ Acknowledgements

We sincerely thank the authors of TravelPlanner for creating a realistic and challenging benchmark, and for providing open-source resources and ongoing support for consistent evaluation. We also appreciate the open-sourced rLLM framework that supports our RL training. The first author, X. Wu, would also like to thank her previous colleagues from DeepResearch Team@Tongyi Lab for helpful hands-on experiences in agentic RL and valuable insights.