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]
Enh: Not all exceptions are errors (log improvement)
Kilian Liereta012e63a5fcc
diff --git a/sweagent/agent/agents.py b/sweagent/agent/agents.pyindex 28e5955a..26af2d36 100644--- a/sweagent/agent/agents.py+++ b/sweagent/agent/agents.py@@ -689,7 +689,6 @@ class Agent:except Exception as e:# Attach the step object to the exceptione.step = step # type: ignore- self.logger.exception("Error in forward", exc_info=e)raisedef forward_with_handling(self, history: list[dict[str, str]]) -> StepOutput:@@ -720,6 +719,7 @@ class Agent:def handle_error_with_retry(exception: Exception, template: str) -> list[dict[str, str]]:"""Requeries the model if the error is a format/blocklist/bash syntax error."""+ self.logger.warning("Requerying model (%s)", type(exception).__name__)step: StepOutput = getattr(exception, "step", StepOutput())self.add_step_to_trajectory(step)exception_message = getattr(exception, "message", "")@@ -762,14 +762,12 @@ class Agent:template=self.templates.shell_check_error_template,)except RetryWithOutput as e:- self.logger.warning("Requerying model with output from last step (RetryWithOutput)")n_format_fails = 0history = handle_error_with_retry(exception=e,template=self.templates.next_step_template,)except RetryWithoutOutput:- self.logger.warning("Requerying model (RetryWithoutOutput)")n_format_fails = 0# Requery with the same template as the last step