Skip to content

Automate browser based workflows with AI

add action history to action block prompt (#4481)

LawyZhengd642f351b3ba
diff --git a/skyvern/forge/prompts/skyvern/single-click-action.j2 b/skyvern/forge/prompts/skyvern/single-click-action.j2
index 0dcb02871..9759d482e 100644
--- a/skyvern/forge/prompts/skyvern/single-click-action.j2
+++ b/skyvern/forge/prompts/skyvern/single-click-action.j2
@@ -40,7 +40,12 @@ HTML elements from `{{ current_url }}`:
```
{{ elements }}
```
-
+{% if action_history %}
+Consider the action history from the previous steps and the screenshot together, if actions from the previous steps don't yield positive impact, try to take an action on a different element.
+Action history from previous steps:
+```
+{{ action_history }}
+```{% endif %}
Current datetime, ISO format:
```
{{ local_datetime }}
diff --git a/skyvern/forge/prompts/skyvern/single-input-action.j2 b/skyvern/forge/prompts/skyvern/single-input-action.j2
index 24b32c555..c1305ae87 100644
--- a/skyvern/forge/prompts/skyvern/single-input-action.j2
+++ b/skyvern/forge/prompts/skyvern/single-input-action.j2
@@ -46,7 +46,12 @@ HTML elements from `{{ current_url }}`:
```
{{ elements }}
```
-
+{% if action_history %}
+Consider the action history from the previous steps and the screenshot together, if actions from the previous steps don't yield positive impact, try to take an action on a different element.
+Action history from previous steps:
+```
+{{ action_history }}
+```{% endif %}
Current datetime, ISO format:
```
{{ local_datetime }}
diff --git a/skyvern/forge/prompts/skyvern/single-select-action.j2 b/skyvern/forge/prompts/skyvern/single-select-action.j2
index e3a92978c..efbf9f00e 100644
--- a/skyvern/forge/prompts/skyvern/single-select-action.j2
+++ b/skyvern/forge/prompts/skyvern/single-select-action.j2
@@ -47,7 +47,12 @@ HTML elements from `{{ current_url }}`:
```
{{ elements }}
```
-
+{% if action_history %}
+Consider the action history from the previous steps and the screenshot together, if actions from the previous steps don't yield positive impact, try to take an action on a different element.
+Action history from previous steps:
+```
+{{ action_history }}
+```{% endif %}
Current datetime, ISO format:
```
{{ local_datetime }}
diff --git a/skyvern/forge/prompts/skyvern/single-upload-action.j2 b/skyvern/forge/prompts/skyvern/single-upload-action.j2
index edd4ca533..65acb686f 100644
--- a/skyvern/forge/prompts/skyvern/single-upload-action.j2
+++ b/skyvern/forge/prompts/skyvern/single-upload-action.j2
@@ -34,7 +34,12 @@ HTML elements from `{{ current_url }}`:
```
{{ elements }}
```
-
+{% if action_history %}
+Consider the action history from the previous steps and the screenshot together, if actions from the previous steps don't yield positive impact, try to take an action on a different element.
+Action history from previous steps:
+```
+{{ action_history }}
+```{% endif %}
Current datetime, ISO format:
```
{{ local_datetime }}