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]
Fix(run_batch): Showing cost in progress bar
Kilian Lieret6fc127f6902e
diff --git a/sweagent/agent/hooks/status.py b/sweagent/agent/hooks/status.pyindex c063e14c..515b621b 100644--- a/sweagent/agent/hooks/status.py+++ b/sweagent/agent/hooks/status.py@@ -11,13 +11,13 @@ class SetStatusAgentHook(AbstractAgentHook):self._i_step = 0self._cost = 0.0self._i_attempt = 0- self._total_cost = 0.0+ self._previous_cost = 0.0def on_setup_attempt(self):self._i_attempt += 1self._i_step = 0# Costs will be reset for the next attempt- self._total_cost += self._cost+ self._previous_cost += self._costdef _update(self, message: str):self._callable(self._id, message)@@ -25,7 +25,7 @@ class SetStatusAgentHook(AbstractAgentHook):def on_step_start(self):self._i_step += 1attempt_str = f"Attempt {self._i_attempt} " if self._i_attempt > 1 else ""- self._update(f"{attempt_str}Step {self._i_step:>3} (${self._total_cost:.2f})")+ self._update(f"{attempt_str}Step {self._i_step:>3} (${self._previous_cost + self._cost:.2f})")def on_step_done(self, *, step: StepOutput, info: AgentInfo):self._cost = info["model_stats"]["instance_cost"] # type: ignore