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]
Specify timeouts in config rather than env
Kilian Lieret83e0c6bad3ed
diff --git a/sweagent/agent/agents.py b/sweagent/agent/agents.pyindex b326fc47..2e9aaa1a 100644--- a/sweagent/agent/agents.py+++ b/sweagent/agent/agents.py@@ -27,12 +27,10 @@ from sweagent.environment.swe_env import SWEEnvfrom sweagent.tools.parsing import FormatErrorfrom sweagent.tools.tools import ToolConfig, ToolHandlerfrom sweagent.types import AgentInfo, AgentRunResult, History, HistoryItem, Trajectory, TrajectoryStep-from sweagent.utils.config import _convert_paths_to_abspath, keys_config+from sweagent.utils.config import _convert_paths_to_abspathfrom sweagent.utils.log import get_loggerfrom sweagent.utils.patch_formatter import PatchFormatter-AGENT_ACTION_TIMEOUT = float(keys_config.get("SWE_AGENT_ACTION_TIMEOUT", 25))-class TemplateConfig(BaseModel):"""This configuration is used to define almost all message templates that are@@ -564,7 +562,7 @@ class Agent:try:observation = self._env.communicate(input=action,- timeout=AGENT_ACTION_TIMEOUT,+ timeout=self.tools.config.execution_timeout,set_last_action=True,check=self._always_require_zero_exit_code,)diff --git a/sweagent/tools/tools.py b/sweagent/tools/tools.pyindex 5847da77..23e9b09d 100644--- a/sweagent/tools/tools.py+++ b/sweagent/tools/tools.py@@ -93,6 +93,12 @@ class ToolConfig(BaseModel):)"""Should extract environment state in a json readable form"""+ execution_timeout: int = 30+ """Timeout for executing commands in the environment"""++ install_timeout: int = 300+ """Timeout used for each of the installation commands"""+# todo: move to ToolHandler?@propertydef commands(self) -> list[Command]:@@ -197,7 +203,11 @@ class ToolHandler:))for command in self.config.install_commands:- asyncio.run(env.deployment.runtime.run_in_session(BashAction(command=command, timeout=1, check=True)))+ asyncio.run(+ env.deployment.runtime.run_in_session(+ BashAction(command=command, timeout=self.config.install_timeout, check=True)+ )+ )def _make_state_command_available(self, env: SWEEnv) -> None:asyncio.run(