Automate browser based workflows with AI
Python aiapiautomationbrowserbrowser-automationcomputergptllmplaywrightpowerautomatepuppeteerpythonrpaseleniumvisionworkflow
Remove successful action history. Only show the failure of the previous step in action history. (#602)
Kerem Yilmazcdd731b862d7
diff --git a/skyvern/config.py b/skyvern/config.pyindex ac7c79912..06014e6bb 100644--- a/skyvern/config.py+++ b/skyvern/config.py@@ -23,7 +23,7 @@ class Settings(BaseSettings):MAX_RETRIES_PER_STEP: int = 5DEBUG_MODE: bool = FalseDATABASE_STRING: str = "postgresql+psycopg://skyvern@localhost/skyvern"- PROMPT_ACTION_HISTORY_WINDOW: int = 5+ PROMPT_ACTION_HISTORY_WINDOW: int = 1TASK_RESPONSE_ACTION_SCREENSHOT_COUNT: int = 3ENV: str = "local"diff --git a/skyvern/forge/agent.py b/skyvern/forge/agent.pyindex e1b4fa0b6..ffcc7a36d 100644--- a/skyvern/forge/agent.py+++ b/skyvern/forge/agent.py@@ -1017,13 +1017,14 @@ class ForgeAgent:async def _get_action_results(self, task: Task) -> str:# Get action results from the last app.SETTINGS.PROMPT_ACTION_HISTORY_WINDOW stepssteps = await app.DATABASE.get_task_steps(task_id=task.task_id, organization_id=task.organization_id)- window_steps = steps[-1 * SettingsManager.get_settings().PROMPT_ACTION_HISTORY_WINDOW :]+ # the last step is always the newly created one and it should be excluded from the history window+ window_steps = steps[-1 - SettingsManager.get_settings().PROMPT_ACTION_HISTORY_WINDOW : -1]actions_and_results: list[tuple[Action, list[ActionResult]]] = []for window_step in window_steps:if window_step.output and window_step.output.actions_and_results:actions_and_results.extend(window_step.output.actions_and_results)- # shall we exclude successful actions?+ # exclude successful action from historyreturn json.dumps([{@@ -1044,6 +1045,7 @@ class ForgeAgent:],}for action, results in actions_and_results+ if len(results) > 0 and not results[-1].success])