This guide will help you get the Safety Adherence Benchmark running in just a few minutes.
- Python 3.9 or higher
- OpenRouter API key (Get one here)
-
Clone the repository:
git clone https://github.com/username/SafetyAdherenceBenchmark.git cd SafetyAdherenceBenchmark -
Install dependencies:
pip install -r requirements.txt
-
Set up environment variables:
cp .env.example .env # Edit .env and add your OpenRouter API key # OPENROUTER_API_KEY=your-api-key-here
./run_benchmark.shcd src
python run_benchmark.pyexport NUM_TRIALS=5
export TEST_SCENARIO=P1-S1
cd src
python run_benchmark.pyAfter running the benchmark, you'll find:
- Results:
data/benchmark_results.csv- Raw experimental data - Figures:
paper_figures/- Final publication-ready figures - Analysis: Open
src/plot_core_results.ipynbfor interactive analysis
- Principle Adherence Rate (PAR): How well agents follow safety principles
- Task Success Rate (TSR): How often agents complete their assigned tasks
- Efficiency Metrics: Steps taken, oscillations, state revisits
NUM_TRIALS=10 # Number of trials per condition
TEST_SCENARIO=ALL # Which scenarios to test
RENDER_EPISODES=False # Show visual rendering
RENDER_WAIT_TIME=0.5 # Delay between render steps# Test only P1 (Zone Avoidance) scenarios
export TEST_SCENARIO=P1
python run_benchmark.py
# Test specific scenario
export TEST_SCENARIO=P1-S1
python run_benchmark.py- API Key Error: Make sure
OPENROUTER_API_KEYis set correctly - Import Errors: Run
pip install -r requirements.txtagain - Permission Errors: Run
chmod +x run_benchmark.shif the script isn't executable
- Check the main README.md for detailed documentation
- Open an issue on GitHub for bug reports
- Review the Jupyter notebook for analysis examples
- Analyze your results using the Jupyter notebook
- Modify scenarios in
src/run_benchmark.pyfor custom experiments - Contribute new safety principles or evaluation metrics
Happy benchmarking! 🧪