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]
Doc: Setting up custom container (#553)
Kilian Lieret14a51895c45f
diff --git a/docs/config/docker.md b/docs/config/docker.mdnew file mode 100644index 00000000..79c21932--- /dev/null+++ b/docs/config/docker.md@@ -0,0 +1,19 @@+# Build your own agent Docker image++This section is about modifying the Docker image in which we run the commands suggested by the agent.++There are two reasons to build your own Docker image++1. You need a very specific environment to install your package (anything that you cannot simply install inside of a conda environment)+2. You want to pre-install your package for [speedup](../usage/cl_tutorial.md#speedup).++There are three steps involved:++1. Modify the [`swe.Dockerfile` Dockerfile](https://github.com/princeton-nlp/SWE-agent/blob/main/docker/swe.Dockerfile).+ We provide some extended explanation of the Dockerfile [here](https://github.com/princeton-nlp/SWE-agent/blob/main/docker/README.md).+2. Build the image. One way is to simply run `./setup.sh`. Alternatively, especially if you want to change the default tag (`sweagent/swe-agent:latest`), run+ ```bash+ docker build -t "YOUR TAG HERE" -f docker/swe.Dockerfile \+ --build-arg TARGETARCH=$(uname -m) .+ ```+3. Make sure you use the new image by passing the `--image_name` flag to `run.py`.\ No newline at end of filediff --git a/docs/usage/cl_tutorial.md b/docs/usage/cl_tutorial.mdindex 6e113b63..305f842d 100644--- a/docs/usage/cl_tutorial.md+++ b/docs/usage/cl_tutorial.md@@ -127,7 +127,9 @@ The config file can have the following keys:* `install`: A custom command* `post_install`: A list of custom commands-## Speeding up SWE-agent+If you have very specific requirements, that can _not_ be installed via conda, you can [create a custom Docker image](../config/docker.md).++## Speeding up SWE-agent <a name="speedup"></a>!!! tip "Speed up in v0.6"SWE-agent v0.6 (June 4th, 2024) introduced major speedups. Please upgrade to the latest version.@@ -137,7 +139,7 @@ After the Docker container has been started, the target repository cloned/copiedalmost all of the remaining runtime can be attributed to waiting for your LM provider to answer your API calls.Therefore, speeding SWE-agent is mostly about speeding up the setup stages.-We currently offer two ways to cache the setup stages:+We currently offer three ways to cache the setup stages:* By specifying `--container_name`, you run SWE-agent with a _persistent_ Docker container: Rather than being deletedafter every task, the Docker container will only be paused and can be resumed. Cloned repositories from previous@@ -148,6 +150,8 @@ We currently offer two ways to cache the setup stages:Unlike the persistent containers, there will be a new image _for almost every base commit_ (that is, probabyl for every taskwhen evaluating on a benchmark), which makes this only relevant when running over the same tasks more than once(for example when testing different agent configurations or LMs).+* You can also [build your own Docker image](../config/docker.md) and ensure that all relevant conda environments and repositories+ are available (check the logs from the previous runs to get the names for repositories and environments).!!! tip "Confused about the two options?"Probably `--container_name my_container_name` will do what you want.diff --git a/mkdocs.yml b/mkdocs.ymlindex e6d89987..dbaff723 100644--- a/mkdocs.yml+++ b/mkdocs.yml@@ -70,6 +70,7 @@ nav:- "Command definitions": "config/commands.md"- "Demonstrations": "config/demonstrations.md"- "Environment variables": "config/env.md"+ - "Docker images": "config/docker.md"- Development:- "Contribution guide": "dev/contribute.md"- "Formatting conflicts": "dev/formatting_conflicts.md"