Skip to content

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(reviewer): Attempt cost limit

Kilian Lieret2153abe54da6
diff --git a/sweagent/agent/agents.py b/sweagent/agent/agents.py
index 6edd59c3..06fb83e9 100644
--- a/sweagent/agent/agents.py
+++ b/sweagent/agent/agents.py
@@ -252,11 +252,12 @@ class RetryAgent(AbstractAgent):
# This is a bit of a hack to raise exit_cost within the sub-agent,
# which ensures we handle the cost limit properly within the sub-agent (autosubmission etc.)
self.logger.warning(
- "Cost limit (all attempts) exceeded: %s > %s. Setting current agent's per-instance cost limit to 0.0",
+ "Cost limit (all attempts) exceeded: %s > %s. Setting current agent's per-instance cost limit to 0.01",
current_total_cost,
self.config.retry_loop.cost_limit,
)
- self._agent.model.config.per_instance_cost_limit = 0.0
+ # Don't set it to 0, it will disable the cost limit entirely
+ self._agent.model.config.per_instance_cost_limit = 0.01
try:
return self._agent.step()
except Exception as e: