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]
Track execution times
Kilian Lieret5e8ccf831c59
diff --git a/sweagent/agent/agents.py b/sweagent/agent/agents.pyindex 60b0f031..1166dd71 100644--- a/sweagent/agent/agents.py+++ b/sweagent/agent/agents.py@@ -3,6 +3,7 @@ from __future__ import annotationsimport copyimport jsonimport re+import timefrom collections import defaultdictfrom dataclasses import dataclassfrom pathlib import Path@@ -962,6 +963,7 @@ class Agent:# Loop over sub-actions (if any)done = Falseobservations: list[str | None] = list()+ execution_t0 = time.perf_counter()for sub_action in self.split_actions(run_action):observation, done = self._run_sub_action(sub_action)# If the last sub-action is done, the observation is not@@ -970,6 +972,7 @@ class Agent:breakobservations.append(observation)observation = "\n".join([obs for obs in observations if obs is not None])+ execution_time = time.perf_counter() - execution_t0trajectory_step = TrajectoryStep({@@ -978,6 +981,7 @@ class Agent:"response": output,"state": state,"thought": thought,+ "execution_time": execution_time,},)self.trajectory.append(trajectory_step)diff --git a/sweagent/types.py b/sweagent/types.pyindex 87bd43af..44bfdd6f 100644--- a/sweagent/types.py+++ b/sweagent/types.py@@ -19,6 +19,7 @@ class TrajectoryStep(TypedDict):response: strstate: str | Nonethought: str+ execution_time: floatclass _HistoryItem(TypedDict):