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: Convert agents.py templates to jinja

Kilian Lieret7598b8a84b43
diff --git a/sweagent/agent/agents.py b/sweagent/agent/agents.py
index 0ec3cf20..3f43a723 100644
--- a/sweagent/agent/agents.py
+++ b/sweagent/agent/agents.py
@@ -47,7 +47,7 @@ class TemplateConfig(BaseModel):
system_template: str = ""
instance_template: str = ""
- next_step_template: str = "Observation: {observation}"
+ next_step_template: str = "Observation: {{observation}}"
next_step_no_output_template: str = None # type: ignore
"""Template for the next step when the last output was empty. Defaults to next_step_template."""
@@ -67,14 +67,14 @@ class TemplateConfig(BaseModel):
"Your bash command contained syntax errors and was NOT executed. "
"Please fix the syntax errors and try again. This can be the result "
"of not adhering to the syntax for multi-line commands. Here is the output of `bash -n`:\n"
- "{bash_stdout}\n{bash_stderr}"
+ "{{bash_stdout}}\n{{bash_stderr}}"
)
"""Message template for when the agent's bash command contains syntax errors.
Available variables: `bash_stdout`, `bash_stderr`
"""
command_cancelled_timeout_template: str = (
- "The command {command!r} was cancelled because it took more than {timeout} seconds. "
+ "The command '{{command}}' was cancelled because it took more than {{timeout}} seconds. "
"Please try a different command that completes more quickly."
)
"""Message template for when the agent's command was cancelled because it took too long.