mlsanityData to 7 Oct 2026

BlueCodeAgent: A Blue Teaming Agent Enabled by Automated Red Teaming for CodeGen AI

arXiv 2510.18131 ↗First posted 20 Oct 2025cs.SEcited by 1

On the map: LLM agents and tool use → Agent threats, guardrails and governance

also in 1 more
Abstract (arXiv)

As large language models (LLMs) are increasingly used for code generation, concerns over the security risks have grown substantially. Early research has primarily focused on red teaming, which aims to uncover and evaluate vulnerabilities and risks of CodeGen models. However, progress on the blue teaming side remains limited, as developing defense requires effective semantic understanding to differentiate the unsafe from the safe. To fill in this gap, we propose BlueCodeAgent, an end-to-end blue teaming agent enabled by automated red teaming. Our framework integrates both sides: red teaming generates diverse risky instances, while the blue teaming agent leverages these to detect previously seen and unseen risk scenarios through constitution and code analysis with agentic integration for multi-level defense. Our evaluation across three representative code-related tasks--bias instruction detection, malicious instruction detection, and vulnerable code detection--shows that BlueCodeAgent achieves significant gains over the base models and safety prompt-based defenses. In particular, for vulnerable code detection tasks, BlueCodeAgent integrates dynamic analysis to effectively reduce false positives, a challenging problem as base models tend to be over-conservative, misclassifying safe code as unsafe. Overall, BlueCodeAgent achieves an average 12.7% F1 score improvement across four datasets in three tasks, attributed to its ability to summarize actionable constitutions that enhance context-aware risk detection. We demonstrate that the red teaming benefits the blue teaming by continuously identifying new vulnerabilities to enhance defense performance.

Key facts. Cited by 1 paper 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 21 of its 29 references that are in the map. First posted on arXiv 20 Oct 2025.

Builds on

21 of 29 references.

Closest ancestors · 1

Same direction, newest first

  1. 2024RedCode: Risky Code Execution and Generation Benchmark for Code Agents12 Nov

Other references · 20

  1. 2023GPT-4 Technical Reportcited by 18,132
  2. 2025DeepSeek-R1: Incentivizing Reasoning Capability in LLMs via Reinforcement Learningcited by 6,146
  3. 2021Program Synthesis with Large Language Modelscited by 3,509
  4. 2023Qwen Technical Reportcited by 3,273
  5. 2023Universal and Transferable Adversarial Attacks on Aligned Language Modelscited by 2,914
  6. 2024HarmBench: A Standardized Evaluation Framework for Automated Red Teaming and Robust Refusalcited by 1,330
  7. 2023AutoDAN: Generating Stealthy Jailbreak Prompts on Aligned Large Language Modelscited by 738
  8. 2021Asleep at the Keyboard? Assessing the Security of GitHub Copilot's Code Contributionscited by 417
  9. 2024AmpleGCG: Learning a Universal and Transferable Generative Model of Adversarial Suffixes for Jailbreaking Both Open and Closed LLMscited by 160
  10. 2023Large Language Models for Code: Security Hardening and Adversarial Testingcited by 149
  11. 2024AdvPrompter: Fast Adaptive Adversarial Prompting for LLMscited by 146
  12. 2024Vulnerability Detection with Code Language Models: How Far Are We?cited by 133
8 more
  1. 2023LLMs Cannot Reliably Identify and Reason About Security Vulnerabilities (Yet?): A Comprehensive Evaluation, Framework, and Benchmarkscited by 94
  2. 2024CyberSecEval 2: A Wide-Ranging Cybersecurity Evaluation Suite for Large Language Modelscited by 84
  3. 2024Vul-RAG: Enhancing LLM-based Vulnerability Detection via Knowledge-level RAGcited by 67
  4. 2025CWEval: Outcome-driven Evaluation on Functionality and Security of LLM Code Generationcited by 55
  5. 2023Bias Testing and Mitigation in LLM-based Code Generationcited by 53
  6. 2024RMCBench: Benchmarking Large Language Models' Resistance to Malicious Codecited by 27
  7. 2025Poly-Guard: Massive Multi-Domain Safety Policy-Grounded Guardrail Datasetcited by 14
  8. 2024Black-Box Adversarial Attacks on LLM-Based Code Completioncited by 13

Built on by

Cited by year (2026 to 7 Oct)

Citing papers per year: 2026: 1.

1 paper.

Similar, not cited

Close in wording, no citation either way

  1. 2025RedCodeAgent: Automatic Red-teaming Agent against Diverse Code Agents
  2. 2025Red-Teaming Coding Agents from a Tool-Invocation Perspective: An Empirical Security Assessment
  3. 2026REDAgentBench: Executable Red Teaming and Faithful Measurement of LLM Agent Systems
  4. 2026Black-Box Red Teaming of Agentic AI: A Taxonomy-Driven Framework for Automated Risk Discovery
  5. 2024Against The Achilles' Heel: A Survey on Red Teaming for Generative Models
  6. 2026Prompt Injection Attacks on Agentic Coding Assistants: A Systematic Analysis of Vulnerabilities in Skills, Tools, and Protocol Ecosystems
  7. 2026MonitoringBench: Semi-Automated Red-Teaming for Agent Monitoring
  8. 2026PI-Hunter: Automated Red-Teaming for Exposing and Localizing Prompt Injections