SWE-agent takes a GitHub issue and tries to automatically fix it, using your LM of choice. It can also be employed for offensive cybersecurity or competitive coding challenges. [NeurIPS 2024]
added more enigma documentation
Talor Abramovichc9ed665ad6cb
diff --git a/docs/enigma/iat.md b/docs/background/iat.mdsimilarity index 95%rename from docs/enigma/iat.mdrename to docs/background/iat.mdindex ffba24ac..5f736f50 100644--- a/docs/enigma/iat.md+++ b/docs/background/iat.md@@ -1,4 +1,4 @@-# Interactive Agent Tool (IAT)+# Interactive Agent Tools (IATs)Tools useful for debugging (`gdb`, `radare2`), remote server interaction (`netcat`, `socat`) and penetration testing (`metasploit`) are widely used during CTF problem-solving and by cybersecurity experts. These tools are all interactive, i.e., they wait for user input, evaluate it, and print the results (read-eval-print loop, REPL).Current LM agents, which build their ACI around a running shell as central REPL, lack the ability to nest REPLs or start separate REPLs for interactive tools.diff --git a/docs/background/index.md b/docs/background/index.mdindex cbc52ca9..bb2e0ff7 100644--- a/docs/background/index.md+++ b/docs/background/index.md@@ -1,8 +1,10 @@-# Learn more about the SWE-agent project.+# Learn more about the project.-This section of the documentation talks about the architecture and research goals of SWE-agent.+This section of the documentation talks about the architecture and research goals of SWE-agent and EnIGMA.-Just want to run SWE-agent? Skip ahead to our [installation notes](../installation/index.md).+Just want to run SWE-agent or EnIGMA? Skip ahead to our [installation notes](../installation/index.md).++## SWE-agentSWE-agent turns LMs (e.g. GPT-4) into software engineering agents that can fix issues in GitHub repositories.@@ -29,4 +31,30 @@ If you found this work helpful, please consider using the following citation:author={John Yang and Carlos E. Jimenez and Alexander Wettig and Kilian Lieret and Shunyu Yao and Karthik Narasimhan and Ofir Press},year={2024},}+```++## EnIGMA++EnIGMA (Enhanced Interactive Generative Model Agent) is an LM agent built on top of SWE-agent for solving Capture The Flag (CTF) cybersecurity challenges.++The challenges range in various categories: cryptography, reverse-engineering, forensics, binary exploitation, web security and miscellaneous.++On [NYU CTF benchmark](https://github.com/NYU-LLM-CTF/LLM_CTF_Database), EnIGMA solves **13.5%** of challenges, achieving the state-of-the-art performance on the full test set of 200 CTF challenges.++We accomplish our results by extending the [🤖 ACIs](../background/aci.md) first introduced in SWE-agent, to the cybersecurity domain. We establish the novel **:gear: Interactive Agent Tools** (IATs) concept, which enables our agent to use interactive tools such as a debugger, in a multiprocess way such that the agent still has access to the main shell. Read more about IAT [here](iat.md).++We also use a new **Summarizer** concept integrated into the agent to deal with long context. Read more about our different summarizers [here](../config/summarizers.md).++Specific [demonstrations](../config/demonstrations.md) were built per each CTF category, to enhance the model ability to solve new tasks from the same category.++EnIGMA is built and maintained by researchers from Tel-Aviv University, New York University and Princeton University.++For a quick introduction, watch the following video:++// Add video here++If you found this work helpful, please consider using the following citation:++```+add bibtex here```\ No newline at end of filediff --git a/docs/config/env.md b/docs/config/env.mdindex f899c300..f2b70e76 100644--- a/docs/config/env.md+++ b/docs/config/env.md@@ -10,6 +10,7 @@ This page details all environment variables that are currently in use by SWE-age* `SWE_AGENT_CONFIG_ROOT`: Used to resolve relative paths in the [config](config.md)* `SWE_AGENT_ENV_LONG_TIMEOUT` (default: 500): Timeout in seconds used for commands that install instance environment.* `SWE_AGENT_ACTION_TIMEOUT` (default: 25): Timeout in seconds used for commands issued by the agent+* `SWE_AGENT_ACTION_NO_OUTPUT_TIMEOUT` (default: equal to `SWE_AGENT_ACTION_TIMEOUT`): Timeout in seconds used when no output is produced for the defined duration for commands issued by the agent* `SWE_AGENT_MODEL_MAX_RETRIES` (default: 10): Maximum retries when querying the modelThe following three variables can only be set as environment variables, not in the config filediff --git a/docs/config/summarizers.md b/docs/config/summarizers.mdindex 2e1c79f6..f3e503fe 100644--- a/docs/config/summarizers.md+++ b/docs/config/summarizers.md@@ -1,2 +1,32 @@# Summarizers Configuration+LMs perform best if given concise inputs; superfluous context can degrade performance while increasing costs. Because agents require LMs to process entire trajectories, compressing context is of particular importance.++We designed two summarizers to handle long output commands. The first, a ***simple summarizer***, saves the command output to a file if it exceeds a certain configurable line count. We show an indicative warning to the agent and tell it to open the saved command output using the built-in SWE-agent utility `open`.++The second, an ***LM summarizer***, integrates with the main agent to enhance its problem-solving efficacy and avoid exceeding input length limitations. It employs the same model (though can be configured differently) as the main agent; it receives a configurable prompt containing some context about the problem, the most recent action taken by the main agent, and any observations from that action exceeding a configurable line count threshold. The LM summarizer then generates a concise summary of the observation that is directly relevant to the ongoing problem. This summary is sent to the main agent, accompanied by a warning message indicating that the command output was summarized due to exceeding the line count limit.++The summarizer configuration is defined within the main [configuration](config.md) `.yaml` file, and has the following structure:++```yaml+summarizer_config:+ function: Reference to functionality of the summarizer. Can be one of SimpleSummarizer, LMSummarizer or Identity+ window_length: Threshold of the line count limit. Observation output exceeding these number, will be summarized.+ system_template: |-+ First `system` message shown to the LMSummarizer.+ This has no effect in other summarizer functionalities.+ instance_template: |-+ Instance prompt, contains task instance-specific content,+ the most recent action taken by the main agent,+ and any observations from that action exceeding the line count threshold.+ This has effect only for the LM Summarizer functionality.+ model: [Optional configuration of a different model,+ if not configured the same model as the main agent model will be used.+ This has effect only for the LM Summarizer functionality.]+ model_name: Name of the model to use+ per_instance_cost_limit: Cost limit for every instance (task)+ total_cost_limit: Total cost limit for summarizer only+ temperature: Sampling temperature+ top_p: Sampling top-p+ host_url: Host URL when using Ollama model+```diff --git a/docs/enigma/index.md b/docs/enigma/index.mddeleted file mode 100644index b89e1ed9..00000000--- a/docs/enigma/index.md+++ /dev/null@@ -1,29 +0,0 @@-# Learn more about the EnIGMA project.--This section of the documentation talks about the architecture and research goals of EnIGMA.--Just want to run EnIGMA? Skip ahead to our [installation notes](../installation/index.md).--EnIGMA (Enhanced Interactive Generative Model Agent) is an LM agent built on top of SWE-agent for solving Capture The Flag (CTF) cybersecurity challenges.--The challenges range in various categories: cryptography, reverse-engineering, forensics, binary exploitation, web security and miscellaneous.--On [NYU CTF benchmark](https://github.com/NYU-LLM-CTF/LLM_CTF_Database), EnIGMA solves **13.5%** of challenges, achieving the state-of-the-art performance on the full test set of 200 CTF challenges.--We accomplish our results by extending the [🤖 Agent-Computer Interfaces (ACIs)](../background/aci.md) first introduced in SWE-agent, to the cybersecurity domain. We establish the novel **:gear: Interactive Agent Tools** (IATs) concept, which enables our agent to use interactive tools such as a debugger, in a multiprocess way such that the agent still has access to the main shell. Read more about IAT [here](iat.md).--We also use a new **Summarizer** concept integrated into the agent to deal with long context. Read more about our different summarizers [here](../config/summarizers.md).--Specific [demonstrations](../config/demonstrations.md) were built per each CTF category, to enhance the model ability to solve new tasks from the same category.--EnIGMA is built and maintained by researchers from Tel-Aviv University, New York University and Princeton University.--For a quick introduction, watch the following video:--// Add video here--If you found this work helpful, please consider using the following citation:--```-add bibtex here-```\ No newline at end of filediff --git a/docs/index.md b/docs/index.mdindex 10d429d8..28f0ddbc 100644--- a/docs/index.md+++ b/docs/index.md@@ -14,6 +14,15 @@ SWE-agent turns LMs (e.g. GPT-4) into software engineering agents that can fix b[:octicons-arrow-right-24: Learn more](background/index.md)++- :material-hat-fedora:{ .lg .middle } __EnIGMA__++ ---++ EnIGMA agent turns SWE-agent to a cybersecurity expert that can solve Capture The Flag (CTF) challenges.++ [:octicons-arrow-right-24: Learn more](background/index.md#enigma)+- :material-download:{ .lg .middle } __Installation__---@@ -55,12 +64,4 @@ SWE-agent turns LMs (e.g. GPT-4) into software engineering agents that can fix bDig into SWE-agent's code and build your own agent--- :material-hat-fedora:{ .lg .middle } __EnIGMA__-- ----- EnIGMA agent turns SWE-agent to a cybersecurity expert that can solve Capture The Flag (CTF) challenges.-- [:octicons-arrow-right-24: Learn more](enigma/index.md)</div>diff --git a/docs/installation/docker.md b/docs/installation/docker.mdindex 986ead52..b96a9cab 100644--- a/docs/installation/docker.md+++ b/docs/installation/docker.md@@ -3,7 +3,7 @@Instead of installing SWE-agent from source, you can also run the software directly using Docker.1. Install Docker ([follow the docs](https://github.com/docker/docker-install) or use the [get-docker.sh script for linux](https://github.com/docker/docker-install)), then start Docker locally. Problems? See [docker issues](tips.md#docker).-2. Run `docker pull sweagent/swe-agent:latest`+2. Run `docker pull sweagent/swe-agent:latest`. *Optional*: If you want to use EnIGMA run also `docker pull sweagent/enigma:latest`.3. Add your API tokens to a file `keys.cfg` as explained [here](keys.md) or pass them asenvironment variables.@@ -21,6 +21,21 @@ docker run --rm -it -v /var/run/docker.sock:/var/run/docker.sock \--config_file config/default_from_url.yaml --skip_existing=False```+For EnIGMA you should run++```bash+docker run --rm -it -v /var/run/docker.sock:/var/run/docker.sock \+ -v $(pwd)/keys.cfg:/app/keys.cfg \+ sweagent/swe-agent-run:latest \+ python run.py --image_name=sweagent/enigma:latest \+ --model_name gpt4 \+ --data_path /path/to/challenge.json \+ --repo_path /path/to/repo+ --config_file config/default_ctf.yaml --skip_existing=False+```++For more information about the command-line for running EnIGMA please read our [usage instrctions](../usage/enigma.md)+<details><summary>Output</summary>diff --git a/docs/installation/index.md b/docs/installation/index.mdindex 16f9daed..673f2dd5 100644--- a/docs/installation/index.md+++ b/docs/installation/index.md@@ -14,7 +14,7 @@---- Install SWE-agent from source using `pip`.+ Install SWE-agent or EnIGMA from source using `pip`.[:octicons-arrow-right-24: Get started](source.md)@@ -23,7 +23,7 @@---- Pull a docker container and directly run SWE-agent. This is our fallback solution if the local installation does not work for you.+ Pull a docker container and directly run SWE-agent or EnIGMA. This is our fallback solution if the local installation does not work for you.[:octicons-arrow-right-24: Get started](docker.md)@@ -31,7 +31,7 @@---- See what's new in SWE-agent+ See what's new in SWE-agent and EnIGMA[:octicons-arrow-right-24: Read the changelog](changelog.md)</div>diff --git a/docs/installation/source.md b/docs/installation/source.mdindex f2aead3e..b60e1040 100644--- a/docs/installation/source.md+++ b/docs/installation/source.md@@ -21,6 +21,10 @@ Installation from source is the preferred way to set up SWE-agent on your machin```bashdocker pull sweagent/swe-agent:latest```+ *Optional.* If you want to run EnIGMA for cybersecurity challenges, run also:+ ```bash+ docker pull sweagent/enigma:latest+ ```Errors? See [docker issues](tips.md#docker). Alternatively, you can run `./setup.sh` to create your own `swe-agent` docker image.6. Set up your LM API keys as explained [here](keys.md).diff --git a/docs/usage/cl_tutorial.md b/docs/usage/cl_tutorial.mdindex b4a0aa5a..b5a0c981 100644--- a/docs/usage/cl_tutorial.md+++ b/docs/usage/cl_tutorial.md@@ -1,6 +1,6 @@# Command line usage tutorial-This tutorial walks you trough running SWE-agent from the command line.+This tutorial walks you through running SWE-agent from the command line.Beginners might also be interested in the our web-based GUI (see [here](web_ui.md)).This tutorial focuses on using SWE-agent as a tool to solve individual issues.Benchmarking SWE-agent is covered [separately](benchmarking.md).diff --git a/docs/usage/enigma.md b/docs/usage/enigma.mdnew file mode 100644index 00000000..61078847--- /dev/null+++ b/docs/usage/enigma.md@@ -0,0 +1,9 @@+# EnIGMA Tutorial++This tutorial walks you through running EnIGMA from the command-line.+It is based on basic knowledge of the command-line of SWE-agent that is covered [here](cl_tutorial.md).+This tutorial focuses on using EnIGMA as a tool to solve individual CTF challenges.++## Getting Started++diff --git a/docs/usage/index.md b/docs/usage/index.mdindex 94f26bf3..3ad195ba 100644--- a/docs/usage/index.md+++ b/docs/usage/index.md@@ -20,4 +20,6 @@ We currently provide two interfaces to SWE-agent:[:octicons-arrow-right-24: Get started](web_ui.md)-</div>\ No newline at end of file+</div>++For EnIGMA usage, only the CLI is currently supported. [Get started here](enigma.md).\ No newline at end of filediff --git a/mkdocs.yml b/mkdocs.ymlindex 29639565..1926a384 100644--- a/mkdocs.yml+++ b/mkdocs.yml@@ -47,9 +47,10 @@ markdown_extensions:emoji_generator: !!python/name:material.extensions.emoji.to_svgnav:- Home: index.md- - Background:+ - Project Overview:- "background/index.md"- "Agent-Computer Interface": "background/aci.md"+ - "Interactive Agent Tools": "background/iat.md"- "Architecture": "background/architecture.md"- Installation:- "installation/index.md"@@ -62,6 +63,7 @@ nav:- Usage:- "usage/index.md"- "Command line usage": "usage/cl_tutorial.md"+ - "EnIGMA usage": "usage/enigma.md"- "Solving coding challenges": "usage/coding_challenges.md"- "Using the web UI": "usage/web_ui.md"- "Trajectories": "usage/trajectories.md"@@ -78,9 +80,6 @@ nav:- Development:- "Contribution guide": "dev/contribute.md"- "Formatting conflicts": "dev/formatting_conflicts.md"- - EnIGMA:- - "enigma/index.md"- - "Interactive Agent Tool": "enigma/iat.md"- Reference:- "reference/index.md"- "Agent": "reference/agent.md"