# hakanotal/agentic-ctf-nyu architecture

> Architecture diagram of the GitHub repository hakanotal/agentic-ctf-nyu, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-03-29). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/hakanotal/agentic-ctf-nyu
- Repository: https://github.com/hakanotal/agentic-ctf-nyu

## Overview

- The NYU CTF Baseline agent – a single, straightforward agent.
- The D-CIPHER multi-agent system – a more complex setup with separate planner, executor, and (optionally) auto-prompter agents.
It is designed to run in Docker-based environments and leverages multiple backends (e.g., OpenAI, Anthropic, VLLM, Gemini, Ollama) as well as dedicated prompt templates and tool integrations (including specialized scripts like those for Ghidra).

##### And Lay Out the Main Components
a. Docker Environment:
- Two primary Docker setups (one for Baseline and one for Multiagent/D-CIPHER). Note the “docker/baseline” and “docker/multiagent” directories, including their specific entrypoint.sh scripts and Dockerfiles.
b. Agent Systems:
- Baseline Agent: A component marked by the “run_baseline.py” entrypoint and its corresponding configuration files (configs/baseline).
- D-CIPHER Multi-agent System: A higher level “D-CIPHER” orchestration comprising multiple interacting agents:
- Planner Agent
- Executor Agent (or a Single Executor for the ablation experiment via “run_single_executor.py”)
- (Optional) Auto-Prompter Agent
- Each of these agents is further detailed by its configuration files (configs/dcipher, configs/single_executor) and may interact with multiple prompt files.
c. Backend Integrations:
- Components for the various “backends” contained in the nyuctf_baseline/backends and nyuctf_multiagent/backends directories.
- Each backend (for example, openai_backend.py, anthropic_backend.py, vllm_backend.py, gemini_backend.py, ollama_backend.py, together_backend.py) should be represented as services the agents call upon.
d. Prompt and Tool Management:
- “prompts” and “templates” folders from both nyuctf_baseline/prompts and the configurations in the configs directories.
- A node for the Tools modules (nyuctf_baseline/tools and nyuctf_multiagent/tools) that assist agents in interacting with external systems, such as running reverse engineering tasks or executing system commands.
e. Auxiliary Components:
- Additional scripts (in the “scripts” directory) used for logging, plotting results, and summarizing database/flag information.
- Integration points for Ghidra scripts (both in the nyuctf_baseline/ghidra_scripts and in the docker/multiagent/ghidra_scripts directories). These are specialized components for binary analysis that might be crucial in CTF challenges.

##### Relationships and Data Flows
a. Command-Line Entry Points:
- Use nodes representing the “run_baseline.py”, “run_dcipher.py”, and “run_single_executor.py” scripts. These serve as entry points that kick off the system.
b. Configuration Flow:
c. Interactions Between Agents:
d. Communication with External LLM Providers:
e. Tool and Script Invocation:
- How agents interact with the Tools components to perform domain-specific actions (e.g., decompiling, disassembly) based on challenge requirements.

##### Important Architectural Patterns and Design Principles
a. Separation of Concerns:
b. Modularity & Configurability:
- That different components (agents, backends, prompt templates) are plug-and-play, with configurations driving behavior.
c. Containerized Deployment:
- Design around Docker containerization, ensuring that both the baseline and multiagent environments are encapsulated and isolated.
d. Extensibility:
- That adding new tools, prompt templates, or backend integrations can be done by extending the existing directory structure (e.g., new files in configs or prompts directories).

