Manuscript Offprint

arXiv:2611.09734

GuardrailAgent: An Agentic Framework for Jailbreak Defense

Tianze Chang, Junjie Chu, Yixin Wu, Michael Backes, Yang Zhang

Open access. PaperVantage converted this article to text, so layout and figures may differ from the original.

Abstract

Despite undergoing safety training to align with human values, large language models (LLMs) remain vulnerable to jailbreak attacks that circumvent built-in safeguards and elicit malicious behaviors given by the adversary. Existing defenses are mostly static and fail to adapt to new or unknown attack strategies, providing limited resilience. To address these, we propose a multi-agent defense framework, GuardrailAgent, that offers adaptive, end-to-end protection. The system autonomously gathers and summarizes attack characteristics into a continuously updated knowledge base that supports both input- and output-side detection. A feedback module integrates misclassified cases for iterative improvement at minimal cost. Tested on over ten representative jailbreaks, the framework achieved a 93.1% input-side detection rate, 93.9% overall detection, and a 95.8% F1 score, while rapidly adapting to unseen attacks. These results demonstrate GuardrailAgent's outstanding capability to maintain LLM safety in the face of evolving jailbreak tactics.

1 Introduction

Jailbreak attacks against large language models (LLMs) are rapidly evolving, with new variants emerging almost daily [9–12, 32, 54, 63]. In contrast, current defenses, whether they involve extensive safety fine-tuning [6, 7]) or external safeguards [3, 16, 17, 21, 31], remain largely static and non-adaptive. They are typically optimized against previously known prompts or attack strategies, but struggle to generalize to unseen jailbreaks in a timely manner.

This mismatch severely limits practical utility. More fundamentally, existing defenses fail to evolve in step with adversaries: their detection logic is typically tied to fixed rules, datasets, or training distributions, such as [3, 16, 42], which quickly become outdated as new jailbreak variants emerge [30, 52]. As a result, even defenses that are effective against known attacks often struggle to maintain robustness as jailbreak behaviors continue to evolve over time. These limitations highlight the urgent need for a defense framework that can continuously and autonomously adapt to a rapidly shifting jailbreak landscape.

To this end, we propose GuardrailAgent, a framework that provides comprehensive and self-evolving protection against unseen and emerging jailbreak attacks. Unlike existing defenses that primarily rely on static patterns, GuardrailAgent is designed to continuously evolve through automated updates from both external resources and internal feedback. This self-evolving capability enables the framework to adapt over time, allowing it to remain effective as jailbreak attacks continue to change. As illustrated in Figure 1, GuardrailAgent adopts a multi-agent architecture composed of two specialized agents: InputAgent and OutputAgent. These agents conduct analysis via a knowledge-driven system, which is built upon three specialized knowledge bases (KBs) and their corresponding analysis tools: the Prompt KB and Material KB for input-side detection, and the Response KB for response monitoring. Externally, the framework autonomously crawls the latest in-the-wild prompts and extracts and summarizes new attack strategies from relevant research papers and write-ups to regularly update its KBs. Internally, it includes a crucial feedback loop: whenever an attack bypasses input detection but is successfully caught at the output side, the missed instance is promoted into the Prompt KB for future detection. This mechanism ensures that the framework can autonomously learn from its past failures in a timely manner, thereby improving its overall generalization.

We conduct extensive evaluations of GuardrailAgent on three popular LLMs as target models, using a benchmark suite of jailbreak prompts containing more than ten representative jailbreak attack strategies. To assess the balance between detection performance and model utility, we also evaluate the models on benign queries to ensure that their utility is not compromised. Overall, it consistently surpasses all baseline defenses, achieving the highest detection rates in both input-side and overall evaluations while preserving model utility. For example, when targeting the ChatGLM3-6B model, it achieves 0.939 DSRoverallDSR_{overall} and 0.958 F1overallF1_{overall}, outperforming baselines, e.g., OpenAI Moderation [38] and Llama Guard 4 [16,33,34,36], exceeding them by at least 0.219 DSRoverallDSR_{overall} and 0.123 F1overallF1_{overall}. We further evaluate OutputAgent on jailbreak prompts that manage to bypass the input detector and trigger unsafe responses from the LLM, and show that it consistently outperforms baseline approaches. Additionally, we study the contribution of its dynamic updating mechanisms, revealing that both continuous updates from external resources and updates informed by internal feedback enhance detection performance. For example, in feedback mode, we

∗^{*}Corresponding author.

Figure

Figure 1: Overview of GuardrailAgent. The framework adopts a two-stage online detection workflow with an InputAgent and an OutputAgent for analyzing user prompts and model-generated responses. The three knowledge bases are continuously updated through external resource evolution and an internal feedback mechanism.

observe that the uninitialized GuardrailAgent, after processing on average 90 adversarial prompts, successfully adapts and improves its detection performance from 0.033 to 0.800.

Our contributions are summarized as follows:

  • We propose GuardrailAgent, a multi-agent defense framework that integrates input- and output-side detection with dynamically evolving knowledge bases. It autonomously collects jailbreak prompts, literature, and community write-ups, and continuously updates itself through web crawling and feedback-driven refinement.

  • Our extensive evaluations on three popular LLMs with over 1,400 harmful queries and ten representative jailbreak strategies show that GuardrailAgent achieves a 0.931 input-side detection rate, a 0.939 overall detection rate, and a 0.958 F1 score on benign queries, substantially outperforming existing baselines such as OpenAI Moderation and Llama Guard 4.

  • We further demonstrate GuardrailAgent's strong adaptivity: in feedback mode, the system quickly strengthens itself by promoting missed instances into its knowledge bases, improving its average detection performance to 0.800 after only 90 adversarial prompts.

References (56)