Skip to content

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: Explain how to configure environment

Kilian Lieretf4df3dba3c9f
diff --git a/docs/installation/migration.md b/docs/installation/migration.md
index 3f9ec516..1b6b1652 100644
--- a/docs/installation/migration.md
+++ b/docs/installation/migration.md
@@ -12,7 +12,7 @@ Welcome to SWE-agent 1.0! So much new stuff! Here's a quick rundown of the cool
* :sparkles: Override any configuration option from the command line (see [command line basics](../usage/cl_tutorial.md)).
* :sparkles: Greatly simplified and cleaned up codebase. In particular, the `Agent` class is now much easier to modify.
-If you're familiar with the old SWE-agent, here are the main changes you need to be aware of
+If you're familiar with the old SWE-agent, here are the main changes you need to be aware of.
## Command line interface and basic configuration
@@ -22,6 +22,13 @@ If you're familiar with the old SWE-agent, here are the main changes you need to
* We have switched to a hierarchical configuration system. This means that command line options look something like this: `--agent.model.name=gpt-4o`.
The configuration files have also been updated to reflect this.
+## Environment setup
+
+We removed the complicated mess of environment setup options (`conda` environments, `pip`, docker images, etc.).
+Instead, you now always start from a docker image of your choice and we recommend that this should ship with all the dependencies you need.
+However, you can also execute additional commands before starting the agent with `EnvironmentConfig.post_startup_commands`.
+Additionally, every [tool bundle](../config/tools.md) can include a `setup.sh` script that will be executed, allowing to e.g., install `flake8` if needed by the tools.
+
## More advanced configuration
* Tools now live in tool bundles in the `tools/` directory. You can mix and match tools to your liking.
diff --git a/docs/usage/cl_tutorial.md b/docs/usage/cl_tutorial.md
index a8073334..1d519204 100644
--- a/docs/usage/cl_tutorial.md
+++ b/docs/usage/cl_tutorial.md
@@ -200,6 +200,22 @@ Again, those are [union types](#union-types). See here for all the options:
* [`LocalRepoConfig`](../reference/repo.md#sweagent.environment.repo.LocalRepoConfig): Copies a repository from your local filesystem to the docker container.
* [`PreExistingRepoConfig`](../reference/repo.md#sweagent.environment.repo.PreExistingRepoConfig): If you want to use a repository that already exists on the docker container.
+## Configuring the environment
+
+We mainly recommend you to build a docker image with all the dependencies you need and then use that with `--env.deployment.image`.
+In addition, you can also execute additional commands before starting the agent with `env.post_startup_commands` (this
+takes a list of commands, e.g.,
+
+```bash
+sweagent run \
+ --agent.model.name=claude-3-5-sonnet-20241022 \
+ --env.post_startup_commands='["pip install flake8"]' \ # (1)!
+ ...
+```
+
+1. Note the list syntax that is passed as a string using single ticks `'`. This is particularly important for `zsh` where `[`, `]` have special meaning.
+
+
## Taking actions
* You can use `--actions.apply_patch_locally` to have SWE-agent apply successful solution attempts to local files.