Skip to content

AI-Research-TeamX/SAP

Repository files navigation

rho-logo
Strategy-Augmented Planning for Large Language Models via Opponent Exploitation

arXiv License GitHub stars Python version Environment

In this work, we introduce a two-stage Strategy-Augmented Planning (SAP) framework that significantly enhances the opponent exploitation capabilities of LLM-based agents by utilizing a critical component, the Strategy Evaluation Network (SEN). Specifically, in the offline stage, we construct an explicit strategy space and subsequently collect strategy-outcome pair data for training the SEN network. During the online phase, SAP dynamically recognizes the opponent's strategies and greedily exploits them by searching best response strategy on the well-trained SEN, finally translating strategy to a course of actions by carefully designed prompts.

📦 Setup

We recommend using uv to manage the environment. If you don’t have uv installed, you can install it with:

curl -LsSf https://astral.sh/uv/install.sh | sh

Then set up the project by cloning the repository and syncing dependencies:

git clone https://github.com/hsushuai/SAP.git
cd SAP
uv sync

This will automatically create a virtual environment in .venv and install dependencies from uv lock files.

To activate the environment:

source .venv/bin/activate

⚡ Quick Start

To run the MicroRTS environment, ensure an X server is running:

  • On Windows: we recommend VcXsrv
  • On macOS: install XQuartz
  • On Linux: usually built-in

If you're using SSH on a remote server, enable X11 forwarding with:

ssh -X user@remote-server

Then, set the DISPLAY environment variable:

export DISPLAY=<YOUR_HOST_IP>:<PORT>

Replace <YOUR_HOST_IP> and <PORT> with your actual X server settings. For example: export DISPLAY=localhost:0

To verify the environment is working correctly, run the following test script:

python skill_rts/hello_world.py

You should see a simple MicroRTS environment window launch successfully.

🔬 Experiments

To run the experiments, you can use the provided scripts. For example, to evaluate the performance of the SAP agent, run:

python sap/experiments/eval_sap.py

More scripts are available in the sap/experiments directory for different tasks and configurations.

📂 Structure

There are three main directories in this repository: microrts, sap and skill_rts.

  • microrts: Contains the MicroRTS environment implementation and related utilities.
  • sap: Contains the Strategy-Augmented Planning framework implementation, including the Strategy Evaluation Network (SEN) and related components.
  • skill_rts: Contains the high-level skills and utilities for interacting with the MicroRTS environment.

This project builds on the foundations of MicroRTS-Py and PLAP. We gratefully acknowledge their contributions.

📄 Citation

If you find this work useful, please consider citing our paper:

@misc{xu2025sap,
      title={Strategy-Augmented Planning for Large Language Models via Opponent Exploitation}, 
      author={Shuai Xu and Sijia Cui and Yanna Wang and Bo Xu and Qi Wang},
      year={2025},
      eprint={2505.08459},
      archivePrefix={arXiv},
      primaryClass={cs.AI},
      url={https://arxiv.org/abs/2505.08459}, 
}

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors