SWE-agent icon indicating copy to clipboard operation
SWE-agent copied to clipboard

Support agent working on codebases outside of python

Open cpendery opened this issue 1 year ago • 4 comments

It would be great to have the source code language be configurable beyond just python. It would involve tweaking some of the prompts

https://github.com/princeton-nlp/SWE-agent/blob/3d8a6c44f16f190735c774676fea80315cd84da5/config/default.yaml#L38

and also changing the shell scripts to customize the linter that is run for different languages like golangci-lint for Go, but I'm not sure limitations there might be.

https://github.com/princeton-nlp/SWE-agent/blob/3d8a6c44f16f190735c774676fea80315cd84da5/config/commands/edit_linting.sh#L72

cpendery avatar Apr 04 '24 18:04 cpendery

You can change the configs, so that's already possible. So in principle this is already supported.

klieret avatar Apr 04 '24 19:04 klieret

Three config files that rely on flake8 to produce either a file or snippit lint output:

  • https://github.com/princeton-nlp/SWE-agent/blob/68760dcaf66c4ec7937f23e2780af11ab8ba99d7/config/commands/cursors_edit_linting.sh#L40
  • https://github.com/princeton-nlp/SWE-agent/blob/68760dcaf66c4ec7937f23e2780af11ab8ba99d7/config/commands/edit_linting.sh#L72
  • https://github.com/princeton-nlp/SWE-agent/blob/68760dcaf66c4ec7937f23e2780af11ab8ba99d7/config/commands/_split_string.py#L4

Additionally flake8 is installed (inside the agent docker env?) at:

  • https://github.com/princeton-nlp/SWE-agent/blob/68760dcaf66c4ec7937f23e2780af11ab8ba99d7/sweagent/environment/swe_env.py#L211

Given that, it seems like the command configs for other languages could easily be adjusted, but is there any blocker or obvious workaround to needing a different linter installed and available inside the agent env?

zachblume avatar Apr 04 '24 23:04 zachblume

I think the core team is currently focusing on python, but as you said it seems like most of this is pretty language-agnostic (though of course you'd have to make sure that all the tools needed to compile & execute the language are available inside of the agent docker env). Perhaps, we could make it configurable via the config files. Ideally, the linter should be easy to install (so that we can just supply a simple installation command from the config file) and only check for some critical errors.

klieret avatar Apr 04 '24 23:04 klieret

Our main focus is SWE-bench, which is Python, but I think we should integrate an option to handle any language, especially if we can do it in an elegant way that doesn't add to much code/external deps to the repo

ofirpress avatar Apr 05 '24 03:04 ofirpress