SCGAgent: Recreating the Benefits of Reasoning Models for Secure Code Generation with Agentic Workflows
On the map: LLM agents and tool use → Agent threats, guardrails and governance
Abstract (arXiv)
Large language models (LLMs) have seen widespread success in code generation tasks for different scenarios, both everyday and professional. However current LLMs, despite producing functional code, do not prioritize security and may generate code with exploitable vulnerabilities. In this work, we propose techniques for generating code that is more likely to be secure and introduce SCGAgent, a proactive secure coding agent that implements our techniques. We use security coding guidelines that articulate safe programming practices, combined with LLM-generated unit tests to preserve functional correctness. In our evaluation, we find that SCGAgent is able to preserve nearly 98% of the functionality of the base Sonnet-3.7 LLM while achieving an approximately 25% improvement in security. Moreover, SCGAgent is able to match or best the performance of sophisticated reasoning LLMs using a non-reasoning model and an agentic workflow.
Key facts. Cited by 4 papers in the map (data through 7 Oct 2026). Placed in Agent threats, guardrails and governance, one of 16 directions in LLM agents and tool use. Builds on 34 of its 50 references that are in the map. First posted on arXiv 8 Jun 2025.
Builds on
34 of 50 references.
Closest ancestors · 1
Same direction, newest first
Other references · 33
- 2024The Llama 3 Herd of Modelscited by 14,192
- 2021Evaluating Large Language Models Trained on Codecited by 8,053
- 2020Scaling Laws for Neural Language Modelscited by 6,411
- 2025DeepSeek-R1: Incentivizing Reasoning Capability in LLMs via Reinforcement Learningcited by 6,146
- 2023Toolformer: Language Models Can Teach Themselves to Use Toolscited by 4,072
- 2023SWE-bench: Can Language Models Resolve Real-World GitHub Issues?cited by 3,193
- 2022Training Compute-Optimal Large Language Modelscited by 2,927
- 2023Code Llama: Open Foundation Models for Codecited by 2,105
- 2024SWE-agent: Agent-Computer Interfaces Enable Automated Software Engineeringcited by 1,628
- 2025s1: Simple test-time scalingcited by 1,311
- 2023StarCoder: may the source be with you!cited by 790
- 2023WizardCoder: Empowering Code Large Language Models with Evol-Instructcited by 728
21 more
- 2022InCoder: A Generative Model for Code Infilling and Synthesiscited by 492
- 2021Asleep at the Keyboard? Assessing the Security of GitHub Copilot's Code Contributionscited by 417
- 2022The Stack: 3 TB of permissively licensed source codecited by 354
- 2023Magicoder: Empowering Code Generation with OSS-Instructcited by 251
- 2023Large Language Models for Code: Security Hardening and Adversarial Testingcited by 149
- 2023Purple Llama CyberSecEval: A Secure Coding Benchmark for Language Modelscited by 130
- 2025CodeElo: Benchmarking Competition-level Code Generation of LLMs with Human-comparable Elo Ratingscited by 109
- 2023ChatUniTest: A Framework for LLM-Based Test Generationcited by 94
- 2023LLMs Cannot Reliably Identify and Reason About Security Vulnerabilities (Yet?): A Comprehensive Evaluation, Framework, and Benchmarkscited by 94
- 2023No More Manual Tests? Evaluating and Improving ChatGPT for Unit Test Generationcited by 82
- 2024Instruction Tuning for Secure Code Generationcited by 63
- 2025Trading Inference-Time Compute for Adversarial Robustnesscited by 60
- 2025CWEval: Outcome-driven Evaluation on Functionality and Security of LLM Code Generationcited by 55
- 2024RLCoder: Reinforcement Learning for Repository-Level Code Completioncited by 44
- 2024Constrained Decoding for Secure Code Generationcited by 35
- 2024Prompting Techniques for Secure Code Generation: A Systematic Investigationcited by 33
- 2023The FormAI Dataset: Generative AI in Software Security Through the Lens of Formal Verificationcited by 32
- 2023Assessing the Security of GitHub Copilot Generated Code -- A Targeted Replication Studycited by 24
- 2024LLM Security Guard for Codecited by 15
- 2024R2C2-Coder: Enhancing and Benchmarking Real-world Repository-level Code Completion Abilities of Code Large Language Modelscited by 9
- 2024Enhancing Security of AI-Based Code Synthesis with GitHub Copilot via Cheap and Efficient Prompt-Engineeringcited by 6
Built on by
Citing papers per year: 2025: 1; 2026: 3.
4 papers.
- 2026SoK: AI Secure Code Generation: Progress, Pitfalls, and Paths Forward23 Jun 2026
- 2026SecPI: Secure Code Generation with Reasoning Models via Security Reasoning Internalization4 Apr 2026
- 2026LLMs + Security = Trouble9 Feb 2026
- 2025PurpCode: Reasoning for Safer Code Generation25 Jul 2025
Similar, not cited
Close in wording, no citation either way
- 2025Fortifying LLM-Based Code Generation with Graph-Based Reasoning on Secure Coding Practices
- 2025DualGauge: Automated Joint Security-Functionality Benchmarking of Specification-Only Code Generation by LLMs and Coding Agents
- 2025TypePilot: Leveraging the Scala Type System for Secure LLM-generated Code
- 2026MACGen: Toward Functionally Correct and Secure Code Generation via Multi-Agent Collaboration
- 2026Inference-Time Safety For Code LLMs Via Retrieval-Augmented Revision
- 2026STELP: Secure Transpilation and Execution of LLM-Generated Programs
- 2026Execution-State-Aware LLM Reasoning for Automated Proof-of-Vulnerability Generation
- 2026P3: Joint Program-and-Proof Planning for Verified Code Generation