<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:content="http://purl.org/rss/1.0/modules/content/"><channel><title>Cybersecurity on RockB</title><link>https://baeseokjae.github.io/tags/cybersecurity/</link><description>Recent content in Cybersecurity on RockB</description><image><title>RockB</title><url>https://baeseokjae.github.io/images/og-default.png</url><link>https://baeseokjae.github.io/images/og-default.png</link></image><generator>Hugo</generator><language>en-us</language><lastBuildDate>Sat, 25 Apr 2026 15:04:16 +0000</lastBuildDate><atom:link href="https://baeseokjae.github.io/tags/cybersecurity/index.xml" rel="self" type="application/rss+xml"/><item><title>CAI Open-Source Security Agent Framework: Build and Deploy Offensive AI Security Agents</title><link>https://baeseokjae.github.io/posts/cai-open-source-security-agent-guide-2026/</link><pubDate>Sat, 25 Apr 2026 15:04:16 +0000</pubDate><guid>https://baeseokjae.github.io/posts/cai-open-source-security-agent-guide-2026/</guid><description>Complete guide to CAI, the open-source cybersecurity AI framework that won 41/45 CTF flags and delivers 91% solve rates for automated pentesting.</description><content:encoded><![CDATA[<p>CAI (Cybersecurity AI) is an open-source framework from Alias Robotics that lets security engineers build, orchestrate, and deploy autonomous AI agents for offensive security tasks — from reconnaissance to exploitation, bug bounty automation to CTF solving. Install it with <code>pip install cai-framework</code>, point it at a target, and it handles the full pentest loop without step-by-step human direction.</p>
<h2 id="what-is-cai-the-open-source-cybersecurity-ai-framework-explained">What Is CAI? The Open-Source Cybersecurity AI Framework Explained</h2>
<p>CAI is an open-source cybersecurity AI framework developed by Alias Robotics that provides a structured, modular foundation for building autonomous security agents capable of performing offensive tasks — reconnaissance, vulnerability scanning, exploitation, and privilege escalation — with minimal human intervention. Unlike running an LLM against a system prompt and hoping for the best, CAI wraps the AI loop in a production-ready architecture: structured agent definitions, reusable tool libraries, handoff protocols between agents, input/output guardrails, and human-in-the-loop (HITL) checkpoints. The framework supports over 300 AI models including OpenAI GPT-4o, Anthropic Claude, DeepSeek, and local deployments via Ollama — meaning you can run fully air-gapped without a cloud dependency.</p>
<p>In 2025, CAI proved it was not a research toy. It won the Neurogrid CTF, capturing 41 of 45 available flags and the $50,000 top prize. In the Cyber Apocalypse CTF 2025, competing against 8,129 teams, it outperformed 99.7% of participants at peak — while only running for 3 of the 72 available hours. Across all major CTF events in 2025, CAI achieved a 99.04% mean percentile ranking. Against real-world targets like vulnbank.org, it identified SQL injection vulnerabilities allowing full account takeover. The framework delivers 91% solve rates and 98% cost reduction versus traditional security testing approaches.</p>
<h2 id="installing-cai-from-zero-to-running-your-first-security-agent">Installing CAI: From Zero to Running Your First Security Agent</h2>
<p>CAI installation follows standard Python tooling and takes under five minutes on any system with Python 3.10+. The framework is distributed via PyPI, with optional extras for specific integrations.</p>
<div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code class="language-bash" data-lang="bash"><span style="display:flex;"><span><span style="color:#75715e"># Basic installation</span>
</span></span><span style="display:flex;"><span>pip install cai-framework
</span></span><span style="display:flex;"><span>
</span></span><span style="display:flex;"><span><span style="color:#75715e"># With all optional dependencies (recommended for security work)</span>
</span></span><span style="display:flex;"><span>pip install cai-framework<span style="color:#f92672">[</span>all<span style="color:#f92672">]</span>
</span></span><span style="display:flex;"><span>
</span></span><span style="display:flex;"><span><span style="color:#75715e"># Verify installation</span>
</span></span><span style="display:flex;"><span>cai --version
</span></span></code></pre></div><p>Before running your first agent, set your model provider credentials. CAI reads these from environment variables:</p>
<div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code class="language-bash" data-lang="bash"><span style="display:flex;"><span><span style="color:#75715e"># For Anthropic Claude (recommended for complex reasoning)</span>
</span></span><span style="display:flex;"><span>export ANTHROPIC_API_KEY<span style="color:#f92672">=</span><span style="color:#e6db74">&#34;sk-ant-...&#34;</span>
</span></span><span style="display:flex;"><span>
</span></span><span style="display:flex;"><span><span style="color:#75715e"># For OpenAI</span>
</span></span><span style="display:flex;"><span>export OPENAI_API_KEY<span style="color:#f92672">=</span><span style="color:#e6db74">&#34;sk-...&#34;</span>
</span></span><span style="display:flex;"><span>
</span></span><span style="display:flex;"><span><span style="color:#75715e"># For local Ollama (air-gapped environments)</span>
</span></span><span style="display:flex;"><span><span style="color:#75715e"># No API key needed — just ensure Ollama is running</span>
</span></span></code></pre></div><p>The fastest way to validate the install is to run CAI&rsquo;s built-in interactive mode against a test target. The Alias Robotics team maintains a deliberately vulnerable practice environment:</p>
<div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code class="language-bash" data-lang="bash"><span style="display:flex;"><span><span style="color:#75715e"># Launch CAI interactive mode</span>
</span></span><span style="display:flex;"><span>cai
</span></span><span style="display:flex;"><span>
</span></span><span style="display:flex;"><span><span style="color:#75715e"># Inside the CAI shell, run against DVWA or a local test box</span>
</span></span><span style="display:flex;"><span>&gt; target 10.10.10.10
</span></span><span style="display:flex;"><span>&gt; agent recon
</span></span><span style="display:flex;"><span>&gt; run
</span></span></code></pre></div><p>CAI&rsquo;s interactive mode gives you a REPL where you compose agent pipelines before executing them. For production use, you&rsquo;ll define agents programmatically in Python — which is where the real power surfaces.</p>
<h2 id="cais-8-pillar-architecture-a-deep-dive">CAI&rsquo;s 8-Pillar Architecture: A Deep Dive</h2>
<p>CAI is built around eight architectural pillars that together create a reliable, auditable security automation pipeline. Understanding these pillars is essential before building custom agents, because each one maps to a specific failure mode in naive LLM-based security automation.</p>
<p><strong>Agents</strong> are the core execution unit. Each agent is a structured object with a defined role, a set of allowed tools, a system prompt scoped to its function, and optional handoff targets. You don&rsquo;t instantiate a generic &ldquo;security AI&rdquo; — you define a recon agent, an exploitation agent, a reporting agent, each with a narrow charter.</p>
<p><strong>Tools</strong> are Python functions exposed to agents as callable actions. CAI ships with pre-built tools for port scanning (nmap integration), web crawling, SQL injection probing, SSH connection management, and CVE lookup. You can extend this with your own tools decorated with <code>@cai_tool</code>.</p>
<p><strong>Handoffs</strong> are the protocol by which one agent transfers control to another, passing context and artifacts. A recon agent that finds an open SSH port can hand off to an SSH brute-force agent with the discovered credentials list — without you writing the orchestration glue.</p>
<p><strong>Patterns</strong> are reusable agent workflow templates. CAI ships patterns for vulnerability assessment, privilege escalation, lateral movement, and report generation.</p>
<p><strong>Turns</strong> are the unit of agent execution. Each turn, the agent receives context, reasons, picks a tool or handoff, executes, and returns an observation. CAI tracks turn history for debugging and audit logs.</p>
<p><strong>Tracing</strong> provides structured logs of every agent action, tool call, model inference, and handoff. Traces are exportable to JSON and integrate with observability platforms.</p>
<p><strong>Guardrails</strong> are input and output filters that block unsafe commands, detect prompt injection attempts, and enforce scope constraints (e.g., &ldquo;only target this IP range&rdquo;).</p>
<p><strong>HITL (Human-in-the-Loop)</strong> checkpoints pause execution before high-risk actions — destructive exploits, data exfiltration, privilege escalation — and wait for human confirmation. You configure which action categories require approval.</p>
<h2 id="building-your-first-offensive-security-agent-with-cai">Building Your First Offensive Security Agent with CAI</h2>
<p>A complete, functional CAI agent requires three components: a role definition, a tool set, and execution logic. Here is a minimal but real reconnaissance agent you can adapt for authorized testing:</p>
<div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code class="language-python" data-lang="python"><span style="display:flex;"><span><span style="color:#f92672">from</span> cai <span style="color:#f92672">import</span> Agent, run
</span></span><span style="display:flex;"><span><span style="color:#f92672">from</span> cai.tools <span style="color:#f92672">import</span> nmap_scan, whois_lookup, dns_enumerate
</span></span><span style="display:flex;"><span>
</span></span><span style="display:flex;"><span>recon_agent <span style="color:#f92672">=</span> Agent(
</span></span><span style="display:flex;"><span>    name<span style="color:#f92672">=</span><span style="color:#e6db74">&#34;ReconAgent&#34;</span>,
</span></span><span style="display:flex;"><span>    model<span style="color:#f92672">=</span><span style="color:#e6db74">&#34;claude-sonnet-4-6&#34;</span>,
</span></span><span style="display:flex;"><span>    instructions<span style="color:#f92672">=</span><span style="color:#e6db74">&#34;&#34;&#34;
</span></span></span><span style="display:flex;"><span><span style="color:#e6db74">    You are a reconnaissance specialist. Your goal is to map the attack surface
</span></span></span><span style="display:flex;"><span><span style="color:#e6db74">    of the target system. Use nmap for port/service discovery, DNS enumeration
</span></span></span><span style="display:flex;"><span><span style="color:#e6db74">    for subdomain mapping, and WHOIS for ownership context.
</span></span></span><span style="display:flex;"><span><span style="color:#e6db74">    
</span></span></span><span style="display:flex;"><span><span style="color:#e6db74">    Always start with passive reconnaissance before active scanning.
</span></span></span><span style="display:flex;"><span><span style="color:#e6db74">    Report open ports, running services with version info, and any
</span></span></span><span style="display:flex;"><span><span style="color:#e6db74">    identified subdomains in a structured JSON format.
</span></span></span><span style="display:flex;"><span><span style="color:#e6db74">    
</span></span></span><span style="display:flex;"><span><span style="color:#e6db74">    Scope: </span><span style="color:#e6db74">{target}</span><span style="color:#e6db74">. Do not scan outside this scope.
</span></span></span><span style="display:flex;"><span><span style="color:#e6db74">    &#34;&#34;&#34;</span>,
</span></span><span style="display:flex;"><span>    tools<span style="color:#f92672">=</span>[nmap_scan, whois_lookup, dns_enumerate],
</span></span><span style="display:flex;"><span>)
</span></span><span style="display:flex;"><span>
</span></span><span style="display:flex;"><span>result <span style="color:#f92672">=</span> run(recon_agent, target<span style="color:#f92672">=</span><span style="color:#e6db74">&#34;10.10.10.10&#34;</span>)
</span></span><span style="display:flex;"><span>print(result<span style="color:#f92672">.</span>report)
</span></span></code></pre></div><p>The <code>run()</code> call handles the agentic loop — the agent reasons about which tool to call next, executes it, observes the result, and continues until it determines reconnaissance is complete or hits a turn limit.</p>
<p>For a more realistic workflow, chain a recon agent into a vulnerability assessment agent:</p>
<div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code class="language-python" data-lang="python"><span style="display:flex;"><span><span style="color:#f92672">from</span> cai <span style="color:#f92672">import</span> Agent, run
</span></span><span style="display:flex;"><span><span style="color:#f92672">from</span> cai.tools <span style="color:#f92672">import</span> nmap_scan, nikto_scan, sqlmap_probe
</span></span><span style="display:flex;"><span><span style="color:#f92672">from</span> cai.handoffs <span style="color:#f92672">import</span> create_handoff
</span></span><span style="display:flex;"><span>
</span></span><span style="display:flex;"><span>vuln_agent <span style="color:#f92672">=</span> Agent(
</span></span><span style="display:flex;"><span>    name<span style="color:#f92672">=</span><span style="color:#e6db74">&#34;VulnAssessAgent&#34;</span>,
</span></span><span style="display:flex;"><span>    model<span style="color:#f92672">=</span><span style="color:#e6db74">&#34;claude-sonnet-4-6&#34;</span>,
</span></span><span style="display:flex;"><span>    instructions<span style="color:#f92672">=</span><span style="color:#e6db74">&#34;&#34;&#34;
</span></span></span><span style="display:flex;"><span><span style="color:#e6db74">    You receive a recon report. Your job is to identify exploitable vulnerabilities
</span></span></span><span style="display:flex;"><span><span style="color:#e6db74">    in the discovered services. Probe web services with nikto, test for SQL injection
</span></span></span><span style="display:flex;"><span><span style="color:#e6db74">    on identified endpoints with sqlmap in safe/read-only mode.
</span></span></span><span style="display:flex;"><span><span style="color:#e6db74">    
</span></span></span><span style="display:flex;"><span><span style="color:#e6db74">    Prioritize findings by CVSS score. Output a structured vulnerability report.
</span></span></span><span style="display:flex;"><span><span style="color:#e6db74">    &#34;&#34;&#34;</span>,
</span></span><span style="display:flex;"><span>    tools<span style="color:#f92672">=</span>[nikto_scan, sqlmap_probe],
</span></span><span style="display:flex;"><span>)
</span></span><span style="display:flex;"><span>
</span></span><span style="display:flex;"><span>recon_agent<span style="color:#f92672">.</span>handoffs <span style="color:#f92672">=</span> [create_handoff(vuln_agent, condition<span style="color:#f92672">=</span><span style="color:#e6db74">&#34;recon_complete&#34;</span>)]
</span></span><span style="display:flex;"><span>
</span></span><span style="display:flex;"><span>result <span style="color:#f92672">=</span> run(recon_agent, target<span style="color:#f92672">=</span><span style="color:#e6db74">&#34;10.10.10.10&#34;</span>)
</span></span></code></pre></div><p>When recon finishes, the framework automatically invokes the handoff condition, packages the recon context, and starts the vuln agent — no manual wiring required.</p>
<h2 id="tools-and-handoffs-modular-security-automation-at-scale">Tools and Handoffs: Modular Security Automation at Scale</h2>
<p>CAI&rsquo;s tool system is one of its strongest design decisions. Every action an agent can take is a Python function registered as a tool — this means every capability is auditable, testable, and replaceable without touching the agent logic.</p>
<p>The built-in tool library covers the full offensive security kill chain. Network tools include nmap, masscan, and netcat wrappers. Web tools cover dirbusting, parameter fuzzing, and HTTP request manipulation. Exploitation tools integrate Metasploit module execution and custom payload delivery. Post-exploitation tools handle shell management, file transfer, and privilege escalation checks.</p>
<p>Registering a custom tool requires a single decorator:</p>
<div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code class="language-python" data-lang="python"><span style="display:flex;"><span><span style="color:#f92672">from</span> cai <span style="color:#f92672">import</span> cai_tool
</span></span><span style="display:flex;"><span><span style="color:#f92672">import</span> subprocess
</span></span><span style="display:flex;"><span>
</span></span><span style="display:flex;"><span><span style="color:#a6e22e">@cai_tool</span>
</span></span><span style="display:flex;"><span><span style="color:#66d9ef">def</span> <span style="color:#a6e22e">run_custom_scan</span>(target: str, port: int, flags: str <span style="color:#f92672">=</span> <span style="color:#e6db74">&#34;&#34;</span>) <span style="color:#f92672">-&gt;</span> str:
</span></span><span style="display:flex;"><span>    <span style="color:#e6db74">&#34;&#34;&#34;
</span></span></span><span style="display:flex;"><span><span style="color:#e6db74">    Run a custom nmap scan against a specific port.
</span></span></span><span style="display:flex;"><span><span style="color:#e6db74">    
</span></span></span><span style="display:flex;"><span><span style="color:#e6db74">    Args:
</span></span></span><span style="display:flex;"><span><span style="color:#e6db74">        target: IP address or hostname to scan
</span></span></span><span style="display:flex;"><span><span style="color:#e6db74">        port: Port number to probe
</span></span></span><span style="display:flex;"><span><span style="color:#e6db74">        flags: Additional nmap flags (e.g., &#39;-sV -sC&#39;)
</span></span></span><span style="display:flex;"><span><span style="color:#e6db74">    
</span></span></span><span style="display:flex;"><span><span style="color:#e6db74">    Returns:
</span></span></span><span style="display:flex;"><span><span style="color:#e6db74">        Raw nmap output as string
</span></span></span><span style="display:flex;"><span><span style="color:#e6db74">    &#34;&#34;&#34;</span>
</span></span><span style="display:flex;"><span>    cmd <span style="color:#f92672">=</span> <span style="color:#e6db74">f</span><span style="color:#e6db74">&#34;nmap </span><span style="color:#e6db74">{</span>flags<span style="color:#e6db74">}</span><span style="color:#e6db74"> -p </span><span style="color:#e6db74">{</span>port<span style="color:#e6db74">}</span><span style="color:#e6db74"> </span><span style="color:#e6db74">{</span>target<span style="color:#e6db74">}</span><span style="color:#e6db74">&#34;</span>
</span></span><span style="display:flex;"><span>    result <span style="color:#f92672">=</span> subprocess<span style="color:#f92672">.</span>run(cmd<span style="color:#f92672">.</span>split(), capture_output<span style="color:#f92672">=</span><span style="color:#66d9ef">True</span>, text<span style="color:#f92672">=</span><span style="color:#66d9ef">True</span>, timeout<span style="color:#f92672">=</span><span style="color:#ae81ff">60</span>)
</span></span><span style="display:flex;"><span>    <span style="color:#66d9ef">return</span> result<span style="color:#f92672">.</span>stdout
</span></span></code></pre></div><p>The docstring is critical — CAI&rsquo;s underlying LLM reads it to decide when and how to use the tool. Clear argument descriptions and return value documentation directly impact agent decision quality.</p>
<p>Handoffs solve the coordination problem in multi-agent security automation. When a recon agent discovers a web application, it shouldn&rsquo;t try to exploit it — that&rsquo;s a different role, different tools, different reasoning. Handoffs let you enforce this separation while preserving context continuity:</p>
<div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code class="language-python" data-lang="python"><span style="display:flex;"><span><span style="color:#f92672">from</span> cai.handoffs <span style="color:#f92672">import</span> Handoff
</span></span><span style="display:flex;"><span>
</span></span><span style="display:flex;"><span><span style="color:#75715e"># Define a conditional handoff: only trigger if a web service was found</span>
</span></span><span style="display:flex;"><span>web_handoff <span style="color:#f92672">=</span> Handoff(
</span></span><span style="display:flex;"><span>    target<span style="color:#f92672">=</span>web_exploitation_agent,
</span></span><span style="display:flex;"><span>    condition<span style="color:#f92672">=</span><span style="color:#66d9ef">lambda</span> ctx: <span style="color:#e6db74">&#34;http&#34;</span> <span style="color:#f92672">in</span> ctx<span style="color:#f92672">.</span>discovered_services,
</span></span><span style="display:flex;"><span>    context_transform<span style="color:#f92672">=</span><span style="color:#66d9ef">lambda</span> ctx: {
</span></span><span style="display:flex;"><span>        <span style="color:#e6db74">&#34;target_url&#34;</span>: ctx<span style="color:#f92672">.</span>web_endpoints,
</span></span><span style="display:flex;"><span>        <span style="color:#e6db74">&#34;recon_data&#34;</span>: ctx<span style="color:#f92672">.</span>full_report
</span></span><span style="display:flex;"><span>    }
</span></span><span style="display:flex;"><span>)
</span></span></code></pre></div><p>The <code>context_transform</code> function shapes what context gets passed to the next agent — you can strip irrelevant data, add metadata, or enrich with external lookups before the hand-off occurs.</p>
<h2 id="guardrails-and-hitl-running-cai-safely-in-production">Guardrails and HITL: Running CAI Safely in Production</h2>
<p>Running autonomous offensive AI agents without guardrails is how you end up in a compliance incident. CAI&rsquo;s guardrail system provides layered protection: input validation that blocks out-of-scope targets before any tool executes, output filtering that catches accidental credential logging, and semantic guardrails that use a secondary LLM call to classify action risk before execution.</p>
<p>Setting up scope-enforcement guardrails is the first thing to configure on any CAI deployment:</p>
<div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code class="language-python" data-lang="python"><span style="display:flex;"><span><span style="color:#f92672">from</span> cai.guardrails <span style="color:#f92672">import</span> ScopeGuardrail, PromptInjectionGuardrail
</span></span><span style="display:flex;"><span>
</span></span><span style="display:flex;"><span>scope_guard <span style="color:#f92672">=</span> ScopeGuardrail(
</span></span><span style="display:flex;"><span>    allowed_targets<span style="color:#f92672">=</span>[<span style="color:#e6db74">&#34;10.10.10.0/24&#34;</span>, <span style="color:#e6db74">&#34;vulnbank.org&#34;</span>],
</span></span><span style="display:flex;"><span>    block_on_violation<span style="color:#f92672">=</span><span style="color:#66d9ef">True</span>,
</span></span><span style="display:flex;"><span>    alert_on_violation<span style="color:#f92672">=</span><span style="color:#66d9ef">True</span>,
</span></span><span style="display:flex;"><span>)
</span></span><span style="display:flex;"><span>
</span></span><span style="display:flex;"><span>injection_guard <span style="color:#f92672">=</span> PromptInjectionGuardrail(
</span></span><span style="display:flex;"><span>    sensitivity<span style="color:#f92672">=</span><span style="color:#e6db74">&#34;high&#34;</span>,  <span style="color:#75715e"># block if injection probability &gt; 0.7</span>
</span></span><span style="display:flex;"><span>)
</span></span><span style="display:flex;"><span>
</span></span><span style="display:flex;"><span>agent <span style="color:#f92672">=</span> Agent(
</span></span><span style="display:flex;"><span>    name<span style="color:#f92672">=</span><span style="color:#e6db74">&#34;PentestAgent&#34;</span>,
</span></span><span style="display:flex;"><span>    model<span style="color:#f92672">=</span><span style="color:#e6db74">&#34;claude-sonnet-4-6&#34;</span>,
</span></span><span style="display:flex;"><span>    instructions<span style="color:#f92672">=</span><span style="color:#e6db74">&#34;...&#34;</span>,
</span></span><span style="display:flex;"><span>    tools<span style="color:#f92672">=</span>[<span style="color:#f92672">...</span>],
</span></span><span style="display:flex;"><span>    input_guardrails<span style="color:#f92672">=</span>[scope_guard, injection_guard],
</span></span><span style="display:flex;"><span>)
</span></span></code></pre></div><p>The HITL system is where CAI&rsquo;s approach to responsible automation becomes operationally concrete. Rather than letting agents execute any action autonomously, you define a risk taxonomy and assign checkpoint requirements:</p>
<div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code class="language-python" data-lang="python"><span style="display:flex;"><span><span style="color:#f92672">from</span> cai.hitl <span style="color:#f92672">import</span> HITLConfig, RiskLevel
</span></span><span style="display:flex;"><span>
</span></span><span style="display:flex;"><span>hitl_config <span style="color:#f92672">=</span> HITLConfig(
</span></span><span style="display:flex;"><span>    require_approval<span style="color:#f92672">=</span>[
</span></span><span style="display:flex;"><span>        RiskLevel<span style="color:#f92672">.</span>DESTRUCTIVE,      <span style="color:#75715e"># data deletion, service disruption</span>
</span></span><span style="display:flex;"><span>        RiskLevel<span style="color:#f92672">.</span>EXFILTRATION,     <span style="color:#75715e"># file downloads, data extraction</span>
</span></span><span style="display:flex;"><span>        RiskLevel<span style="color:#f92672">.</span>PRIVILEGE_ESC,    <span style="color:#75715e"># sudo, privilege escalation attempts</span>
</span></span><span style="display:flex;"><span>    ],
</span></span><span style="display:flex;"><span>    auto_approve<span style="color:#f92672">=</span>[
</span></span><span style="display:flex;"><span>        RiskLevel<span style="color:#f92672">.</span>PASSIVE_RECON,    <span style="color:#75715e"># whois, DNS, passive scanning</span>
</span></span><span style="display:flex;"><span>        RiskLevel<span style="color:#f92672">.</span>ACTIVE_RECON,     <span style="color:#75715e"># nmap, service fingerprinting</span>
</span></span><span style="display:flex;"><span>    ],
</span></span><span style="display:flex;"><span>    approval_timeout<span style="color:#f92672">=</span><span style="color:#ae81ff">300</span>,           <span style="color:#75715e"># seconds before auto-deny</span>
</span></span><span style="display:flex;"><span>    approval_channel<span style="color:#f92672">=</span><span style="color:#e6db74">&#34;slack&#34;</span>,       <span style="color:#75715e"># where approval requests go</span>
</span></span><span style="display:flex;"><span>)
</span></span></code></pre></div><p>When an agent attempts a destructive action, CAI pauses, serializes the action context, sends an approval request to your configured channel (Slack, email, webhook), and waits. If no approval arrives within the timeout, the action is denied and the agent proceeds to the next available path.</p>
<h2 id="multi-agent-patterns-swarm-hierarchical-and-parallel-coordination">Multi-Agent Patterns: Swarm, Hierarchical, and Parallel Coordination</h2>
<p>CAI supports three primary multi-agent coordination patterns, each suited to different security automation scenarios. Choosing the wrong pattern is the most common mistake teams make when scaling beyond single-agent workflows.</p>
<p><strong>Swarm coordination</strong> deploys multiple peer agents against the same target simultaneously. Each agent works a different attack vector — one probing web services, another testing authentication, a third checking for known CVEs in discovered software. Swarm is ideal for broad vulnerability assessment where time is the constraint. CAI&rsquo;s Dragos OT CTF performance (Rank 1 in hours 7-8, 32/34 challenges, 37% velocity advantage over top human teams) was largely achieved through swarm coordination across different challenge categories.</p>
<div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code class="language-python" data-lang="python"><span style="display:flex;"><span><span style="color:#f92672">from</span> cai.patterns <span style="color:#f92672">import</span> SwarmPattern
</span></span><span style="display:flex;"><span>
</span></span><span style="display:flex;"><span>swarm <span style="color:#f92672">=</span> SwarmPattern(
</span></span><span style="display:flex;"><span>    agents<span style="color:#f92672">=</span>[web_recon_agent, auth_probe_agent, cve_scan_agent],
</span></span><span style="display:flex;"><span>    coordination<span style="color:#f92672">=</span><span style="color:#e6db74">&#34;parallel&#34;</span>,
</span></span><span style="display:flex;"><span>    merge_strategy<span style="color:#f92672">=</span><span style="color:#e6db74">&#34;union&#34;</span>,  <span style="color:#75715e"># combine all findings into one report</span>
</span></span><span style="display:flex;"><span>)
</span></span><span style="display:flex;"><span>
</span></span><span style="display:flex;"><span>result <span style="color:#f92672">=</span> swarm<span style="color:#f92672">.</span>run(target<span style="color:#f92672">=</span><span style="color:#e6db74">&#34;10.10.10.10&#34;</span>)
</span></span></code></pre></div><p><strong>Hierarchical coordination</strong> uses a manager agent to direct specialist agents. The manager receives the initial objective, decomposes it into subtasks, assigns agents, and synthesizes results. This pattern is best for complex, multi-phase engagements where the sequence matters:</p>
<div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code class="language-python" data-lang="python"><span style="display:flex;"><span><span style="color:#f92672">from</span> cai.patterns <span style="color:#f92672">import</span> HierarchicalPattern
</span></span><span style="display:flex;"><span>
</span></span><span style="display:flex;"><span>pentest_manager <span style="color:#f92672">=</span> Agent(
</span></span><span style="display:flex;"><span>    name<span style="color:#f92672">=</span><span style="color:#e6db74">&#34;PentestManager&#34;</span>,
</span></span><span style="display:flex;"><span>    model<span style="color:#f92672">=</span><span style="color:#e6db74">&#34;claude-opus-4-7&#34;</span>,  <span style="color:#75715e"># stronger model for orchestration</span>
</span></span><span style="display:flex;"><span>    instructions<span style="color:#f92672">=</span><span style="color:#e6db74">&#34;Decompose the pentest objective into phases. Coordinate specialists.&#34;</span>,
</span></span><span style="display:flex;"><span>    handoffs<span style="color:#f92672">=</span>[recon_agent, web_agent, exploitation_agent, reporting_agent],
</span></span><span style="display:flex;"><span>)
</span></span><span style="display:flex;"><span>
</span></span><span style="display:flex;"><span>engagement <span style="color:#f92672">=</span> HierarchicalPattern(manager<span style="color:#f92672">=</span>pentest_manager)
</span></span><span style="display:flex;"><span>result <span style="color:#f92672">=</span> engagement<span style="color:#f92672">.</span>run(objective<span style="color:#f92672">=</span><span style="color:#e6db74">&#34;Full pentest of 10.10.10.10&#34;</span>, scope<span style="color:#f92672">=</span><span style="color:#e6db74">&#34;10.10.10.0/24&#34;</span>)
</span></span></code></pre></div><p><strong>Chain-of-Thought coordination</strong> passes enriched context sequentially through a pipeline. Output from each agent becomes the input to the next. Use this for workflows where each phase depends entirely on the previous one&rsquo;s findings:</p>
<div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code class="language-python" data-lang="python"><span style="display:flex;"><span><span style="color:#f92672">from</span> cai.patterns <span style="color:#f92672">import</span> ChainPattern
</span></span><span style="display:flex;"><span>
</span></span><span style="display:flex;"><span>pentest_chain <span style="color:#f92672">=</span> ChainPattern(
</span></span><span style="display:flex;"><span>    stages<span style="color:#f92672">=</span>[recon_agent, vuln_agent, exploitation_agent, post_exploit_agent, reporting_agent]
</span></span><span style="display:flex;"><span>)
</span></span><span style="display:flex;"><span>
</span></span><span style="display:flex;"><span>result <span style="color:#f92672">=</span> pentest_chain<span style="color:#f92672">.</span>run(target<span style="color:#f92672">=</span><span style="color:#e6db74">&#34;10.10.10.10&#34;</span>)
</span></span></code></pre></div><p>For CTF scenarios where challenges are independent, swarm wins. For red team engagements with clear kill-chain phases, hierarchical with a strong orchestrator model delivers better results. Chain is best for bug bounty automation where the pipeline is fixed and sequential.</p>
<h2 id="cais-ctf-track-record-benchmark-results-that-matter">CAI&rsquo;s CTF Track Record: Benchmark Results That Matter</h2>
<p>CTF performance is the most rigorous available benchmark for offensive security AI — challenges are designed by experts, scored objectively, and run against identical conditions for all participants. CAI&rsquo;s 2025 results are the most compelling case for production adoption of any open-source security framework.</p>
<p>The headline numbers tell a clear story. At Neurogrid CTF 2025, CAI captured 41 of 45 available flags and took the $50,000 first prize — outright, not in a separate &ldquo;AI track.&rdquo; At Cyber Apocalypse CTF 2025, competing against 8,129 teams from the global security community, CAI outperformed 99.7% of teams at peak performance while only running for 3 of the 72 available hours. Had it competed for the full duration, the gap would have been larger. Across all tracked CTF events in 2025, CAI maintained a 99.04% mean percentile ranking.</p>
<p>The Dragos ICS/OT CTF is particularly significant because OT security is considered one of the hardest domains — specialized protocols, legacy systems, limited public tooling. CAI achieved Rank 1 during the competition&rsquo;s peak hours (7-8), completing 32 of 34 challenges with a 37% velocity advantage over top human teams. This is not a domain where general-purpose AI typically excels.</p>
<p>Speed benchmarks reveal the magnitude of the capability gap. CAI solves specific challenge types up to 3,600 times faster than human competitors, with an average of 11x faster across all challenge categories. CAI v0.6.0 beats the next-best AI agent framework by 2.6x in Attack &amp; Defense CTF formats — the most operationally realistic competition format.</p>
<p>The practical implication for security teams: CAI&rsquo;s CTF performance correlates with real-world pentest efficiency. The same multi-agent coordination, tool chains, and reasoning patterns that flag CTF challenges also identify vulnerabilities in production systems.</p>
<h2 id="cai-vs-pentestgpt-vs-pentagi-choosing-the-right-framework">CAI vs. PentestGPT vs. PentAGI: Choosing the Right Framework</h2>
<p>Three open-source AI security frameworks dominate the 2026 landscape. Choosing between them requires honest evaluation of your team&rsquo;s constraints and use case requirements.</p>
<table>
  <thead>
      <tr>
          <th>Framework</th>
          <th>CTF Performance</th>
          <th>Real-World Testing</th>
          <th>Model Support</th>
          <th>Air-Gap Capable</th>
          <th>Active Maintenance</th>
      </tr>
  </thead>
  <tbody>
      <tr>
          <td><strong>CAI</strong></td>
          <td>99.04% mean percentile</td>
          <td>High (vulnbank.org SQL injection, multiple CVEs)</td>
          <td>300+ models</td>
          <td>Yes (Ollama)</td>
          <td>Active (Alias Robotics)</td>
      </tr>
      <tr>
          <td><strong>PentestGPT</strong></td>
          <td>Limited benchmarks</td>
          <td>Moderate</td>
          <td>OpenAI/Anthropic</td>
          <td>No</td>
          <td>Moderate</td>
      </tr>
      <tr>
          <td><strong>PentAGI</strong></td>
          <td>Competitive</td>
          <td>Moderate</td>
          <td>OpenAI primary</td>
          <td>No</td>
          <td>Active</td>
      </tr>
      <tr>
          <td><strong>hackingBuddyGPT</strong></td>
          <td>Research-focused</td>
          <td>Limited</td>
          <td>OpenAI</td>
          <td>No</td>
          <td>Research cadence</td>
      </tr>
  </tbody>
</table>
<p><strong>CAI</strong> is the right choice when you need production-grade performance, multi-agent orchestration, air-gapped deployment, or broad model flexibility. The HITL and guardrail system is the most mature of the three. The trade-off: steeper learning curve due to richer architecture.</p>
<p><strong>PentestGPT</strong> is optimized for web application testing with a simpler mental model. Good for teams that primarily do bug bounty web testing and want to start quickly without learning CAI&rsquo;s 8-pillar architecture. Limited multi-agent support.</p>
<p><strong>PentAGI</strong> takes a more general-purpose agent approach and performs well on structured pentest methodologies. Better documentation for teams new to AI-assisted pentesting. Less proven in competitive benchmarks.</p>
<p>For security teams doing serious offensive work — red team engagements, bug bounty at scale, CTF competition, OT security assessment — CAI is the only production-ready option. For teams exploring AI-assisted pentesting for the first time, PentestGPT offers a lower entry point.</p>
<h2 id="responsible-use-legal-boundaries-and-ethical-considerations">Responsible Use, Legal Boundaries, and Ethical Considerations</h2>
<p>AI-powered offensive security tools amplify capability dramatically — which means the legal and ethical requirements that apply to traditional pentesting apply with greater force to CAI-based automation. The framework will do what you tell it to, faster and more thoroughly than most human teams. This is the point. It also means the consequences of misuse are proportionally larger.</p>
<p>The fundamental legal requirement is unchanged: you must have written authorization before scanning or testing any system you do not own. CAI&rsquo;s speed and automation mean an accidental misconfiguration of the <code>allowed_targets</code> scope can cause more unintended scanning in 60 seconds than a careless human could cause in an hour. Configure the <code>ScopeGuardrail</code> before running any agent in a non-local environment, and treat the scope configuration as a critical security control, not an optional feature.</p>
<p>Responsible disclosure applies to AI-discovered vulnerabilities. If you run CAI in bug bounty mode and it finds a critical vulnerability, the same responsible disclosure obligations that apply to human-discovered bugs apply to AI-discovered ones. CAI does not change the ethics of vulnerability research — it changes the speed at which you accumulate findings that require responsible handling.</p>
<p>For red team engagements, establish HITL checkpoints at every phase boundary. The HITL system exists precisely for this: a human should confirm that the engagement is proceeding within scope and intent before moving from recon to exploitation, and again before post-exploitation activities. CAI&rsquo;s configurability makes this easy to enforce; skipping it to save time is a professional risk management failure.</p>
<p>Air-gapped deployments via Ollama address a real enterprise concern: many security teams cannot send target data and scan results to external model providers due to data handling policies. CAI&rsquo;s multi-model support makes local deployment practical — modern 70B models running on on-premises hardware deliver sufficient reasoning quality for most pentest automation tasks.</p>
<h2 id="frequently-asked-questions">Frequently Asked Questions</h2>
<p><strong>Is CAI legal to use for security testing?</strong>
CAI is legal to use when you have explicit written authorization to test the target system. Like all offensive security tools, using CAI against systems you do not have permission to test is illegal under the Computer Fraud and Abuse Act (US), Computer Misuse Act (UK), and equivalent laws in most jurisdictions. The framework includes scope guardrails specifically to help prevent accidental out-of-scope testing.</p>
<p><strong>What hardware do I need to run CAI locally without a cloud API?</strong>
For local deployment via Ollama, you need a machine with at least 16GB RAM for smaller models (7B-13B parameter range) or 40GB+ VRAM for larger models (70B) that deliver production-quality reasoning. An NVIDIA GPU with CUDA support significantly improves inference speed. For cloud-connected deployments, standard developer hardware is sufficient — CAI itself is lightweight.</p>
<p><strong>How does CAI handle credential management?</strong>
CAI does not store credentials in plaintext logs or agent context by default. The framework&rsquo;s output filtering guardrail can be configured to redact credential patterns before they appear in traces or reports. For production use, integrate with your secrets management system (HashiCorp Vault, AWS Secrets Manager) and inject credentials via environment variables rather than passing them in agent instructions.</p>
<p><strong>Can CAI be used for bug bounty automation?</strong>
Yes — this is one of CAI&rsquo;s primary production use cases. The multi-agent handoff system is well-suited to the recon → vulnerability identification → proof-of-concept → reporting pipeline that bug bounty work requires. Configure strict scope guardrails matching the program&rsquo;s in-scope definition, enable HITL before any exploitation step, and use the built-in reporting tools to generate disclosure-ready vulnerability reports.</p>
<p><strong>What models work best for different CAI agent roles?</strong>
The community consensus in 2026: use Claude Opus 4.7 or GPT-4o for orchestrator/manager agents where complex reasoning and multi-step planning are needed. Use Claude Sonnet 4.6 for specialist agents (recon, exploitation, post-exploit) where speed and tool use efficiency matter more than deep reasoning. For air-gapped deployments, Qwen2.5-72B via Ollama performs comparably to GPT-4o for most security automation tasks.</p>
]]></content:encoded></item></channel></rss>