AB
AiBoss
project

SWE-agent - Princeton open-source AI programmer intelligent agent

SWE-agent is an open-source AI programmer and software engineer system developed by researchers in the NLP group at Princeton University. It leverages the capabilities of large language models (such as GPT-4) to automatically solve problems in GitHub repositories. ...

What is SWE-agent?

SWE-agent is an open-source AI programmer and software engineer system developed by researchers in the NLP group at Princeton University. Leveraging the capabilities of large language models (such as GPT-4), it can automatically solve problems in GitHub repositories. SWE-agent interacts with the codebase through an agent-computer interface (ACI), enabling it to perform tasks such as browsing, editing, testing, and executing code. On the SWE-bench test set, the system demonstrates accuracy similar to the closed-source AI programmer Devin, solving a problem in an average of 93 seconds, achieving state-of-the-art performance.

On 25% of the SWE-bench test set, SWE-agent achieved similar accuracy to Devin—solving 12.29% of the problems. SWE-agent is currently open source on GitHub, and the research paper will be released on April 10th.

SWE-agent official website entrance

Main functions of SWE-agent

  • Pull Request Issue SolvingSWE-agent can understand issues in GitHub repositories and attempt to fix them by creating pull requests.
  • Code editing and repairSWE-agent can browse and edit files in the codebase and automatically fix errors and vulnerabilities in the code.
  • Automatic syntax checkingDuring code editing, SWE-agent can run a linter (code inspection tool) to ensure that the code conforms to syntax rules.
  • File ViewerIt provides a specially built file viewer that can display 100 lines of code per rotation, supports vertical scrolling and search functions, so as to view and edit code more efficiently.
  • Full directory string searchSWE-agent has a full directory string search function, which can concisely list all files and code snippets that match the search criteria.
  • Commands and FeedbackThrough the agent-computer interface (ACI), the SWE-agent can receive and execute commands given in natural language and provide corresponding feedback.
  • Test writing and executionSWE-agent can write and execute test code to verify the effectiveness of the fix.

SWE-agent workflow

  • Understanding the problemFirst, SWE-agent uses Natural Language Processing (NLP) technology to understand the issue descriptions in GitHub repositories. This step relies on its internally integrated large language model (such as GPT-4), which is capable of parsing and understanding human-written issue reports.
  • Agent-Computer Interface (ACI)SWE-agent uses ACI to interact with the codebase. ACI is a set of command and feedback formats designed to simplify interaction between large models and computer systems. Through ACI, SWE-agent can browse the codebase, search files, view and edit code, and even execute code.
  • Code Analysis and FixAfter understanding the problem, SWE-agent analyzes the relevant code, locates potential errors or vulnerabilities, and generates a remediation plan. This may include modifying existing code, adding missing code, or refactoring the code structure.
  • Automated testingTo ensure the fix is effective, SWE-agent can automatically write and execute test cases. These test cases are designed to verify that the code changes resolved the original problem without introducing new errors.
  • Performance feedbackEach step performed by SWE-agent generates feedback, which is used to evaluate the effectiveness of its work. Specifically, in the SWE-bench benchmark test, SWE-agent evaluates whether the pull requests it generates truly solve the problem.
  • Iteration and optimizationThe design of SWE-agent allows for continuous iteration and optimization. The research team continuously improves the ACI design by collecting feedback and performance data from users, thereby enhancing SWE-agent's problem-solving capabilities and the accuracy of code fixes.