Skip to content

Automate browser based workflows with AI

migrate generate_script -> run_with (FE) (#3555)

Jonathan Dobsond4de6a4d0946
diff --git a/skyvern-frontend/src/routes/workflows/RunWorkflowForm.tsx b/skyvern-frontend/src/routes/workflows/RunWorkflowForm.tsx
index 6707cd4da..c24c785ec 100644
--- a/skyvern-frontend/src/routes/workflows/RunWorkflowForm.tsx
+++ b/skyvern-frontend/src/routes/workflows/RunWorkflowForm.tsx
@@ -206,7 +206,7 @@ function RunWorkflowForm({
extraHttpHeaders: initialSettings.extraHttpHeaders
? JSON.stringify(initialSettings.extraHttpHeaders)
: null,
- runWithCode: workflow?.generate_script ?? false,
+ runWithCode: workflow?.run_with === "code",
aiFallback: workflow?.ai_fallback ?? true,
},
});
diff --git a/skyvern-frontend/src/routes/workflows/Workflows.tsx b/skyvern-frontend/src/routes/workflows/Workflows.tsx
index 7372ef6e7..2dfb94d8a 100644
--- a/skyvern-frontend/src/routes/workflows/Workflows.tsx
+++ b/skyvern-frontend/src/routes/workflows/Workflows.tsx
@@ -50,7 +50,7 @@ const emptyWorkflowRequest: WorkflowCreateYAMLRequest = {
title: "New Workflow",
description: "",
ai_fallback: true,
- generate_script: false,
+ run_with: "agent",
workflow_definition: {
blocks: [],
parameters: [],
diff --git a/skyvern-frontend/src/routes/workflows/components/WorkflowVisualComparisonDrawer.tsx b/skyvern-frontend/src/routes/workflows/components/WorkflowVisualComparisonDrawer.tsx
index 797b51f88..b723808e6 100644
--- a/skyvern-frontend/src/routes/workflows/components/WorkflowVisualComparisonDrawer.tsx
+++ b/skyvern-frontend/src/routes/workflows/components/WorkflowVisualComparisonDrawer.tsx
@@ -124,7 +124,7 @@ function getWorkflowElements(version: WorkflowVersion) {
extraHttpHeaders: version.extra_http_headers
? JSON.stringify(version.extra_http_headers)
: null,
- useScriptCache: version.generate_script,
+ runWith: version.run_with,
scriptCacheKey: version.cache_key,
aiFallback: version.ai_fallback ?? true,
runSequentially: version.run_sequentially ?? false,
diff --git a/skyvern-frontend/src/routes/workflows/debugger/Debugger.tsx b/skyvern-frontend/src/routes/workflows/debugger/Debugger.tsx
index b001550d4..e3fb415c9 100644
--- a/skyvern-frontend/src/routes/workflows/debugger/Debugger.tsx
+++ b/skyvern-frontend/src/routes/workflows/debugger/Debugger.tsx
@@ -61,7 +61,7 @@ function Debugger() {
extraHttpHeaders: workflow.extra_http_headers
? JSON.stringify(workflow.extra_http_headers)
: null,
- useScriptCache: workflow.generate_script,
+ runWith: workflow.run_with,
scriptCacheKey: workflow.cache_key,
aiFallback: workflow.ai_fallback ?? true,
runSequentially: workflow.run_sequentially ?? false,
diff --git a/skyvern-frontend/src/routes/workflows/editor/WorkflowEditor.tsx b/skyvern-frontend/src/routes/workflows/editor/WorkflowEditor.tsx
index b7aae90ff..fb8ebc9a0 100644
--- a/skyvern-frontend/src/routes/workflows/editor/WorkflowEditor.tsx
+++ b/skyvern-frontend/src/routes/workflows/editor/WorkflowEditor.tsx
@@ -62,7 +62,7 @@ function WorkflowEditor() {
extraHttpHeaders: workflow.extra_http_headers
? JSON.stringify(workflow.extra_http_headers)
: null,
- useScriptCache: workflow.generate_script,
+ runWith: workflow.run_with,
scriptCacheKey: workflow.cache_key,
aiFallback: workflow.ai_fallback ?? true,
runSequentially: workflow.run_sequentially ?? false,
diff --git a/skyvern-frontend/src/routes/workflows/editor/Workspace.tsx b/skyvern-frontend/src/routes/workflows/editor/Workspace.tsx
index abaa7364a..901b170d9 100644
--- a/skyvern-frontend/src/routes/workflows/editor/Workspace.tsx
+++ b/skyvern-frontend/src/routes/workflows/editor/Workspace.tsx
@@ -720,7 +720,7 @@ function Workspace({
extraHttpHeaders: selectedVersion.extra_http_headers
? JSON.stringify(selectedVersion.extra_http_headers)
: null,
- useScriptCache: selectedVersion.generate_script,
+ runWith: selectedVersion.run_with,
scriptCacheKey: selectedVersion.cache_key,
aiFallback: selectedVersion.ai_fallback ?? true,
runSequentially: selectedVersion.run_sequentially ?? false,
diff --git a/skyvern-frontend/src/routes/workflows/editor/nodes/StartNode/StartNode.tsx b/skyvern-frontend/src/routes/workflows/editor/nodes/StartNode/StartNode.tsx
index 752317046..137ddb9aa 100644
--- a/skyvern-frontend/src/routes/workflows/editor/nodes/StartNode/StartNode.tsx
+++ b/skyvern-frontend/src/routes/workflows/editor/nodes/StartNode/StartNode.tsx
@@ -79,7 +79,7 @@ function StartNode({ id, data }: NodeProps<StartNode>) {
? data.maxScreenshotScrolls
: null,
extraHttpHeaders: data.withWorkflowSettings ? data.extraHttpHeaders : null,
- useScriptCache: data.withWorkflowSettings ? data.useScriptCache : false,
+ runWith: data.withWorkflowSettings ? data.runWith : "agent",
scriptCacheKey: data.withWorkflowSettings ? data.scriptCacheKey : null,
aiFallback: data.withWorkflowSettings ? data.aiFallback : true,
runSequentially: data.withWorkflowSettings ? data.runSequentially : false,
@@ -220,12 +220,9 @@ function StartNode({ id, data }: NodeProps<StartNode>) {
<HelpTooltip content="If code has been generated and saved from a previously successful run, set this to 'Code' to use that code when executing the workflow. To avoid using code, set this to 'Skyvern Agent'." />
</div>
<Select
- value={!inputs.useScriptCache ? "ai" : "code"}
+ value={inputs.runWith ?? "agent"}
onValueChange={(value) => {
- handleChange(
- "useScriptCache",
- value === "code",
- );
+ handleChange("runWith", value);
}}
>
<SelectTrigger className="w-48">
diff --git a/skyvern-frontend/src/routes/workflows/editor/nodes/StartNode/types.ts b/skyvern-frontend/src/routes/workflows/editor/nodes/StartNode/types.ts
index 713f964fe..0e2458e42 100644
--- a/skyvern-frontend/src/routes/workflows/editor/nodes/StartNode/types.ts
+++ b/skyvern-frontend/src/routes/workflows/editor/nodes/StartNode/types.ts
@@ -12,7 +12,7 @@ export type WorkflowStartNodeData = {
maxScreenshotScrolls: number | null;
extraHttpHeaders: string | null;
editable: boolean;
- useScriptCache: boolean;
+ runWith: string | null;
scriptCacheKey: string | null;
aiFallback: boolean;
runSequentially: boolean;
diff --git a/skyvern-frontend/src/routes/workflows/editor/panels/WorkflowComparisonPanel.tsx b/skyvern-frontend/src/routes/workflows/editor/panels/WorkflowComparisonPanel.tsx
index 10c58f3f4..82aaaaf72 100644
--- a/skyvern-frontend/src/routes/workflows/editor/panels/WorkflowComparisonPanel.tsx
+++ b/skyvern-frontend/src/routes/workflows/editor/panels/WorkflowComparisonPanel.tsx
@@ -149,7 +149,7 @@ function getWorkflowElements(version: WorkflowVersion) {
extraHttpHeaders: version.extra_http_headers
? JSON.stringify(version.extra_http_headers)
: null,
- useScriptCache: version.generate_script,
+ runWith: version.run_with,
scriptCacheKey: version.cache_key,
aiFallback: version.ai_fallback ?? true,
runSequentially: version.run_sequentially ?? false,
diff --git a/skyvern-frontend/src/routes/workflows/editor/workflowEditorUtils.ts b/skyvern-frontend/src/routes/workflows/editor/workflowEditorUtils.ts
index 0f320c0b6..d1bf316ae 100644
--- a/skyvern-frontend/src/routes/workflows/editor/workflowEditorUtils.ts
+++ b/skyvern-frontend/src/routes/workflows/editor/workflowEditorUtils.ts
@@ -703,7 +703,7 @@ function getElements(
maxScreenshotScrolls: settings.maxScreenshotScrolls,
extraHttpHeaders: settings.extraHttpHeaders,
editable,
- useScriptCache: settings.useScriptCache,
+ runWith: settings.runWith,
scriptCacheKey: settings.scriptCacheKey,
aiFallback: settings.aiFallback ?? true,
label: "__start_block__",
@@ -1417,7 +1417,7 @@ function getWorkflowSettings(nodes: Array<AppNode>): WorkflowSettings {
model: null,
maxScreenshotScrolls: null,
extraHttpHeaders: null,
- useScriptCache: false,
+ runWith: "agent",
scriptCacheKey: null,
aiFallback: true,
runSequentially: false,
@@ -1439,7 +1439,7 @@ function getWorkflowSettings(nodes: Array<AppNode>): WorkflowSettings {
model: data.model,
maxScreenshotScrolls: data.maxScreenshotScrolls,
extraHttpHeaders: data.extraHttpHeaders,
- useScriptCache: data.useScriptCache,
+ runWith: data.runWith,
scriptCacheKey: data.scriptCacheKey,
aiFallback: data.aiFallback,
runSequentially: data.runSequentially,
@@ -2133,7 +2133,7 @@ function convert(workflow: WorkflowApiResponse): WorkflowCreateYAMLRequest {
blocks: convertBlocksToBlockYAML(workflow.workflow_definition.blocks),
},
is_saved_task: workflow.is_saved_task,
- generate_script: workflow.generate_script,
+ run_with: workflow.run_with,
cache_key: workflow.cache_key,
ai_fallback: workflow.ai_fallback ?? undefined,
run_sequentially: workflow.run_sequentially ?? undefined,
diff --git a/skyvern-frontend/src/routes/workflows/types/workflowTypes.ts b/skyvern-frontend/src/routes/workflows/types/workflowTypes.ts
index f9db5f366..ac7e63b97 100644
--- a/skyvern-frontend/src/routes/workflows/types/workflowTypes.ts
+++ b/skyvern-frontend/src/routes/workflows/types/workflowTypes.ts
@@ -527,7 +527,7 @@ export type WorkflowApiResponse = {
created_at: string;
modified_at: string;
deleted_at: string | null;
- generate_script: boolean;
+ run_with: string | null; // 'agent' or 'code'
cache_key: string | null;
ai_fallback: boolean | null;
run_sequentially: boolean | null;
@@ -541,7 +541,7 @@ export type WorkflowSettings = {
model: WorkflowModel | null;
maxScreenshotScrolls: number | null;
extraHttpHeaders: string | null;
- useScriptCache: boolean;
+ runWith: string | null; // 'agent' or 'code'
scriptCacheKey: string | null;
aiFallback: boolean | null;
runSequentially: boolean;
diff --git a/skyvern-frontend/src/routes/workflows/types/workflowYamlTypes.ts b/skyvern-frontend/src/routes/workflows/types/workflowYamlTypes.ts
index 171ebb7db..4504f98d1 100644
--- a/skyvern-frontend/src/routes/workflows/types/workflowYamlTypes.ts
+++ b/skyvern-frontend/src/routes/workflows/types/workflowYamlTypes.ts
@@ -14,7 +14,7 @@ export type WorkflowCreateYAMLRequest = {
is_saved_task?: boolean;
max_screenshot_scrolls?: number | null;
extra_http_headers?: Record<string, string> | null;
- generate_script?: boolean;
+ run_with?: string | null;
cache_key?: string | null;
ai_fallback?: boolean;
run_sequentially?: boolean;
diff --git a/skyvern-frontend/src/store/WorkflowHasChangesStore.ts b/skyvern-frontend/src/store/WorkflowHasChangesStore.ts
index c5a19514f..bc8bfbdfd 100644
--- a/skyvern-frontend/src/store/WorkflowHasChangesStore.ts
+++ b/skyvern-frontend/src/store/WorkflowHasChangesStore.ts
@@ -114,7 +114,7 @@ const useWorkflowSave = () => {
max_screenshot_scrolls: saveData.settings.maxScreenshotScrolls,
totp_verification_url: saveData.workflow.totp_verification_url,
extra_http_headers: extraHttpHeaders,
- generate_script: saveData.settings.useScriptCache,
+ run_with: saveData.settings.runWith,
cache_key: normalizedKey,
ai_fallback: saveData.settings.aiFallback ?? true,
workflow_definition: {