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]
Also catch settings errors and display help
Kilian Lieret896c959c18a9
diff --git a/sweagent/run/common.py b/sweagent/run/common.pyindex c5cdafae..87f6932b 100644--- a/sweagent/run/common.py+++ b/sweagent/run/common.py@@ -6,7 +6,7 @@ from pathlib import Pathimport yamlfrom pydantic import ValidationError-from pydantic_settings import BaseSettings, CliApp+from pydantic_settings import BaseSettings, CliApp, SettingsErrorfrom rich import print as rich_printfrom rich.panel import Panel@@ -53,6 +53,14 @@ For example, there are different deployments with different options each. Pydantone after the other and reporting the failures for each of them."""+_SETTING_ERROR_HINTS = """+[red][bold]Hint: Run sweagent <subcommand> --print-options for a complete overview of all available options.[/bold][/red]++[red][bold]Common mistakes:[/bold][/red]+- You used dahses instead of underscores (`--num-workers` instead of `--num_workers`).+- You forgot about part of the hierarchy (`--model.name` instead of `--aggent.model.name`).+"""+# todo: Parameterize type hintsclass BasicCLI:@@ -122,7 +130,7 @@ class BasicCLI:config_merged = {}try:- args = CliApp.run(self.arg_type, remaining_args, **config_merged) # type: ignore+ args = CliApp.run(self.arg_type, remaining_args, **config_merged, cli_exit_on_error=False) # type: ignoreexcept ValidationError as e:rich_print(Panel.fit(@@ -138,6 +146,10 @@ class BasicCLI:)msg = "Invalid configuration. Please check the above output."raise RuntimeError(msg) from None+ except SettingsError as e:+ rich_print(Panel.fit("[red][bold]SettingsError[/bold][/red]\n\n" + str(e) + "\n\n" + _SETTING_ERROR_HINTS))+ msg = "Invalid command line arguments. Please check the above output in the box."+ raise RuntimeError(msg) from Noneif cli_args.print_config: # type: ignoreprint(yaml.dump(args.model_dump()))exit(0)