Skip to content

Automate browser based workflows with AI

add back error code description in the main prompt (#3410)

LawyZheng3d2b164ea873
diff --git a/skyvern/forge/agent.py b/skyvern/forge/agent.py
index bddfc30cf..9e7732c8f 100644
--- a/skyvern/forge/agent.py
+++ b/skyvern/forge/agent.py
@@ -2062,6 +2062,7 @@ class ForgeAgent:
current_url=current_url,
data_extraction_goal=task.data_extraction_goal,
action_history=actions_and_results_str,
+ error_code_mapping_str=(json.dumps(task.error_code_mapping) if task.error_code_mapping else None),
local_datetime=datetime.now(context.tz_info).isoformat(),
verification_code_check=verification_code_check,
complete_criterion=task.complete_criterion.strip() if task.complete_criterion else None,
diff --git a/skyvern/forge/prompts/skyvern/decisive-criterion-validate.j2 b/skyvern/forge/prompts/skyvern/decisive-criterion-validate.j2
index 106a2ec07..026903eb0 100644
--- a/skyvern/forge/prompts/skyvern/decisive-criterion-validate.j2
+++ b/skyvern/forge/prompts/skyvern/decisive-criterion-validate.j2
@@ -30,6 +30,11 @@ Terminate Criterion:
```
{{ terminate_criterion }}
```{% endif %}
+{% if error_code_mapping_str %}
+Use the error codes and their descriptions to surface user-defined errors. Do not return any error that's not defined by the user. User defined errors:
+```
+{{ error_code_mapping_str }}
+```{% endif %}
User details:
```
diff --git a/skyvern/forge/prompts/skyvern/extract-action.j2 b/skyvern/forge/prompts/skyvern/extract-action.j2
index c5298d4dd..5cd4066a2 100644
--- a/skyvern/forge/prompts/skyvern/extract-action.j2
+++ b/skyvern/forge/prompts/skyvern/extract-action.j2
@@ -49,6 +49,11 @@ User goal:
```
{{ navigation_goal }}
```
+{% if error_code_mapping_str %}
+Use the error codes and their descriptions to surface user-defined errors. Do not return any error that's not defined by the user. User defined errors:
+```
+{{ error_code_mapping_str }}
+```{% endif %}
{% if data_extraction_goal %}
User Data Extraction Goal:
```