Configuration
This page contains details describing how to write your own configurations to control how agents can interact with the SWEEnv
environment.
A configuration is represented in one or more .yaml
files, specified by the --config
flag in the command line interface, allowing you to...
- Define the tools that agents may use to traverse + modify a codebase.
- Write prompts that are deterministically/conditionally shown to the agent over the course of a single trajectory.
- Use demonstrations to guide the agent's behavior.
- Change the model behavior of the agent.
- Control the input/output interface that sits between the agent and the environment
Default config files
Our default config files are in the config/
directory.
For multimodal support, use config/default_mm_with_images.yaml
which includes image processing capabilities.
To use a config file, you can use the --config
flag in the command line interface.
sweagent run --config config/your_config.yaml
sweagent run-batch --config config/your_config.yaml
You can also use more than one config file, e.g., --config config/default.yaml --config my_config.yaml
(note that you need to repeat --config
).
Config options are merged in a nested way.
This is the current default configuration file which is loaded when no --config
flag is provided:
default.yaml
# Formerly called: anthropic_filemap.yaml
# This template is heavily inspired by anthropic's computer use demo, but you can use
# it with any LM.
agent:
templates:
system_template: |-
You are a helpful assistant that can interact with a computer to solve tasks.
instance_template: |-
<uploaded_files>
{{working_dir}}
</uploaded_files>
I've uploaded a python code repository in the directory {{working_dir}}. Consider the following PR description:
<pr_description>
{{problem_statement}}
</pr_description>
Can you help me implement the necessary changes to the repository so that the requirements specified in the <pr_description> are met?
I've already taken care of all changes to any of the test files described in the <pr_description>. This means you DON'T have to modify the testing logic or any of the tests in any way!
Your task is to make the minimal changes to non-tests files in the {{working_dir}} directory to ensure the <pr_description> is satisfied.
Follow these steps to resolve the issue:
1. As a first step, it might be a good idea to find and read code relevant to the <pr_description>
2. Create a script to reproduce the error and execute it with `python <filename.py>` using the bash tool, to confirm the error
3. Edit the sourcecode of the repo to resolve the issue
4. Rerun your reproduce script and confirm that the error is fixed!
5. Think about edgecases and make sure your fix handles them as well
Your thinking should be thorough and so it's fine if it's very long.
next_step_template: |-
OBSERVATION:
{{observation}}
next_step_no_output_template: |-
Your command ran successfully and did not produce any output.
tools:
env_variables:
PAGER: cat
MANPAGER: cat
LESS: -R
PIP_PROGRESS_BAR: 'off'
TQDM_DISABLE: '1'
GIT_PAGER: cat
bundles:
- path: tools/registry
- path: tools/edit_anthropic
- path: tools/review_on_submit_m
registry_variables:
USE_FILEMAP: 'true'
SUBMIT_REVIEW_MESSAGES:
- |
Thank you for your work on this issue. Please carefully follow the steps below to help review your changes.
1. If you made any changes to your code after running the reproduction script, please run the reproduction script again.
If the reproduction script is failing, please revisit your changes and make sure they are correct.
If you have already removed your reproduction script, please ignore this step.
2. Remove your reproduction script (if you haven't done so already).
3. If you have modified any TEST files, please revert them to the state they had before you started fixing the issue.
You can do this with `git checkout -- /path/to/test/file.py`. Use below <diff> to find the files you need to revert.
4. Run the submit command again to confirm.
Here is a list of all of your changes:
<diff>
{{diff}}
</diff>
enable_bash_tool: true
parse_function:
type: function_calling
history_processors:
- type: cache_control
last_n_messages: 2
Relative paths
Relative paths in config files are resolved to the SWE_AGENT_CONFIG_ROOT
environment variable (if set)
or the SWE-agent repository root.
Multimodal Configuration
For working with images and vision-capable models, SWE-agent provides specialized multimodal configuration options.
These options are best demonstrated in default_mm_with_images.yaml
.
This configuration enables full image processing capabilities:
- SWE-bench Multimodal Image processing: Downloads and converts GitHub issue images to base64 format for SWE-bench Multimodal instances.
- Extended observation length: Increases observation token limits to accommodate images
- Image tools: Includes
image_tools
bundle for viewing images - Web browsing tools: Includes
web_browser
bundle for using web browsers - History processing: Enables
image_parsing
history processor for parsing
Key Multimodal Settings
agent:
templates:
disable_image_processing: false # enable/disable image processing
max_observation_length: 10_000_000 # increased for images
tools:
bundles:
- path: tools/image_tools # image viewing capabilities
- path: tools/web_browser # browser automation tools
history_processors:
- type: image_parsing # process image tools outputs (required for tools to work)
See the multimodal guide for detailed configuration options.