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]

Critical fix: Ensure agents share no mutable state

Kilian Lieretb6932a693464
diff --git a/sweagent/agent/agents.py b/sweagent/agent/agents.py
index 47c86ab3..b1474516 100644
--- a/sweagent/agent/agents.py
+++ b/sweagent/agent/agents.py
@@ -405,6 +405,9 @@ class DefaultAgent(AbstractAgent):
@classmethod
def from_config(cls, config: DefaultAgentConfig) -> Self:
+ # To ensure that all models stay completely independent, we deepcopy the
+ # model config, because it lives on as a property in the model, tools, etc.
+ config = config.model_copy(deep=True)
model = get_model(config.model, config.tools)
return cls(
templates=config.templates,