This repository provides the official implementation of the S²CG-Agent, a schedulable and safe code generation agent designed to generate secure code with the help of LLMs. It is developed to support research in safe AI-assisted software engineering.
S²CG-Agent introduces a multi-agent architecture where code generation tasks are scheduled and coordinated to ensure safety and correctness.
This repository accompanies the paper:
"S²CG-Agent: A Schedulable Multi-Agent Secure Code Generation Framework"

S2CG-Agent-main/
├── AutoSafeCoder/ # baseline: AutoSafeCoder
├── LLM-Agent/ # baseline: LLM-Agent
├── OriginalLLM/ # baseline: Original LLM
├── SCG-Agent/ # ablation baseline: SCG-Agent
├── S²CG-Agent/ # S²CG-Agent
├── trained_decision_model/ # trained scheduling model, need to download from Releases or Google Cloud
├── results/ # outputs of S²CG-Agent and baselines
├── evaluation/ # Scripts and configs for evaluating performance
├── requirements.txt # Python dependencies
└── README.md # This file- Python 3.8+
- OpenAI or other LLM API access
- Install required packages:
pip install -r requirements.txtEnsure you have your API key set as an environment variable:
xxx_key = your-api-keyNavigate to the S²CG-Agent/ directory and run the main agent:
cd S²CG-Agent
python main.pyA pretrained scheduling model is available for download:
👉 Download from Releases 👉 Download from Google Drive
After downloading, place the model files in the appropriate directory (e.g., S2CG-Agent-main/trained_decision_model/).
To evaluate the performance and safety of generated code, use the scripts in the evaluation/ directory:
cd evaluation
python eval_time.py api_calls.py eval_unit.py eval_static.py eval_fuzzing.pyYou may configure evaluation parameters in the included config files (your api key).
- This repo is research-oriented and intended for reproducibility and further development.
- Please ensure compliance with LLM provider usage policies when deploying the agent.
This project is released under the MIT License. See the LICENSE file for details.
This work is part of the research project described in the paper: "S²CG-Agent: A Schedulable Multi-Agent Secure Code Generation Framework" If you use this code, please consider citing our work.