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]

Change name of bash tool

Kilian Lieret67991c3b3466
diff --git a/sweagent/tools/commands.py b/sweagent/tools/commands.py
index 47f2a871..da1c48c9 100644
--- a/sweagent/tools/commands.py
+++ b/sweagent/tools/commands.py
@@ -200,7 +200,7 @@ class Command(BaseModel):
# Default Bash tool
BASH_COMMAND = Command(
- name="bash",
+ name="execute_bash",
signature="echo '<command>'\n<command>\necho \"root@workspace:${{PWD}} #\n[Command finished with exit code ${{?}}]\"",
docstring="runs the given command directly in bash",
arguments=[
diff --git a/sweagent/tools/tools.py b/sweagent/tools/tools.py
index 573846b2..37999709 100644
--- a/sweagent/tools/tools.py
+++ b/sweagent/tools/tools.py
@@ -206,6 +206,8 @@ class ToolHandler:
)
async def _is_command_available(self, env, command: str, env_vars: dict[str, str]) -> None:
+ if command == "execute_bash":
+ return
try:
await env.deployment.runtime.execute(
RexCommand(command=f"which {command}", shell=True, check=True, env=env_vars)
diff --git a/sweagent/tools/utils.py b/sweagent/tools/utils.py
index 4e90e898..9dc96daa 100644
--- a/sweagent/tools/utils.py
+++ b/sweagent/tools/utils.py
@@ -38,7 +38,7 @@ def _guard_multiline_input(action: str, match_fct: Callable[[str], re.Match | No
def _should_quote(value: Any, command: Command) -> bool:
"""Returns True if the value should be quoted, False otherwise."""
- if command.name == "bash":
+ if command.name == "execute_bash":
return False
return isinstance(value, str) and command.end_name is None