##### Final Advice
- Be as detailed as possible by breaking down each high-level component into internal subcomponents (for example, show that the multiagent system has separate modules for “Backends”, “Prompt Templates”, and “Tool Integrations”).

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Docker Environment
    subgraph "Docker Environment"
        a1["Baseline Docker: Dockerfile"]:::docker
        a2["Baseline Docker: Entrypoint.sh"]:::docker
        a3["Multiagent Docker: Dockerfile"]:::docker
        a4["Multiagent Docker: Entrypoint.sh"]:::docker
        a5["Multiagent Docker: Ghidra Scripts"]:::docker
    end

    %% Command-Line Entry Points
    subgraph "Command-Line Entry Points"
        b1["run_baseline.py"]:::agent
        b2["run_dcipher.py"]:::agent
        b3["run_single_executor.py"]:::agent
    end

    %% Configuration Files
    subgraph "Configurations"
        c1["configs/baseline"]:::config
        c2["configs/dcipher"]:::config
        c3["configs/single_executor"]:::config
    end

    %% Agent Systems
    subgraph "Agent Systems"
        d1["Baseline Agent (nyuctf_baseline)"]:::agent
        d1a["Backends: nyuctf_baseline/backends"]:::integrations
        d1b["Prompts: nyuctf_baseline/prompts"]:::tool
        d1c["Tools: nyuctf_baseline/tools"]:::tool
        d1d["Ghidra Scripts: nyuctf_baseline/ghidra_scripts"]:::auxiliary

        d2["D-CIPHER Multi-agent System (nyuctf_multiagent)"]:::agent
        d2a["Planner Agent"]:::agent
        d2b["Executor Agent"]:::agent
        d2c["Auto-Prompter Agent(Optional)"]:::agent
        d2d["Backends: nyuctf_multiagent/backends"]:::integrations
        d2e["Tools: nyuctf_multiagent/tools"]:::tool
    end

    %% Auxiliary Components
    subgraph "Auxiliary Components"
        e1["Scripts"]:::auxiliary
    end

    %% Connections between Entry Points and Configurations
    b1 -->|"uses"| c1
    b2 -->|"uses"| c2
    b3 -->|"uses"| c3

    %% Configurations feed into Agent Systems
    c1 -->|"configures"| d1
    c2 -->|"configures"| d2
    c3 -->|"configures"| d2

    %% Docker hosts and initiates Agents
    a1 -->|"hosts"| d1
    a2 -->|"initiates"| d1
    a3 -->|"hosts"| d2
    a4 -->|"initiates"| d2
    a5 -->|"provides"| d2

    %% Baseline Agent internal integrations
    d1 -->|"calls"| d1a
    d1 -->|"uses"| d1b
    d1 -->|"invokes"| d1c
    d1 -->|"analyzes"| d1d

    %% D-CIPHER Multi-agent internal breakdown
    d2 --> d2a
    d2 --> d2b
    d2 --> d2c
    d2a -->|"task_delegation"| d2b
    d2a -->|"prompt_generation"| d2c
    d2b -->|"feedback_loop"| d2a
    d2 -->|"calls"| d2d
    d2 -->|"invokes"| d2e

    %% Agents logging to Auxiliary Scripts
    d1 -->|"logs"| e1
    d2 -->|"logs"| e1

    %% Click Events
    click a1 "https://github.com/hakanotal/agentic-ctf-nyu/tree/main/docker/baseline/Dockerfile"
    click a2 "https://github.com/hakanotal/agentic-ctf-nyu/blob/main/docker/baseline/entrypoint.sh"
    click a3 "https://github.com/hakanotal/agentic-ctf-nyu/tree/main/docker/multiagent/Dockerfile"
    click a4 "https://github.com/hakanotal/agentic-ctf-nyu/blob/main/docker/multiagent/entrypoint.sh"
    click a5 "https://github.com/hakanotal/agentic-ctf-nyu/tree/main/docker/multiagent/ghidra_scripts"

    click b1 "https://github.com/hakanotal/agentic-ctf-nyu/blob/main/run_baseline.py"
    click b2 "https://github.com/hakanotal/agentic-ctf-nyu/blob/main/run_dcipher.py"
    click b3 "https://github.com/hakanotal/agentic-ctf-nyu/blob/main/run_single_executor.py"

    click c1 "https://github.com/hakanotal/agentic-ctf-nyu/tree/main/configs/baseline"
    click c2 "https://github.com/hakanotal/agentic-ctf-nyu/tree/main/configs/dcipher"
    click c3 "https://github.com/hakanotal/agentic-ctf-nyu/tree/main/configs/single_executor"

    click d1 "https://github.com/hakanotal/agentic-ctf-nyu/tree/main/nyuctf_baseline"
    click d1a "https://github.com/hakanotal/agentic-ctf-nyu/tree/main/nyuctf_baseline/backends"
    click d1b "https://github.com/hakanotal/agentic-ctf-nyu/tree/main/nyuctf_baseline/prompts"
    click d1c "https://github.com/hakanotal/agentic-ctf-nyu/tree/main/nyuctf_baseline/tools"
    click d1d "https://github.com/hakanotal/agentic-ctf-nyu/tree/main/nyuctf_baseline/ghidra_scripts"

    click d2 "https://github.com/hakanotal/agentic-ctf-nyu/tree/main/nyuctf_multiagent"
    click d2d "https://github.com/hakanotal/agentic-ctf-nyu/tree/main/nyuctf_multiagent/backends"
    click d2e "https://github.com/hakanotal/agentic-ctf-nyu/tree/main/nyuctf_multiagent/tools"

    click e1 "https://github.com/hakanotal/agentic-ctf-nyu/tree/main/scripts"

    %% Styles
    classDef docker fill:#ADD8E6,stroke:#000,stroke-width:1px;
    classDef agent fill:#90EE90,stroke:#000,stroke-width:1px;
    classDef config fill:#FFFFE0,stroke:#000,stroke-width:1px;
    classDef integrations fill:#FFD580,stroke:#000,stroke-width:1px;
    classDef tool fill:#E6E6FA,stroke:#000,stroke-width:1px;
    classDef auxiliary fill:#D3D3D3,stroke:#000,stroke-width:1px;
```
