Swe Agent
SSwe 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]
Last verified:
What is Swe Agent?
Swe Agent is an open-source software engineering agent that turns language models (e.g., GPT-4o, Claude Sonnet 4) into autonomous AI agents capable of fixing issues in real GitHub repositories. Built by researchers from Princeton University and Stanford University, it achieves state-of-the-art performance on SWE-bench by resolving 12.29% of issues on the full test set. The system uses a novel Agent-Computer Interface (ACI) design with LM-centric commands and feedback formats to make it easier for language models to browse repositories, view, edit, and execute code files.
Key features include autonomous tool usage for fixing GitHub issues, offensive cybersecurity capabilities through SSwe Agent EnIGMA (which solves 13.5% of CTF challenges on NYU CTF benchmark, surpassing previous agents by 3x), support for multimodal models that can process images from GitHub issues, highly configurable single YAML file governance, and both command-line and web-based GUI interfaces. The system outputs trajectory files (.traj) containing complete records of the agent's thought process and actions, and includes a trajectory inspector for debugging and analysis.
SSwe Agent is designed primarily for researchers and developers who want to experiment with AI-powered software engineering automation. It is ideal for academic research on automated software engineering, developers who want to automatically fix GitHub issues in their repositories, cybersecurity researchers working on offensive security challenges, and anyone interested in hackable, research-focused AI agent systems. The tool supports any language model of choice, including local models, and can be used for custom tasks beyond just issue fixing.
Swe Agent pricing
Pricing model: Freemium
SWE-agent is completely free and open-source under the MIT license. There is no paid tier or subscription model. The only costs are API costs for the language models you choose to use (e.g., GPT-4o from OpenAI or Claude Sonnet 4 from Anthropic), which you pay directly to the model providers. You can also use free local models at no additional cost. Installation is free from the GitHub repository using pip.
Swe Agent pros
- State-of-the-art performance on SWE-bench among open-source projects (12.29% resolution rate)
- Supports any language model including GPT-4o, Claude Sonnet 4, and local models
- Fully configurable through a single YAML configuration file
- Open-source with MIT license
- Free-flowing and generalizable design that leaves maximal agency to the language model
- Built and maintained by researchers from Princeton and Stanford universities
- Includes offensive cybersecurity mode (EnIGMA) for CTF challenges
- Multimodal support for processing images from GitHub issues
- Simple and hackable by design, made for research
- Complete trajectory output files for debugging and analysis
- Both command-line interface and web-based GUI available
- Works on Windows, MacOS, and Linux with Docker support
- Can execute code in cloud-based environments if local Docker is unavailable
- Supports custom tools that users can add
- Trajectory inspector for visualizing agent thought process and actions
Swe Agent cons
- Now in maintenance-only mode, superseded by mini-swe-agent
- Requires Docker installation for local execution
- Docker container availability may limit some environments
- Most current development effort is on mini-swe-agent, not SWE-agent
- EnIGMA cybersecurity mode only available on version 0.7.0, not 1.0
- Requires API keys for proprietary models like GPT-4o or Claude
- Complex union type configuration errors can produce long confusing error messages
- Multimodal features require specific configuration and internet connectivity
Frequently asked questions about Swe Agent
Does SWE-agent run on Windows/MacOS/Linux?
Yes! SWE-agent runs on all three operating systems. The only limitation might be the availability of Docker containers for your environments. If you cannot run Docker locally, you can always execute SWE-agent in the cloud instead.
What models are supported? Do you support local models?
Probably all models are supported, including local models. There are even a few models specifically for testing purposes. You can use GPT-4o, Claude Sonnet 4, or any other language model of your choice by configuring it appropriately.
Does SWE-agent support multimodal models and images?
Yes! SWE-agent supports vision-capable models that can process images from GitHub issues. You need to use the --config config/default_mm_with_images.yaml flag and specify a multimodal model like Claude Sonnet 4 or GPT-4o. See the multimodal guide in the documentation for details.
What can I do if my model doesn't support function calling?
You can configure how to parse the model's response by choosing your agent.tools.parse_function option. The default is function_calling, but you can change it to thought_action. More information is available in the reference documentation, and there are config examples in the config folder.
How can I change the demonstrations given to SWE-agent?
At the start of each run, SWE-agent feeds the agent a demonstration trajectory showing it how to solve an example issue, which substantially improves the agent's abilities to solve novel issues. If you'd like to modify or totally change this demonstration to better fit your use case, you can refer to the documentation section on changing demonstrations.
Can I add custom tools?
Yes! You can add custom tools to SWE-agent. The documentation includes a tutorial on how to add custom tools, and this feature was added in the June 26 documentation update.
What's up with all the output files?
The most important output files are the *.traj files, which contain complete records of SWE-agent's thought process and actions as (thought, action, observation) turns. These trajectory files are the main output and the best way to understand what SWE-agent does. See the output files documentation for more information.
Why are my images not being processed?
Check that you're using a multimodal configuration (see default_mm_with_images.yaml as an example), have internet connectivity, and that images are under 10MB. See the Multimodal usage notes in the documentation for more details.
I got a very long error message about various configuration options not working. What's up?
This is probably because of union types. Some options (e.g., the repository or problem statement) can be specified in multiple ways, so SWE-agent tries every option until it finds the one that works based on your inputs. If none of them work, it throws an error that tells you why it cannot initialize any of the types, which results in a long and confusing error message.
What is the difference between SWE-agent and mini-swe-agent?
Mini-SWE-agent has superseded SWE-agent and is where most of the current development effort is focused. Mini-SWE-agent matches the performance of SWE-agent while being much simpler (it's only 100 lines of Python and achieves 65% on SWE-bench verified). SWE-agent is now in maintenance-only mode, and users are recommended to switch to mini-swe-agent for new projects.