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]
Merge remote-tracking branch 'refs/remotes/origin/swerex-integration' into swerex-integration
carlosejimenez6774ef030042
diff --cc sweagent/run/run_replay.pyindex 9a0f8b5f,8ebce732..0d7d9804--- a/sweagent/run/run_replay.py+++ b/sweagent/run/run_replay.py@@@ -7,21 -7,17 +7,18 @@@ from getpass import getusefrom pathlib import Pathfrom typing import Any+import yaml- from pydantic import Fieldfrom pydantic_settings import BaseSettingsfrom swerex.deployment.abstract import AbstractDeployment- from swerex.deployment.config import DeploymentConfig, DockerDeploymentConfig, get_deployment+ from swerex.deployment.config import DeploymentConfig, get_deploymentfrom typing_extensions import Self- from sweagent import CONFIG_DIR- from sweagent.agent.agents import Agent, AgentConfig+ from sweagent.agent.agents import Agentfrom sweagent.agent.models import ReplayModelConfigfrom sweagent.environment.config.problem_statement import EmptyProblemStatement- from sweagent.environment.config.repo import RepoConfigfrom sweagent.environment.swe_env import SWEEnvfrom sweagent.run.common import BasicCLI- from sweagent.run.run_single import RunSingle+ from sweagent.run.run_single import RunSingle, RunSingleConfigfrom sweagent.utils.config import load_environment_variablesfrom sweagent.utils.log import get_logger@@@ -66,6 -54,23 +55,26 @@@ class RunReplayself._catch_errors = _catch_errorsself._require_zero_exit_code = _require_zero_exit_code- self._traj_data = json.loads(traj_path.read_text())++ if traj_path.suffix == ".yaml":++ self._traj_data = yaml.safe_load(traj_path.read_text())++ else:++ self._traj_data = json.loads(traj_path.read_text())+ self.config = self._get_config_from_agent(self._traj_data)++ if deployment is None:+ self.deployment = get_deployment(self.config.env.deployment)+ else:+ self.deployment = deployment++ def _get_config_from_agent(self, traj_data):+ try:+ config = RunSingleConfig.model_validate(self._traj_data["replay_config"])+ except KeyError:+ msg = "Replay config not found in trajectory. Are you running on an old trajectory?"+ raise ValueError(msg)+ config.agent.model = ReplayModelConfig(replay_path=self._replay_action_trajs_path)+ return config+@propertydef instance_id(self) -> str:return Path(self.traj_path).stem