Inspiration

What it does

Agent-2: Autonomous AI Security & Engineering Framework

Agent-2 Banner

Inspiration

Modern cybersecurity, penetration testing, and complex software engineering workflows are often fragmented across dozens of disconnected CLI utilities, web proxies, and static scripts. Security researchers and developers frequently lose critical context when switching between vulnerability scanners, code editors, and terminal interfaces.

Agent-2 was inspired by the vision of creating a unified, truly autonomous AI engineering and offensive/defensive security companion. Instead of acting as a simple chat wrapper, Agent-2 was designed from the ground up to reason over Directed Acyclic Graphs (DAG), learn from user preferences via a Pretrained Intelligence Layer (PIL), and interface directly with industry-standard security tools like Burp Suite and OWASP ZAP through the Model Context Protocol (MCP).


About Agent-2

Agent-2 is a next-generation, multi-modal autonomous agent platform that operates seamlessly across both an interactive Command Line Interface (CLI) and a real-time Web Dashboard (or simultaneously via Dual-Mode).

Core Architectural Pillars:

  • Directed Acyclic Graph (DAG) Execution Engine: Breaks down complex, multi-stage objectives into validated, scheduled, and recoverable task nodes (agent2/core/dag/).
  • UltraCode Engine: A multi-stage autonomous coding, planning, diffing, and verification pipeline (agent2/core/ultracode/) capable of deep project scanning and automated refactoring.
  • Security & MCP Integrations: Native Model Context Protocol (MCP) bridges for Burp Suite (burp_mcp.py) and OWASP ZAP (zap_mcp.py), allowing the agent to autonomously intercept, analyze, and replay web traffic.
  • File Intelligence (FileIntel): A plugin-driven ingestion and analysis router (agent2/fileintel/) supporting source code, archives, spreadsheets, presentations, documents, media, and images.
  • Pretrained Intelligence Layer (PIL): An adaptive local learning subsystem (agent2/core/pil/) featuring custom grammar constraints, vocabulary seed data, and predictive optimization.
  • Resilience & Crash Recovery: Built-in execution state snapshotting, WAL checkpointing, isolated context brokers, and automated failsafes (agent2/core/recovery/).

Explore the repository and contribute on GitHub.


Real-World Impact: Critical Vulnerability Discovery

During authorized penetration testing and security assessments, Agent-2 demonstrated its autonomous offensive security capabilities by identifying and chaining a critical vulnerability that resulted in a CVSS 10.0 / 10.0 finding: Unauthenticated Remote Code Execution (RCE) leading to full Root Takeover.

Vulnerability Summary

  • Severity: Critical (CVSS v3.1 Score: 10.0 / 10.0)
  • Impact: Remote Code Execution (RCE) + Full Root Privilege Escalation / System Takeover
  • Context: Authorized Security Testing & Autonomous Vulnerability Research

By leveraging its Dynamic Workflow Runner, Burp/ZAP MCP integrations, and Context Broker Isolation, Agent-2 autonomously mapped the target attack surface, analyzed anomalous response diffs, synthesized a custom payload to achieve initial RCE, and subsequently enumerated local system misconfigurations to escalate privileges to root.

# Example: Agent-2 Vulnerability Verification Log Output
puts "[+] Authorized Target Scope Verified"
puts "[!] Critical Anomaly Detected: Unsanitized Command Execution Sink"
puts "[*] Chaining Vector: RCE -> Privilege Escalation (UID 0 / root)"
puts "[+] CVSS Score Calculated: 10.0 / 10.0 (Critical - Root Takeover Confirmed)"

Agent-2 Architecture Preview


Languages, Frameworks, and Technologies Used

Based on the Agent-2 repository structure, the platform is built using a modern, security-hardened polyglot stack:

1. Programming & Scripting Languages

  • Python 3: The primary language powering the core agent loop (agent.py), CLI (agent2cli.py), Web Server (agent2web.py), Dual-Mode (agent2dual.py), DAG engine, UltraCode, PIL, and GitHub automation bot (ap_bot).
  • JavaScript (ES6+): Powers the real-time interactive frontend client (public/script.js), WebSocket state synchronization, and dynamic UI rendering.
  • HTML5 & CSS3: Structures and styles the web interface (public/style.css, agent2/server/ui.py).
  • Bash / Shell (sh): Used for container entrypoints and Linux/macOS automated deployment (docker-entrypoint.sh, docker/dockerinstall.sh).
  • PowerShell (ps1): Used for Windows Docker environment setup and installation (docker/dockerinstall.ps1).
  • SQL: Used for persistent state management, WAL checkpointing, connection pooling, and migrations (agent2/database.py).

2. Data, Configuration & Markup Formats

  • TOML: Project packaging, build configuration (pyproject.toml), and secret scanning rules (.gitleaks.toml).
  • YAML: GitHub Actions CI/CD workflows (.github/workflows/), Dependabot, issue templates, and container orchestration (docker-compose.yml).
  • CSV: Pretraining seed datasets for the PIL engine (phrases.csv, prefs.csv, prompts.csv, vocab.csv).
  • Markdown & Text: System prompts (.github/ap_bot/prompts/), documentation, and automated PR/Issue templates.

3. Frameworks, Protocols & Core Libraries

  • Model Context Protocol (MCP): Standardized protocol architecture (mcp_base.py) for connecting LLMs to external security tools and local context brokers.
  • Multi-Provider LLM Router: Resilient LLM orchestration (agent2/llm/) supporting Google Gemini (gemini.py) and other major AI providers with automatic failover, capability detection, and API key rotation (keyring.py).
  • WebSockets & HTTP Server: Real-time bidirectional communication (sockets.py, routes.py, auth.py) between the agent runtime and web UI.
  • Rich Terminal UX / TUI: Custom CLI rendering engine (agent2/cli/) featuring interactive command palettes (palette.py), syntax highlighting (highlight.py), diff views (diffview.py), themes, and status bars.
  • SQLite (with WAL Mode) & Database Pooling: High-concurrency local relational storage with Write-Ahead Logging and idle/failsafe pool management.
  • Pytest: Comprehensive automated test suite (.github/tests/) covering DAG scheduling, authz, crash recovery, MCP bridges, and performance guards.

4. Security, DevOps & Infrastructure Tools

  • Burp Suite Integration: Autonomous web security testing via burp_mcp.py.
  • OWASP ZAP Integration: Automated vulnerability scanning and proxy control via zap_mcp.py.
  • Docker & Docker Compose: Full containerization and sandboxed execution (Dockerfile, agent2_docker.py, docker-compose.yml).
  • GitHub Actions & ap_bot: Custom AI-powered DevOps bot powered by Gemini for automated code review, security review, spam detection, duplicate issue detection, and release notes generation.
  • CodeQL & Gitleaks: Static Application Security Testing (SAST) and automated secret detection integrated into the CI pipeline. ## How we built it

Challenges we ran into

Accomplishments that we're proud of

What we learned

What's next for Agent-2

Built With

Share this project:

Updates

Submission history