Skip to content

Automate browser based workflows with AI

SKY-9676: Add Workflow Copilot request policy (#5919)

Andrew Neilson69be8d10f7f6
diff --git a/fern/openapi/skyvern_openapi.json b/fern/openapi/skyvern_openapi.json
index d5eed7380..3833eb0bb 100644
--- a/fern/openapi/skyvern_openapi.json
+++ b/fern/openapi/skyvern_openapi.json
@@ -1550,7 +1550,9 @@
"description": "Successful Response",
"content": {
"application/json": {
- "schema": {}
+ "schema": {
+ "$ref": "#/components/schemas/RunWebhookReplayResponse"
+ }
}
}
},
@@ -2112,6 +2114,71 @@
"x-fern-sdk-method-name": "get_workflow_versions"
}
},
+ "/v1/workflows/{workflow_permanent_id}/browser_session/reset_profile": {
+ "post": {
+ "tags": [
+ "Workflows"
+ ],
+ "summary": "Reset persisted browser profile",
+ "description": "Clear the persisted browser profile for a workflow that uses `Save & Reuse Session`. The next run will start from a fresh browser state. Use when a saved profile is corrupted.",
+ "operationId": "reset_workflow_browser_profile",
+ "parameters": [
+ {
+ "name": "workflow_permanent_id",
+ "in": "path",
+ "required": true,
+ "schema": {
+ "type": "string",
+ "description": "The permanent ID of the workflow. Starts with `wpid_`.",
+ "examples": [
+ "wpid_123"
+ ],
+ "title": "Workflow Permanent Id"
+ },
+ "description": "The permanent ID of the workflow. Starts with `wpid_`."
+ },
+ {
+ "name": "x-api-key",
+ "in": "header",
+ "required": false,
+ "schema": {
+ "anyOf": [
+ {
+ "type": "string"
+ },
+ {
+ "type": "null"
+ }
+ ],
+ "description": "Skyvern API key for authentication. API key can be found at https://app.skyvern.com/settings.",
+ "title": "X-Api-Key"
+ },
+ "description": "Skyvern API key for authentication. API key can be found at https://app.skyvern.com/settings."
+ }
+ ],
+ "responses": {
+ "204": {
+ "description": "Successfully cleared persisted browser profile"
+ },
+ "404": {
+ "description": "Workflow not found"
+ },
+ "422": {
+ "description": "Validation Error",
+ "content": {
+ "application/json": {
+ "schema": {
+ "$ref": "#/components/schemas/HTTPValidationError"
+ }
+ }
+ }
+ },
+ "500": {
+ "description": "Storage deletion failed; retry"
+ }
+ }
+ }
+ },
"/v1/upload_file": {
"post": {
"tags": [
@@ -3420,6 +3487,22 @@
"title": "X-Api-Key"
},
"description": "Skyvern API key for authentication. API key can be found at https://app.skyvern.com/settings."
+ },
+ {
+ "name": "x-user-agent",
+ "in": "header",
+ "required": false,
+ "schema": {
+ "anyOf": [
+ {
+ "type": "string"
+ },
+ {
+ "type": "null"
+ }
+ ],
+ "title": "X-User-Agent"
+ }
}
],
"requestBody": {
@@ -3513,6 +3596,22 @@
"title": "X-Api-Key"
},
"description": "Skyvern API key for authentication. API key can be found at https://app.skyvern.com/settings."
+ },
+ {
+ "name": "x-user-agent",
+ "in": "header",
+ "required": false,
+ "schema": {
+ "anyOf": [
+ {
+ "type": "string"
+ },
+ {
+ "type": "null"
+ }
+ ],
+ "title": "X-User-Agent"
+ }
}
],
"requestBody": {
@@ -3982,6 +4081,7 @@
}
}
},
+ "x-excluded": true,
"x-fern-sdk-method-name": "run_sdk_action"
}
},
@@ -5210,6 +5310,11 @@
"title": "Disable Cache",
"default": false
},
+ "ignore_workflow_system_prompt": {
+ "type": "boolean",
+ "title": "Ignore Workflow System Prompt",
+ "default": false
+ },
"next_loop_on_failure": {
"type": "boolean",
"title": "Next Loop On Failure",
@@ -5449,6 +5554,11 @@
}
],
"title": "Download Timeout"
+ },
+ "include_extracted_text": {
+ "type": "boolean",
+ "title": "Include Extracted Text",
+ "default": true
}
},
"type": "object",
@@ -5500,6 +5610,11 @@
],
"title": "Model"
},
+ "ignore_workflow_system_prompt": {
+ "type": "boolean",
+ "title": "Ignore Workflow System Prompt",
+ "default": false
+ },
"next_loop_on_failure": {
"type": "boolean",
"title": "Next Loop On Failure",
@@ -5697,6 +5812,28 @@
],
"title": "Bundle Key"
},
+ "checksum": {
+ "anyOf": [
+ {
+ "type": "string"
+ },
+ {
+ "type": "null"
+ }
+ ],
+ "title": "Checksum"
+ },
+ "file_size": {
+ "anyOf": [
+ {
+ "type": "integer"
+ },
+ {
+ "type": "null"
+ }
+ ],
+ "title": "File Size"
+ },
"task_id": {
"anyOf": [
{
@@ -5752,6 +5889,17 @@
],
"title": "Run Id"
},
+ "browser_session_id": {
+ "anyOf": [
+ {
+ "type": "string"
+ },
+ {
+ "type": "null"
+ }
+ ],
+ "title": "Browser Session Id"
+ },
"observer_cruise_id": {
"anyOf": [
{
@@ -5843,7 +5991,8 @@
"script_file",
"pdf",
"step_archive",
- "task_archive"
+ "task_archive",
+ "download"
],
"title": "ArtifactType"
},
@@ -6583,7 +6732,9 @@
"http_request",
"human_interaction",
"print_page",
- "workflow_trigger"
+ "workflow_trigger",
+ "google_sheets_read",
+ "google_sheets_write"
],
"title": "BlockType"
},
@@ -6765,6 +6916,17 @@
],
"title": "Description"
},
+ "source_browser_type": {
+ "anyOf": [
+ {
+ "type": "string"
+ },
+ {
+ "type": "null"
+ }
+ ],
+ "title": "Source Browser Type"
+ },
"created_at": {
"type": "string",
"format": "date-time",
@@ -7191,6 +7353,11 @@
"title": "Disable Cache",
"default": false
},
+ "ignore_workflow_system_prompt": {
+ "type": "boolean",
+ "title": "Ignore Workflow System Prompt",
+ "default": false
+ },
"next_loop_on_failure": {
"type": "boolean",
"title": "Next Loop On Failure",
@@ -7309,6 +7476,11 @@
],
"title": "Model"
},
+ "ignore_workflow_system_prompt": {
+ "type": "boolean",
+ "title": "Ignore Workflow System Prompt",
+ "default": false
+ },
"next_loop_on_failure": {
"type": "boolean",
"title": "Next Loop On Failure",
@@ -7390,6 +7562,11 @@
"title": "Disable Cache",
"default": false
},
+ "ignore_workflow_system_prompt": {
+ "type": "boolean",
+ "title": "Ignore Workflow System Prompt",
+ "default": false
+ },
"next_loop_on_failure": {
"type": "boolean",
"title": "Next Loop On Failure",
@@ -7453,6 +7630,11 @@
],
"title": "Model"
},
+ "ignore_workflow_system_prompt": {
+ "type": "boolean",
+ "title": "Ignore Workflow System Prompt",
+ "default": false
+ },
"next_loop_on_failure": {
"type": "boolean",
"title": "Next Loop On Failure",
@@ -7676,11 +7858,19 @@
{
"$ref": "#/components/schemas/ProxyLocation"
},
+ {
+ "$ref": "#/components/schemas/GeoTarget"
+ },
+ {
+ "additionalProperties": true,
+ "type": "object"
+ },
{
"type": "null"
}
],
- "description": "\nGeographic Proxy location to route the browser traffic through. This is only available in Skyvern Cloud.\n\nAvailable geotargeting options:\n- RESIDENTIAL: the default value. Skyvern Cloud uses a random US residential proxy.\n- RESIDENTIAL_ES: Spain\n- RESIDENTIAL_IE: Ireland\n- RESIDENTIAL_GB: United Kingdom\n- RESIDENTIAL_IN: India\n- RESIDENTIAL_JP: Japan\n- RESIDENTIAL_FR: France\n- RESIDENTIAL_DE: Germany\n- RESIDENTIAL_NZ: New Zealand\n- RESIDENTIAL_PH: Philippines\n- RESIDENTIAL_KR: South Korea\n- RESIDENTIAL_ZA: South Africa\n- RESIDENTIAL_AR: Argentina\n- RESIDENTIAL_AU: Australia\n- RESIDENTIAL_BR: Brazil\n- RESIDENTIAL_TR: Turkey\n- RESIDENTIAL_CA: Canada\n- RESIDENTIAL_MX: Mexico\n- RESIDENTIAL_IT: Italy\n- RESIDENTIAL_NL: Netherlands\n- RESIDENTIAL_ISP: ISP proxy\n- US-CA: California (deprecated, routes through RESIDENTIAL_ISP)\n- US-NY: New York (deprecated, routes through RESIDENTIAL_ISP)\n- US-TX: Texas (deprecated, routes through RESIDENTIAL_ISP)\n- US-FL: Florida (deprecated, routes through RESIDENTIAL_ISP)\n- US-WA: Washington (deprecated, routes through RESIDENTIAL_ISP)\n- NONE: No proxy\n"
+ "title": "Proxy Location",
+ "description": "\nGeographic Proxy location to route the browser traffic through. This is only available in Skyvern Cloud.\n\nAvailable geotargeting options:\n- RESIDENTIAL: the default value. Skyvern Cloud uses a random US residential proxy.\n- RESIDENTIAL_ES: Spain\n- RESIDENTIAL_IE: Ireland\n- RESIDENTIAL_GB: United Kingdom\n- RESIDENTIAL_IN: India\n- RESIDENTIAL_JP: Japan\n- RESIDENTIAL_FR: France\n- RESIDENTIAL_DE: Germany\n- RESIDENTIAL_NZ: New Zealand\n- RESIDENTIAL_PH: Philippines\n- RESIDENTIAL_KR: South Korea\n- RESIDENTIAL_SA: Saudi Arabia\n- RESIDENTIAL_ZA: South Africa\n- RESIDENTIAL_AR: Argentina\n- RESIDENTIAL_AU: Australia\n- RESIDENTIAL_BR: Brazil\n- RESIDENTIAL_TR: Turkey\n- RESIDENTIAL_CA: Canada\n- RESIDENTIAL_MX: Mexico\n- RESIDENTIAL_IT: Italy\n- RESIDENTIAL_NL: Netherlands\n- RESIDENTIAL_ISP: ISP proxy\n- US-CA: California (deprecated, routes through RESIDENTIAL_ISP)\n- US-NY: New York (deprecated, routes through RESIDENTIAL_ISP)\n- US-TX: Texas (deprecated, routes through RESIDENTIAL_ISP)\n- US-FL: Florida (deprecated, routes through RESIDENTIAL_ISP)\n- US-WA: Washington (deprecated, routes through RESIDENTIAL_ISP)\n- NONE: No proxy\n"
},
"extensions": {
"anyOf": [
@@ -8430,6 +8620,11 @@
"title": "Disable Cache",
"default": false
},
+ "ignore_workflow_system_prompt": {
+ "type": "boolean",
+ "title": "Ignore Workflow System Prompt",
+ "default": false
+ },
"next_loop_on_failure": {
"type": "boolean",
"title": "Next Loop On Failure",
@@ -8490,6 +8685,11 @@
],
"title": "Model"
},
+ "ignore_workflow_system_prompt": {
+ "type": "boolean",
+ "title": "Ignore Workflow System Prompt",
+ "default": false
+ },
"next_loop_on_failure": {
"type": "boolean",
"title": "Next Loop On Failure",
@@ -8647,6 +8847,11 @@
"title": "Disable Cache",
"default": false
},
+ "ignore_workflow_system_prompt": {
+ "type": "boolean",
+ "title": "Ignore Workflow System Prompt",
+ "default": false
+ },
"next_loop_on_failure": {
"type": "boolean",
"title": "Next Loop On Failure",
@@ -8879,6 +9084,11 @@
}
],
"title": "Download Timeout"
+ },
+ "include_extracted_text": {
+ "type": "boolean",
+ "title": "Include Extracted Text",
+ "default": false
}
},
"type": "object",
@@ -8931,6 +9141,11 @@
],
"title": "Model"
},
+ "ignore_workflow_system_prompt": {
+ "type": "boolean",
+ "title": "Ignore Workflow System Prompt",
+ "default": false
+ },
"next_loop_on_failure": {
"type": "boolean",
"title": "Next Loop On Failure",
@@ -9072,6 +9287,11 @@
"title": "Disable Cache",
"default": false
},
+ "ignore_workflow_system_prompt": {
+ "type": "boolean",
+ "title": "Ignore Workflow System Prompt",
+ "default": false
+ },
"next_loop_on_failure": {
"type": "boolean",
"title": "Next Loop On Failure",
@@ -9311,6 +9531,11 @@
}
],
"title": "Download Timeout"
+ },
+ "include_extracted_text": {
+ "type": "boolean",
+ "title": "Include Extracted Text",
+ "default": true
}
},
"type": "object",
@@ -9362,6 +9587,11 @@
],
"title": "Model"
},
+ "ignore_workflow_system_prompt": {
+ "type": "boolean",
+ "title": "Ignore Workflow System Prompt",
+ "default": false
+ },
"next_loop_on_failure": {
"type": "boolean",
"title": "Next Loop On Failure",
@@ -9532,6 +9762,18 @@
"title": "Filename",
"description": "Original filename"
},
+ "file_size": {
+ "anyOf": [
+ {
+ "type": "integer"
+ },
+ {
+ "type": "null"
+ }
+ ],
+ "title": "File Size",
+ "description": "Size of the file in bytes"
+ },
"modified_at": {
"anyOf": [
{
@@ -9544,6 +9786,18 @@
],
"title": "Modified At",
"description": "Modified time of the file"
+ },
+ "artifact_id": {
+ "anyOf": [
+ {
+ "type": "string"
+ },
+ {
+ "type": "null"
+ }
+ ],
+ "title": "Artifact Id",
+ "description": "Artifact row id for refresh-on-read"
}
},
"type": "object",
@@ -9676,6 +9930,11 @@
"title": "Disable Cache",
"default": false
},
+ "ignore_workflow_system_prompt": {
+ "type": "boolean",
+ "title": "Ignore Workflow System Prompt",
+ "default": false
+ },
"next_loop_on_failure": {
"type": "boolean",
"title": "Next Loop On Failure",
@@ -9752,6 +10011,11 @@
],
"title": "Model"
},
+ "ignore_workflow_system_prompt": {
+ "type": "boolean",
+ "title": "Ignore Workflow System Prompt",
+ "default": false
+ },
"next_loop_on_failure": {
"type": "boolean",
"title": "Next Loop On Failure",
@@ -9855,6 +10119,11 @@
"title": "Disable Cache",
"default": false
},
+ "ignore_workflow_system_prompt": {
+ "type": "boolean",
+ "title": "Ignore Workflow System Prompt",
+ "default": false
+ },
"next_loop_on_failure": {
"type": "boolean",
"title": "Next Loop On Failure",
@@ -10002,6 +10271,11 @@
],
"title": "Model"
},
+ "ignore_workflow_system_prompt": {
+ "type": "boolean",
+ "title": "Ignore Workflow System Prompt",
+ "default": false
+ },
"next_loop_on_failure": {
"type": "boolean",
"title": "Next Loop On Failure",
@@ -10286,6 +10560,11 @@
"title": "Disable Cache",
"default": false
},
+ "ignore_workflow_system_prompt": {
+ "type": "boolean",
+ "title": "Ignore Workflow System Prompt",
+ "default": false
+ },
"next_loop_on_failure": {
"type": "boolean",
"title": "Next Loop On Failure",
@@ -10368,6 +10647,12 @@
},
{
"$ref": "#/components/schemas/WorkflowTriggerBlock"
+ },
+ {
+ "$ref": "#/components/schemas/GoogleSheetsReadBlock"
+ },
+ {
+ "$ref": "#/components/schemas/GoogleSheetsWriteBlock"
}
],
"discriminator": {
@@ -10382,6 +10667,8 @@
"file_upload": "#/components/schemas/FileUploadBlock",
"file_url_parser": "#/components/schemas/FileParserBlock",
"for_loop": "#/components/schemas/ForLoopBlock",
+ "google_sheets_read": "#/components/schemas/GoogleSheetsReadBlock",
+ "google_sheets_write": "#/components/schemas/GoogleSheetsWriteBlock",
"goto_url": "#/components/schemas/UrlBlock",
"http_request": "#/components/schemas/HttpRequestBlock",
"human_interaction": "#/components/schemas/HumanInteractionBlock",
@@ -10547,7 +10834,12 @@
],
"title": "Model"
},
- "next_loop_on_failure": {
+ "ignore_workflow_system_prompt": {
+ "type": "boolean",
+ "title": "Ignore Workflow System Prompt",
+ "default": false
+ },
+ "next_loop_on_failure": {
"type": "boolean",
"title": "Next Loop On Failure",
"default": false
@@ -10561,6 +10853,9 @@
{
"$ref": "#/components/schemas/ForLoopBlockYAML"
},
+ {
+ "$ref": "#/components/schemas/WhileLoopBlockYAML"
+ },
{
"$ref": "#/components/schemas/CodeBlockYAML"
},
@@ -10626,18 +10921,662 @@
},
{
"$ref": "#/components/schemas/WorkflowTriggerBlockYAML"
+ },
+ {
+ "$ref": "#/components/schemas/GoogleSheetsReadBlockYAML"
+ },
+ {
+ "$ref": "#/components/schemas/GoogleSheetsWriteBlockYAML"
}
]
},
"type": "array",
"title": "Loop Blocks"
},
- "loop_over_parameter_key": {
+ "loop_over_parameter_key": {
+ "type": "string",
+ "title": "Loop Over Parameter Key",
+ "default": ""
+ },
+ "loop_variable_reference": {
+ "anyOf": [
+ {
+ "type": "string"
+ },
+ {
+ "type": "null"
+ }
+ ],
+ "title": "Loop Variable Reference"
+ },
+ "complete_if_empty": {
+ "type": "boolean",
+ "title": "Complete If Empty",
+ "default": false
+ },
+ "data_schema": {
+ "anyOf": [
+ {
+ "additionalProperties": true,
+ "type": "object"
+ },
+ {
+ "type": "string"
+ },
+ {
+ "type": "null"
+ }
+ ],
+ "title": "Data Schema"
+ }
+ },
+ "type": "object",
+ "required": [
+ "label",
+ "loop_blocks"
+ ],
+ "title": "ForLoopBlockYAML"
+ },
+ "GeoTarget": {
+ "properties": {
+ "country": {
+ "type": "string",
+ "maxLength": 2,
+ "minLength": 2,
+ "title": "Country",
+ "description": "ISO 3166-1 alpha-2 country code (e.g., 'US', 'GB', 'DE')",
+ "examples": [
+ "US",
+ "GB",
+ "DE",
+ "FR"
+ ]
+ },
+ "subdivision": {
+ "anyOf": [
+ {
+ "type": "string",
+ "maxLength": 10
+ },
+ {
+ "type": "null"
+ }
+ ],
+ "title": "Subdivision",
+ "description": "ISO 3166-2 subdivision code without country prefix (e.g., 'CA' for California, 'NY' for New York)",
+ "examples": [
+ "CA",
+ "NY",
+ "TX",
+ "ENG"
+ ]
+ },
+ "city": {
+ "anyOf": [
+ {
+ "type": "string",
+ "maxLength": 100
+ },
+ {
+ "type": "null"
+ }
+ ],
+ "title": "City",
+ "description": "City name in English from GeoNames (e.g., 'New York', 'Los Angeles', 'London')",
+ "examples": [
+ "New York",
+ "Los Angeles",
+ "London",
+ "Berlin"
+ ]
+ }
+ },
+ "type": "object",
+ "required": [
+ "country"
+ ],
+ "title": "GeoTarget",
+ "description": "Granular proxy geo-targeting request with country, optional subdivision, and optional city."
+ },
+ "GoogleSheetsReadBlock": {
+ "properties": {
+ "label": {
+ "type": "string",
+ "title": "Label",
+ "description": "Author-facing identifier for a block; unique within a workflow."
+ },
+ "next_block_label": {
+ "anyOf": [
+ {
+ "type": "string"
+ },
+ {
+ "type": "null"
+ }
+ ],
+ "title": "Next Block Label",
+ "description": "Optional pointer to the next block label when constructing a DAG. Defaults to sequential order when omitted."
+ },
+ "block_type": {
+ "type": "string",
+ "const": "google_sheets_read",
+ "title": "Block Type",
+ "default": "google_sheets_read"
+ },
+ "output_parameter": {
+ "$ref": "#/components/schemas/OutputParameter"
+ },
+ "continue_on_failure": {
+ "type": "boolean",
+ "title": "Continue On Failure",
+ "default": false
+ },
+ "model": {
+ "anyOf": [
+ {
+ "additionalProperties": true,
+ "type": "object"
+ },
+ {
+ "type": "null"
+ }
+ ],
+ "title": "Model"
+ },
+ "disable_cache": {
+ "type": "boolean",
+ "title": "Disable Cache",
+ "default": false
+ },
+ "ignore_workflow_system_prompt": {
+ "type": "boolean",
+ "title": "Ignore Workflow System Prompt",
+ "default": false
+ },
+ "next_loop_on_failure": {
+ "type": "boolean",
+ "title": "Next Loop On Failure",
+ "default": false
+ },
+ "spreadsheet_url": {
+ "type": "string",
+ "title": "Spreadsheet Url"
+ },
+ "sheet_name": {
+ "anyOf": [
+ {
+ "type": "string"
+ },
+ {
+ "type": "null"
+ }
+ ],
+ "title": "Sheet Name"
+ },
+ "range": {
+ "anyOf": [
+ {
+ "type": "string"
+ },
+ {
+ "type": "null"
+ }
+ ],
+ "title": "Range"
+ },
+ "credential_id": {
+ "anyOf": [
+ {
+ "type": "string"
+ },
+ {
+ "type": "null"
+ }
+ ],
+ "title": "Credential Id"
+ },
+ "has_header_row": {
+ "type": "boolean",
+ "title": "Has Header Row",
+ "default": true
+ },
+ "parameters": {
+ "items": {
+ "oneOf": [
+ {
+ "$ref": "#/components/schemas/WorkflowParameter"
+ },
+ {
+ "$ref": "#/components/schemas/ContextParameter"
+ },
+ {
+ "$ref": "#/components/schemas/AWSSecretParameter"
+ },
+ {
+ "$ref": "#/components/schemas/AzureSecretParameter"
+ },
+ {
+ "$ref": "#/components/schemas/BitwardenLoginCredentialParameter"
+ },
+ {
+ "$ref": "#/components/schemas/BitwardenSensitiveInformationParameter"
+ },
+ {
+ "$ref": "#/components/schemas/BitwardenCreditCardDataParameter"
+ },
+ {
+ "$ref": "#/components/schemas/OnePasswordCredentialParameter"
+ },
+ {
+ "$ref": "#/components/schemas/AzureVaultCredentialParameter"
+ },
+ {
+ "$ref": "#/components/schemas/OutputParameter"
+ },
+ {
+ "$ref": "#/components/schemas/CredentialParameter"
+ }
+ ],
+ "discriminator": {
+ "propertyName": "parameter_type",
+ "mapping": {
+ "aws_secret": "#/components/schemas/AWSSecretParameter",
+ "azure_secret": "#/components/schemas/AzureSecretParameter",
+ "azure_vault_credential": "#/components/schemas/AzureVaultCredentialParameter",
+ "bitwarden_credit_card_data": "#/components/schemas/BitwardenCreditCardDataParameter",
+ "bitwarden_login_credential": "#/components/schemas/BitwardenLoginCredentialParameter",
+ "bitwarden_sensitive_information": "#/components/schemas/BitwardenSensitiveInformationParameter",
+ "context": "#/components/schemas/ContextParameter",
+ "credential": "#/components/schemas/CredentialParameter",
+ "onepassword": "#/components/schemas/OnePasswordCredentialParameter",
+ "output": "#/components/schemas/OutputParameter",
+ "workflow": "#/components/schemas/WorkflowParameter"
+ }
+ }
+ },
+ "type": "array",
+ "title": "Parameters",
+ "default": []
+ }
+ },
+ "type": "object",
+ "required": [
+ "label",
+ "output_parameter",
+ "spreadsheet_url"
+ ],
+ "title": "GoogleSheetsReadBlock"
+ },
+ "GoogleSheetsReadBlockYAML": {
+ "properties": {
+ "block_type": {
+ "type": "string",
+ "const": "google_sheets_read",
+ "title": "Block Type",
+ "default": "google_sheets_read"
+ },
+ "label": {
+ "type": "string",
+ "title": "Label",
+ "description": "Author-facing identifier; must be unique per workflow."
+ },
+ "next_block_label": {
+ "anyOf": [
+ {
+ "type": "string"
+ },
+ {
+ "type": "null"
+ }
+ ],
+ "title": "Next Block Label",
+ "description": "Optional pointer to the label of the next block. When omitted, it will default to sequential order. See [[s-4bnl]]."
+ },
+ "continue_on_failure": {
+ "type": "boolean",
+ "title": "Continue On Failure",
+ "default": false
+ },
+ "model": {
+ "anyOf": [
+ {
+ "additionalProperties": true,
+ "type": "object"
+ },
+ {
+ "type": "null"
+ }
+ ],
+ "title": "Model"
+ },
+ "ignore_workflow_system_prompt": {
+ "type": "boolean",
+ "title": "Ignore Workflow System Prompt",
+ "default": false
+ },
+ "next_loop_on_failure": {
+ "type": "boolean",
+ "title": "Next Loop On Failure",
+ "default": false
+ },
+ "spreadsheet_url": {
+ "type": "string",
+ "title": "Spreadsheet Url"
+ },
+ "sheet_name": {
+ "anyOf": [
+ {
+ "type": "string"
+ },
+ {
+ "type": "null"
+ }
+ ],
+ "title": "Sheet Name"
+ },
+ "range": {
+ "anyOf": [
+ {
+ "type": "string"
+ },
+ {
+ "type": "null"
+ }
+ ],
+ "title": "Range"
+ },
+ "credential_id": {
+ "anyOf": [
+ {
+ "type": "string"
+ },
+ {
+ "type": "null"
+ }
+ ],
+ "title": "Credential Id"
+ },
+ "has_header_row": {
+ "type": "boolean",
+ "title": "Has Header Row",
+ "default": true
+ },
+ "parameter_keys": {
+ "anyOf": [
+ {
+ "items": {
+ "type": "string"
+ },
+ "type": "array"
+ },
+ {
+ "type": "null"
+ }
+ ],
+ "title": "Parameter Keys"
+ }
+ },
+ "type": "object",
+ "required": [
+ "label",
+ "spreadsheet_url"
+ ],
+ "title": "GoogleSheetsReadBlockYAML"
+ },
+ "GoogleSheetsWriteBlock": {
+ "properties": {
+ "label": {
+ "type": "string",
+ "title": "Label",
+ "description": "Author-facing identifier for a block; unique within a workflow."
+ },
+ "next_block_label": {
+ "anyOf": [
+ {
+ "type": "string"
+ },
+ {
+ "type": "null"
+ }
+ ],
+ "title": "Next Block Label",
+ "description": "Optional pointer to the next block label when constructing a DAG. Defaults to sequential order when omitted."
+ },
+ "block_type": {
+ "type": "string",
+ "const": "google_sheets_write",
+ "title": "Block Type",
+ "default": "google_sheets_write"
+ },
+ "output_parameter": {
+ "$ref": "#/components/schemas/OutputParameter"
+ },
+ "continue_on_failure": {
+ "type": "boolean",
+ "title": "Continue On Failure",
+ "default": false
+ },
+ "model": {
+ "anyOf": [
+ {
+ "additionalProperties": true,
+ "type": "object"
+ },
+ {
+ "type": "null"
+ }
+ ],
+ "title": "Model"
+ },
+ "disable_cache": {
+ "type": "boolean",
+ "title": "Disable Cache",
+ "default": false
+ },
+ "ignore_workflow_system_prompt": {
+ "type": "boolean",
+ "title": "Ignore Workflow System Prompt",
+ "default": false
+ },
+ "next_loop_on_failure": {
+ "type": "boolean",
+ "title": "Next Loop On Failure",
+ "default": false
+ },
+ "spreadsheet_url": {
+ "type": "string",
+ "title": "Spreadsheet Url"
+ },
+ "sheet_name": {
+ "anyOf": [
+ {
+ "type": "string"
+ },
+ {
+ "type": "null"
+ }
+ ],
+ "title": "Sheet Name"
+ },
+ "range": {
+ "anyOf": [
+ {
+ "type": "string"
+ },
+ {
+ "type": "null"
+ }
+ ],
+ "title": "Range"
+ },
+ "credential_id": {
+ "anyOf": [
+ {
+ "type": "string"
+ },
+ {
+ "type": "null"
+ }
+ ],
+ "title": "Credential Id"
+ },
+ "write_mode": {
+ "type": "string",
+ "enum": [
+ "append",
+ "update"
+ ],
+ "title": "Write Mode",
+ "default": "append"
+ },
+ "values": {
+ "type": "string",
+ "title": "Values",
+ "default": ""
+ },
+ "column_mapping": {
+ "anyOf": [
+ {
+ "additionalProperties": {
+ "type": "string"
+ },
+ "type": "object"
+ },
+ {
+ "type": "null"
+ }
+ ],
+ "title": "Column Mapping"
+ },
+ "create_sheet_if_missing": {
+ "type": "boolean",
+ "title": "Create Sheet If Missing",
+ "default": false
+ },
+ "parameters": {
+ "items": {
+ "oneOf": [
+ {
+ "$ref": "#/components/schemas/WorkflowParameter"
+ },
+ {
+ "$ref": "#/components/schemas/ContextParameter"
+ },
+ {
+ "$ref": "#/components/schemas/AWSSecretParameter"
+ },
+ {
+ "$ref": "#/components/schemas/AzureSecretParameter"
+ },
+ {
+ "$ref": "#/components/schemas/BitwardenLoginCredentialParameter"
+ },
+ {
+ "$ref": "#/components/schemas/BitwardenSensitiveInformationParameter"
+ },
+ {
+ "$ref": "#/components/schemas/BitwardenCreditCardDataParameter"
+ },
+ {
+ "$ref": "#/components/schemas/OnePasswordCredentialParameter"
+ },
+ {
+ "$ref": "#/components/schemas/AzureVaultCredentialParameter"
+ },
+ {
+ "$ref": "#/components/schemas/OutputParameter"
+ },
+ {
+ "$ref": "#/components/schemas/CredentialParameter"
+ }
+ ],
+ "discriminator": {
+ "propertyName": "parameter_type",
+ "mapping": {
+ "aws_secret": "#/components/schemas/AWSSecretParameter",
+ "azure_secret": "#/components/schemas/AzureSecretParameter",
+ "azure_vault_credential": "#/components/schemas/AzureVaultCredentialParameter",
+ "bitwarden_credit_card_data": "#/components/schemas/BitwardenCreditCardDataParameter",
+ "bitwarden_login_credential": "#/components/schemas/BitwardenLoginCredentialParameter",
+ "bitwarden_sensitive_information": "#/components/schemas/BitwardenSensitiveInformationParameter",
+ "context": "#/components/schemas/ContextParameter",
+ "credential": "#/components/schemas/CredentialParameter",
+ "onepassword": "#/components/schemas/OnePasswordCredentialParameter",
+ "output": "#/components/schemas/OutputParameter",
+ "workflow": "#/components/schemas/WorkflowParameter"
+ }
+ }
+ },
+ "type": "array",
+ "title": "Parameters",
+ "default": []
+ }
+ },
+ "type": "object",
+ "required": [
+ "label",
+ "output_parameter",
+ "spreadsheet_url"
+ ],
+ "title": "GoogleSheetsWriteBlock"
+ },
+ "GoogleSheetsWriteBlockYAML": {
+ "properties": {
+ "block_type": {
+ "type": "string",
+ "const": "google_sheets_write",
+ "title": "Block Type",
+ "default": "google_sheets_write"
+ },
+ "label": {
+ "type": "string",
+ "title": "Label",
+ "description": "Author-facing identifier; must be unique per workflow."
+ },
+ "next_block_label": {
+ "anyOf": [
+ {
+ "type": "string"
+ },
+ {
+ "type": "null"
+ }
+ ],
+ "title": "Next Block Label",
+ "description": "Optional pointer to the label of the next block. When omitted, it will default to sequential order. See [[s-4bnl]]."
+ },
+ "continue_on_failure": {
+ "type": "boolean",
+ "title": "Continue On Failure",
+ "default": false
+ },
+ "model": {
+ "anyOf": [
+ {
+ "additionalProperties": true,
+ "type": "object"
+ },
+ {
+ "type": "null"
+ }
+ ],
+ "title": "Model"
+ },
+ "ignore_workflow_system_prompt": {
+ "type": "boolean",
+ "title": "Ignore Workflow System Prompt",
+ "default": false
+ },
+ "next_loop_on_failure": {
+ "type": "boolean",
+ "title": "Next Loop On Failure",
+ "default": false
+ },
+ "spreadsheet_url": {
"type": "string",
- "title": "Loop Over Parameter Key",
- "default": ""
+ "title": "Spreadsheet Url"
},
- "loop_variable_reference": {
+ "sheet_name": {
"anyOf": [
{
"type": "string"
@@ -10646,19 +11585,21 @@
"type": "null"
}
],
- "title": "Loop Variable Reference"
+ "title": "Sheet Name"
},
- "complete_if_empty": {
- "type": "boolean",
- "title": "Complete If Empty",
- "default": false
- },
- "data_schema": {
+ "range": {
"anyOf": [
{
- "additionalProperties": true,
- "type": "object"
+ "type": "string"
},
+ {
+ "type": "null"
+ }
+ ],
+ "title": "Range"
+ },
+ "credential_id": {
+ "anyOf": [
{
"type": "string"
},
@@ -10666,76 +11607,62 @@
"type": "null"
}
],
- "title": "Data Schema"
- }
- },
- "type": "object",
- "required": [
- "label",
- "loop_blocks"
- ],
- "title": "ForLoopBlockYAML"
- },
- "GeoTarget": {
- "properties": {
- "country": {
+ "title": "Credential Id"
+ },
+ "write_mode": {
"type": "string",
- "maxLength": 2,
- "minLength": 2,
- "title": "Country",
- "description": "ISO 3166-1 alpha-2 country code (e.g., 'US', 'GB', 'DE')",
- "examples": [
- "US",
- "GB",
- "DE",
- "FR"
- ]
+ "enum": [
+ "append",
+ "update"
+ ],
+ "title": "Write Mode",
+ "default": "append"
},
- "subdivision": {
+ "values": {
+ "type": "string",
+ "title": "Values",
+ "default": ""
+ },
+ "column_mapping": {
"anyOf": [
{
- "type": "string",
- "maxLength": 10
+ "additionalProperties": {
+ "type": "string"
+ },
+ "type": "object"
},
{
"type": "null"
}
],
- "title": "Subdivision",
- "description": "ISO 3166-2 subdivision code without country prefix (e.g., 'CA' for California, 'NY' for New York)",
- "examples": [
- "CA",
- "NY",
- "TX",
- "ENG"
- ]
+ "title": "Column Mapping"
},
- "city": {
+ "create_sheet_if_missing": {
+ "type": "boolean",
+ "title": "Create Sheet If Missing",
+ "default": false
+ },
+ "parameter_keys": {
"anyOf": [
{
- "type": "string",
- "maxLength": 100
+ "items": {
+ "type": "string"
+ },
+ "type": "array"
},
{
"type": "null"
}
],
- "title": "City",
- "description": "City name in English from GeoNames (e.g., 'New York', 'Los Angeles', 'London')",
- "examples": [
- "New York",
- "Los Angeles",
- "London",
- "Berlin"
- ]
+ "title": "Parameter Keys"
}
},
"type": "object",
"required": [
- "country"
+ "label",
+ "spreadsheet_url"
],
- "title": "GeoTarget",
- "description": "Granular geographic targeting for proxy selection.\n\nSupports country, subdivision (state/region), and city level targeting.\nUses ISO 3166-1 alpha-2 for countries, ISO 3166-2 for subdivisions,\nand GeoNames English names for cities.\n\nExamples:\n - {\"country\": \"US\"} - United States (same as RESIDENTIAL)\n - {\"country\": \"US\", \"subdivision\": \"CA\"} - California, US\n - {\"country\": \"US\", \"subdivision\": \"NY\", \"city\": \"New York\"} - New York City\n - {\"country\": \"GB\", \"city\": \"London\"} - London, UK"
+ "title": "GoogleSheetsWriteBlockYAML"
},
"HTTPValidationError": {
"properties": {
@@ -10800,6 +11727,11 @@
"title": "Disable Cache",
"default": false
},
+ "ignore_workflow_system_prompt": {
+ "type": "boolean",
+ "title": "Ignore Workflow System Prompt",
+ "default": false
+ },
"next_loop_on_failure": {
"type": "boolean",
"title": "Next Loop On Failure",
@@ -10995,6 +11927,11 @@
],
"title": "Model"
},
+ "ignore_workflow_system_prompt": {
+ "type": "boolean",
+ "title": "Ignore Workflow System Prompt",
+ "default": false
+ },
"next_loop_on_failure": {
"type": "boolean",
"title": "Next Loop On Failure",
@@ -11153,6 +12090,11 @@
"title": "Disable Cache",
"default": false
},
+ "ignore_workflow_system_prompt": {
+ "type": "boolean",
+ "title": "Ignore Workflow System Prompt",
+ "default": false
+ },
"next_loop_on_failure": {
"type": "boolean",
"title": "Next Loop On Failure",
@@ -11393,6 +12335,11 @@
],
"title": "Download Timeout"
},
+ "include_extracted_text": {
+ "type": "boolean",
+ "title": "Include Extracted Text",
+ "default": true
+ },
"instructions": {
"type": "string",
"title": "Instructions",
@@ -11487,6 +12434,11 @@
],
"title": "Model"
},
+ "ignore_workflow_system_prompt": {
+ "type": "boolean",
+ "title": "Ignore Workflow System Prompt",
+ "default": false
+ },
"next_loop_on_failure": {
"type": "boolean",
"title": "Next Loop On Failure",
@@ -11827,6 +12779,11 @@
"title": "Disable Cache",
"default": false
},
+ "ignore_workflow_system_prompt": {
+ "type": "boolean",
+ "title": "Ignore Workflow System Prompt",
+ "default": false
+ },
"next_loop_on_failure": {
"type": "boolean",
"title": "Next Loop On Failure",
@@ -12066,6 +13023,11 @@
}
],
"title": "Download Timeout"
+ },
+ "include_extracted_text": {
+ "type": "boolean",
+ "title": "Include Extracted Text",
+ "default": true
}
},
"type": "object",
@@ -12117,6 +13079,11 @@
],
"title": "Model"
},
+ "ignore_workflow_system_prompt": {
+ "type": "boolean",
+ "title": "Ignore Workflow System Prompt",
+ "default": false
+ },
"next_loop_on_failure": {
"type": "boolean",
"title": "Next Loop On Failure",
@@ -12390,7 +13357,7 @@
"description": "Maximum number of times to scroll for screenshots"
},
"credential_type": {
- "$ref": "#/components/schemas/skyvern__schemas__run_blocks__CredentialType",
+ "$ref": "#/components/schemas/skyvern__schemas__credential_type__CredentialType",
"description": "Where to get the credential from"
},
"prompt": {
@@ -12573,6 +13540,11 @@
"title": "Disable Cache",
"default": false
},
+ "ignore_workflow_system_prompt": {
+ "type": "boolean",
+ "title": "Ignore Workflow System Prompt",
+ "default": false
+ },
"next_loop_on_failure": {
"type": "boolean",
"title": "Next Loop On Failure",
@@ -12805,6 +13777,11 @@
}
],
"title": "Download Timeout"
+ },
+ "include_extracted_text": {
+ "type": "boolean",
+ "title": "Include Extracted Text",
+ "default": true
}
},
"type": "object",
@@ -12857,6 +13834,11 @@
],
"title": "Model"
},
+ "ignore_workflow_system_prompt": {
+ "type": "boolean",
+ "title": "Ignore Workflow System Prompt",
+ "default": false
+ },
"next_loop_on_failure": {
"type": "boolean",
"title": "Next Loop On Failure",
@@ -13559,6 +14541,11 @@
"title": "Disable Cache",
"default": false
},
+ "ignore_workflow_system_prompt": {
+ "type": "boolean",
+ "title": "Ignore Workflow System Prompt",
+ "default": false
+ },
"next_loop_on_failure": {
"type": "boolean",
"title": "Next Loop On Failure",
@@ -13632,6 +14619,11 @@
],
"title": "Model"
},
+ "ignore_workflow_system_prompt": {
+ "type": "boolean",
+ "title": "Ignore Workflow System Prompt",
+ "default": false
+ },
"next_loop_on_failure": {
"type": "boolean",
"title": "Next Loop On Failure",
@@ -13762,6 +14754,11 @@
"title": "Disable Cache",
"default": false
},
+ "ignore_workflow_system_prompt": {
+ "type": "boolean",
+ "title": "Ignore Workflow System Prompt",
+ "default": false
+ },
"next_loop_on_failure": {
"type": "boolean",
"title": "Next Loop On Failure",
@@ -13906,6 +14903,11 @@
],
"title": "Model"
},
+ "ignore_workflow_system_prompt": {
+ "type": "boolean",
+ "title": "Ignore Workflow System Prompt",
+ "default": false
+ },
"next_loop_on_failure": {
"type": "boolean",
"title": "Next Loop On Failure",
@@ -14068,6 +15070,7 @@
"RESIDENTIAL_NL",
"RESIDENTIAL_PH",
"RESIDENTIAL_KR",
+ "RESIDENTIAL_SA",
"RESIDENTIAL_ISP",
"NONE"
],
@@ -14208,37 +15211,144 @@
"title": "Workflow Run Id",
"description": "The workflow run ID used for this action"
},
- "result": {
+ "result": {
+ "anyOf": [
+ {},
+ {
+ "type": "null"
+ }
+ ],
+ "title": "Result",
+ "description": "The result from the action (e.g., selector, value, extracted data)"
+ }
+ },
+ "type": "object",
+ "required": [
+ "workflow_run_id"
+ ],
+ "title": "RunSdkActionResponse",
+ "description": "Response from running an SDK action."
+ },
+ "RunStatus": {
+ "type": "string",
+ "enum": [
+ "created",
+ "queued",
+ "running",
+ "timed_out",
+ "failed",
+ "terminated",
+ "completed",
+ "canceled"
+ ],
+ "title": "RunStatus"
+ },
+ "RunWebhookReplayResponse": {
+ "properties": {
+ "run_id": {
+ "type": "string",
+ "title": "Run Id",
+ "description": "Identifier of the run that was replayed"
+ },
+ "run_type": {
+ "type": "string",
+ "title": "Run Type",
+ "description": "Run type associated with the payload"
+ },
+ "default_webhook_url": {
+ "anyOf": [
+ {
+ "type": "string"
+ },
+ {
+ "type": "null"
+ }
+ ],
+ "title": "Default Webhook Url",
+ "description": "Webhook URL stored on the original run configuration"
+ },
+ "target_webhook_url": {
+ "anyOf": [
+ {
+ "type": "string"
+ },
+ {
+ "type": "null"
+ }
+ ],
+ "title": "Target Webhook Url",
+ "description": "Webhook URL that the replay attempted to reach"
+ },
+ "payload": {
+ "type": "string",
+ "title": "Payload",
+ "description": "JSON payload that was delivered during the replay attempt"
+ },
+ "headers": {
+ "additionalProperties": {
+ "type": "string"
+ },
+ "type": "object",
+ "title": "Headers",
+ "description": "Signed headers that were generated for the replay attempt"
+ },
+ "status_code": {
+ "anyOf": [
+ {
+ "type": "integer"
+ },
+ {
+ "type": "null"
+ }
+ ],
+ "title": "Status Code",
+ "description": "HTTP status code returned by the webhook receiver, if available"
+ },
+ "latency_ms": {
+ "anyOf": [
+ {
+ "type": "integer"
+ },
+ {
+ "type": "null"
+ }
+ ],
+ "title": "Latency Ms",
+ "description": "Round-trip latency in milliseconds for the replay attempt"
+ },
+ "response_body": {
+ "anyOf": [
+ {
+ "type": "string"
+ },
+ {
+ "type": "null"
+ }
+ ],
+ "title": "Response Body",
+ "description": "Body returned by the webhook receiver (truncated to 2KB)"
+ },
+ "error": {
"anyOf": [
- {},
+ {
+ "type": "string"
+ },
{
"type": "null"
}
],
- "title": "Result",
- "description": "The result from the action (e.g., selector, value, extracted data)"
+ "title": "Error",
+ "description": "Error message if the replay attempt failed"
}
},
"type": "object",
"required": [
- "workflow_run_id"
- ],
- "title": "RunSdkActionResponse",
- "description": "Response from running an SDK action."
- },
- "RunStatus": {
- "type": "string",
- "enum": [
- "created",
- "queued",
- "running",
- "timed_out",
- "failed",
- "terminated",
- "completed",
- "canceled"
+ "run_id",
+ "run_type",
+ "payload",
+ "headers"
],
- "title": "RunStatus"
+ "title": "RunWebhookReplayResponse"
},
"Script": {
"properties": {
@@ -14360,11 +15470,25 @@
"default": false
},
"script_id": {
- "anyOf": [{"type": "string"}, {"type": "null"}],
+ "anyOf": [
+ {
+ "type": "string"
+ },
+ {
+ "type": "null"
+ }
+ ],
"title": "Script Id"
},
"script_revision_id": {
- "anyOf": [{"type": "string"}, {"type": "null"}],
+ "anyOf": [
+ {
+ "type": "string"
+ },
+ {
+ "type": "null"
+ }
+ ],
"title": "Script Revision Id"
}
},
@@ -14577,6 +15701,11 @@
"title": "Disable Cache",
"default": false
},
+ "ignore_workflow_system_prompt": {
+ "type": "boolean",
+ "title": "Ignore Workflow System Prompt",
+ "default": false
+ },
"next_loop_on_failure": {
"type": "boolean",
"title": "Next Loop On Failure",
@@ -14679,6 +15808,11 @@
],
"title": "Model"
},
+ "ignore_workflow_system_prompt": {
+ "type": "boolean",
+ "title": "Ignore Workflow System Prompt",
+ "default": false
+ },
"next_loop_on_failure": {
"type": "boolean",
"title": "Next Loop On Failure",
@@ -15083,6 +16217,11 @@
"title": "Disable Cache",
"default": false
},
+ "ignore_workflow_system_prompt": {
+ "type": "boolean",
+ "title": "Ignore Workflow System Prompt",
+ "default": false
+ },
"next_loop_on_failure": {
"type": "boolean",
"title": "Next Loop On Failure",
@@ -15322,6 +16461,11 @@
}
],
"title": "Download Timeout"
+ },
+ "include_extracted_text": {
+ "type": "boolean",
+ "title": "Include Extracted Text",
+ "default": true
}
},
"type": "object",
@@ -15373,6 +16517,11 @@
],
"title": "Model"
},
+ "ignore_workflow_system_prompt": {
+ "type": "boolean",
+ "title": "Ignore Workflow System Prompt",
+ "default": false
+ },
"next_loop_on_failure": {
"type": "boolean",
"title": "Next Loop On Failure",
@@ -15720,7 +16869,7 @@
}
],
"title": "Proxy Location",
- "description": "\nGeographic Proxy location to route the browser traffic through. This is only available in Skyvern Cloud.\n\nAvailable geotargeting options:\n- RESIDENTIAL: the default value. Skyvern Cloud uses a random US residential proxy.\n- RESIDENTIAL_ES: Spain\n- RESIDENTIAL_IE: Ireland\n- RESIDENTIAL_GB: United Kingdom\n- RESIDENTIAL_IN: India\n- RESIDENTIAL_JP: Japan\n- RESIDENTIAL_FR: France\n- RESIDENTIAL_DE: Germany\n- RESIDENTIAL_NZ: New Zealand\n- RESIDENTIAL_PH: Philippines\n- RESIDENTIAL_KR: South Korea\n- RESIDENTIAL_ZA: South Africa\n- RESIDENTIAL_AR: Argentina\n- RESIDENTIAL_AU: Australia\n- RESIDENTIAL_BR: Brazil\n- RESIDENTIAL_TR: Turkey\n- RESIDENTIAL_CA: Canada\n- RESIDENTIAL_MX: Mexico\n- RESIDENTIAL_IT: Italy\n- RESIDENTIAL_NL: Netherlands\n- RESIDENTIAL_ISP: ISP proxy\n- US-CA: California (deprecated, routes through RESIDENTIAL_ISP)\n- US-NY: New York (deprecated, routes through RESIDENTIAL_ISP)\n- US-TX: Texas (deprecated, routes through RESIDENTIAL_ISP)\n- US-FL: Florida (deprecated, routes through RESIDENTIAL_ISP)\n- US-WA: Washington (deprecated, routes through RESIDENTIAL_ISP)\n- NONE: No proxy\n Can also be a GeoTarget object for granular city/state targeting: {\"country\": \"US\", \"subdivision\": \"CA\", \"city\": \"San Francisco\"}",
+ "description": "\nGeographic Proxy location to route the browser traffic through. This is only available in Skyvern Cloud.\n\nAvailable geotargeting options:\n- RESIDENTIAL: the default value. Skyvern Cloud uses a random US residential proxy.\n- RESIDENTIAL_ES: Spain\n- RESIDENTIAL_IE: Ireland\n- RESIDENTIAL_GB: United Kingdom\n- RESIDENTIAL_IN: India\n- RESIDENTIAL_JP: Japan\n- RESIDENTIAL_FR: France\n- RESIDENTIAL_DE: Germany\n- RESIDENTIAL_NZ: New Zealand\n- RESIDENTIAL_PH: Philippines\n- RESIDENTIAL_KR: South Korea\n- RESIDENTIAL_SA: Saudi Arabia\n- RESIDENTIAL_ZA: South Africa\n- RESIDENTIAL_AR: Argentina\n- RESIDENTIAL_AU: Australia\n- RESIDENTIAL_BR: Brazil\n- RESIDENTIAL_TR: Turkey\n- RESIDENTIAL_CA: Canada\n- RESIDENTIAL_MX: Mexico\n- RESIDENTIAL_IT: Italy\n- RESIDENTIAL_NL: Netherlands\n- RESIDENTIAL_ISP: ISP proxy\n- US-CA: California (deprecated, routes through RESIDENTIAL_ISP)\n- US-NY: New York (deprecated, routes through RESIDENTIAL_ISP)\n- US-TX: Texas (deprecated, routes through RESIDENTIAL_ISP)\n- US-FL: Florida (deprecated, routes through RESIDENTIAL_ISP)\n- US-WA: Washington (deprecated, routes through RESIDENTIAL_ISP)\n- NONE: No proxy\n Can also be a GeoTarget object for granular city/state targeting: {\"country\": \"US\", \"subdivision\": \"CA\", \"city\": \"San Francisco\"}",
"default": "RESIDENTIAL"
},
"data_extraction_schema": {
@@ -16280,6 +17429,11 @@
"title": "Disable Cache",
"default": false
},
+ "ignore_workflow_system_prompt": {
+ "type": "boolean",
+ "title": "Ignore Workflow System Prompt",
+ "default": false
+ },
"next_loop_on_failure": {
"type": "boolean",
"title": "Next Loop On Failure",
@@ -16383,6 +17537,11 @@
],
"title": "Model"
},
+ "ignore_workflow_system_prompt": {
+ "type": "boolean",
+ "title": "Ignore Workflow System Prompt",
+ "default": false
+ },
"next_loop_on_failure": {
"type": "boolean",
"title": "Next Loop On Failure",
@@ -16498,6 +17657,11 @@
"title": "Disable Cache",
"default": false
},
+ "ignore_workflow_system_prompt": {
+ "type": "boolean",
+ "title": "Ignore Workflow System Prompt",
+ "default": false
+ },
"next_loop_on_failure": {
"type": "boolean",
"title": "Next Loop On Failure",
@@ -16639,6 +17803,11 @@
],
"title": "Model"
},
+ "ignore_workflow_system_prompt": {
+ "type": "boolean",
+ "title": "Ignore Workflow System Prompt",
+ "default": false
+ },
"next_loop_on_failure": {
"type": "boolean",
"title": "Next Loop On Failure",
@@ -16883,6 +18052,17 @@
],
"title": "Thought Cost"
},
+ "last_llm_model": {
+ "anyOf": [
+ {
+ "type": "string"
+ },
+ {
+ "type": "null"
+ }
+ ],
+ "title": "Last Llm Model"
+ },
"created_at": {
"type": "string",
"format": "date-time",
@@ -17100,6 +18280,11 @@
"title": "Disable Cache",
"default": false
},
+ "ignore_workflow_system_prompt": {
+ "type": "boolean",
+ "title": "Ignore Workflow System Prompt",
+ "default": false
+ },
"next_loop_on_failure": {
"type": "boolean",
"title": "Next Loop On Failure",
@@ -17166,6 +18351,11 @@
],
"title": "Model"
},
+ "ignore_workflow_system_prompt": {
+ "type": "boolean",
+ "title": "Ignore Workflow System Prompt",
+ "default": false
+ },
"next_loop_on_failure": {
"type": "boolean",
"title": "Next Loop On Failure",
@@ -17239,6 +18429,11 @@
"title": "Disable Cache",
"default": false
},
+ "ignore_workflow_system_prompt": {
+ "type": "boolean",
+ "title": "Ignore Workflow System Prompt",
+ "default": false
+ },
"next_loop_on_failure": {
"type": "boolean",
"title": "Next Loop On Failure",
@@ -17471,6 +18666,11 @@
}
],
"title": "Download Timeout"
+ },
+ "include_extracted_text": {
+ "type": "boolean",
+ "title": "Include Extracted Text",
+ "default": true
}
},
"type": "object",
@@ -17523,6 +18723,11 @@
],
"title": "Model"
},
+ "ignore_workflow_system_prompt": {
+ "type": "boolean",
+ "title": "Ignore Workflow System Prompt",
+ "default": false
+ },
"next_loop_on_failure": {
"type": "boolean",
"title": "Next Loop On Failure",
@@ -17649,6 +18854,11 @@
"title": "Disable Cache",
"default": false
},
+ "ignore_workflow_system_prompt": {
+ "type": "boolean",
+ "title": "Ignore Workflow System Prompt",
+ "default": false
+ },
"next_loop_on_failure": {
"type": "boolean",
"title": "Next Loop On Failure",
@@ -17888,6 +19098,11 @@
}
],
"title": "Download Timeout"
+ },
+ "include_extracted_text": {
+ "type": "boolean",
+ "title": "Include Extracted Text",
+ "default": true
}
},
"type": "object",
@@ -17939,6 +19154,11 @@
],
"title": "Model"
},
+ "ignore_workflow_system_prompt": {
+ "type": "boolean",
+ "title": "Ignore Workflow System Prompt",
+ "default": false
+ },
"next_loop_on_failure": {
"type": "boolean",
"title": "Next Loop On Failure",
@@ -18096,6 +19316,11 @@
"title": "Disable Cache",
"default": false
},
+ "ignore_workflow_system_prompt": {
+ "type": "boolean",
+ "title": "Ignore Workflow System Prompt",
+ "default": false
+ },
"next_loop_on_failure": {
"type": "boolean",
"title": "Next Loop On Failure",
@@ -18214,6 +19439,11 @@
],
"title": "Model"
},
+ "ignore_workflow_system_prompt": {
+ "type": "boolean",
+ "title": "Ignore Workflow System Prompt",
+ "default": false
+ },
"next_loop_on_failure": {
"type": "boolean",
"title": "Next Loop On Failure",
@@ -18368,6 +19598,12 @@
},
{
"$ref": "#/components/schemas/WorkflowTriggerBlock"
+ },
+ {
+ "$ref": "#/components/schemas/GoogleSheetsReadBlock"
+ },
+ {
+ "$ref": "#/components/schemas/GoogleSheetsWriteBlock"
}
],
"discriminator": {
@@ -18382,6 +19618,8 @@
"file_upload": "#/components/schemas/FileUploadBlock",
"file_url_parser": "#/components/schemas/FileParserBlock",
"for_loop": "#/components/schemas/ForLoopBlock",
+ "google_sheets_read": "#/components/schemas/GoogleSheetsReadBlock",
+ "google_sheets_write": "#/components/schemas/GoogleSheetsWriteBlock",
"goto_url": "#/components/schemas/UrlBlock",
"http_request": "#/components/schemas/HttpRequestBlock",
"human_interaction": "#/components/schemas/HumanInteractionBlock",
@@ -18562,6 +19800,12 @@
},
{
"$ref": "#/components/schemas/WorkflowTriggerBlockYAML"
+ },
+ {
+ "$ref": "#/components/schemas/GoogleSheetsReadBlockYAML"
+ },
+ {
+ "$ref": "#/components/schemas/GoogleSheetsWriteBlockYAML"
}
]
},
@@ -18808,6 +20052,28 @@
],
"title": "Import Error"
},
+ "created_by": {
+ "anyOf": [
+ {
+ "type": "string"
+ },
+ {
+ "type": "null"
+ }
+ ],
+ "title": "Created By"
+ },
+ "edited_by": {
+ "anyOf": [
+ {
+ "type": "string"
+ },
+ {
+ "type": "null"
+ }
+ ],
+ "title": "Edited By"
+ },
"created_at": {
"type": "string",
"format": "date-time",
@@ -19188,6 +20454,12 @@
},
{
"$ref": "#/components/schemas/WorkflowTriggerBlock"
+ },
+ {
+ "$ref": "#/components/schemas/GoogleSheetsReadBlock"
+ },
+ {
+ "$ref": "#/components/schemas/GoogleSheetsWriteBlock"
}
],
"discriminator": {
@@ -19202,6 +20474,8 @@
"file_upload": "#/components/schemas/FileUploadBlock",
"file_url_parser": "#/components/schemas/FileParserBlock",
"for_loop": "#/components/schemas/ForLoopBlock",
+ "google_sheets_read": "#/components/schemas/GoogleSheetsReadBlock",
+ "google_sheets_write": "#/components/schemas/GoogleSheetsWriteBlock",
"goto_url": "#/components/schemas/UrlBlock",
"http_request": "#/components/schemas/HttpRequestBlock",
"human_interaction": "#/components/schemas/HumanInteractionBlock",
@@ -19234,6 +20508,31 @@
}
],
"title": "Finally Block Label"
+ },
+ "error_code_mapping": {
+ "anyOf": [
+ {
+ "additionalProperties": {
+ "type": "string"
+ },
+ "type": "object"
+ },
+ {
+ "type": "null"
+ }
+ ],
+ "title": "Error Code Mapping"
+ },
+ "workflow_system_prompt": {
+ "anyOf": [
+ {
+ "type": "string"
+ },
+ {
+ "type": "null"
+ }
+ ],
+ "title": "Workflow System Prompt"
}
},
"type": "object",
@@ -19380,6 +20679,12 @@
},
{
"$ref": "#/components/schemas/WorkflowTriggerBlockYAML"
+ },
+ {
+ "$ref": "#/components/schemas/GoogleSheetsReadBlockYAML"
+ },
+ {
+ "$ref": "#/components/schemas/GoogleSheetsWriteBlockYAML"
}
],
"discriminator": {
@@ -19394,6 +20699,8 @@
"file_upload": "#/components/schemas/FileUploadBlockYAML",
"file_url_parser": "#/components/schemas/FileParserBlockYAML",
"for_loop": "#/components/schemas/ForLoopBlockYAML",
+ "google_sheets_read": "#/components/schemas/GoogleSheetsReadBlockYAML",
+ "google_sheets_write": "#/components/schemas/GoogleSheetsWriteBlockYAML",
"goto_url": "#/components/schemas/UrlBlockYAML",
"http_request": "#/components/schemas/HttpRequestBlockYAML",
"human_interaction": "#/components/schemas/HumanInteractionBlockYAML",
@@ -19426,6 +20733,31 @@
}
],
"title": "Finally Block Label"
+ },
+ "error_code_mapping": {
+ "anyOf": [
+ {
+ "additionalProperties": {
+ "type": "string"
+ },
+ "type": "object"
+ },
+ {
+ "type": "null"
+ }
+ ],
+ "title": "Error Code Mapping"
+ },
+ "workflow_system_prompt": {
+ "anyOf": [
+ {
+ "type": "string"
+ },
+ {
+ "type": "null"
+ }
+ ],
+ "title": "Workflow System Prompt"
}
},
"type": "object",
@@ -19854,8 +21186,7 @@
{
"type": "null"
}
- ],
- "title": "Script Run"
+ ]
},
"job_id": {
"anyOf": [
@@ -19933,6 +21264,32 @@
],
"title": "Workflow Schedule Id"
},
+ "ignore_inherited_workflow_system_prompt": {
+ "type": "boolean",
+ "title": "Ignore Inherited Workflow System Prompt",
+ "default": false
+ },
+ "copilot_session_id": {
+ "anyOf": [
+ {
+ "type": "string"
+ },
+ {
+ "type": "null"
+ }
+ ],
+ "title": "Copilot Session Id"
+ },
+ "credits_used": {
+ "type": "integer",
+ "title": "Credits Used",
+ "default": 0
+ },
+ "cached_credits_used": {
+ "type": "integer",
+ "title": "Cached Credits Used",
+ "default": 0
+ },
"queued_at": {
"anyOf": [
{
@@ -20251,6 +21608,11 @@
"title": "Include Action History In Verification",
"default": false
},
+ "include_extracted_text": {
+ "type": "boolean",
+ "title": "Include Extracted Text",
+ "default": true
+ },
"duration": {
"anyOf": [
{
@@ -20431,8 +21793,7 @@
{
"type": "null"
}
- ],
- "title": "Script Run"
+ ]
}
},
"type": "object",
@@ -20498,7 +21859,7 @@
}
],
"title": "Proxy Location",
- "description": "\nGeographic Proxy location to route the browser traffic through. This is only available in Skyvern Cloud.\n\nAvailable geotargeting options:\n- RESIDENTIAL: the default value. Skyvern Cloud uses a random US residential proxy.\n- RESIDENTIAL_ES: Spain\n- RESIDENTIAL_IE: Ireland\n- RESIDENTIAL_GB: United Kingdom\n- RESIDENTIAL_IN: India\n- RESIDENTIAL_JP: Japan\n- RESIDENTIAL_FR: France\n- RESIDENTIAL_DE: Germany\n- RESIDENTIAL_NZ: New Zealand\n- RESIDENTIAL_PH: Philippines\n- RESIDENTIAL_KR: South Korea\n- RESIDENTIAL_ZA: South Africa\n- RESIDENTIAL_AR: Argentina\n- RESIDENTIAL_AU: Australia\n- RESIDENTIAL_BR: Brazil\n- RESIDENTIAL_TR: Turkey\n- RESIDENTIAL_CA: Canada\n- RESIDENTIAL_MX: Mexico\n- RESIDENTIAL_IT: Italy\n- RESIDENTIAL_NL: Netherlands\n- RESIDENTIAL_ISP: ISP proxy\n- US-CA: California (deprecated, routes through RESIDENTIAL_ISP)\n- US-NY: New York (deprecated, routes through RESIDENTIAL_ISP)\n- US-TX: Texas (deprecated, routes through RESIDENTIAL_ISP)\n- US-FL: Florida (deprecated, routes through RESIDENTIAL_ISP)\n- US-WA: Washington (deprecated, routes through RESIDENTIAL_ISP)\n- NONE: No proxy\n Can also be a GeoTarget object for granular city/state targeting: {\"country\": \"US\", \"subdivision\": \"CA\", \"city\": \"San Francisco\"}",
+ "description": "\nGeographic Proxy location to route the browser traffic through. This is only available in Skyvern Cloud.\n\nAvailable geotargeting options:\n- RESIDENTIAL: the default value. Skyvern Cloud uses a random US residential proxy.\n- RESIDENTIAL_ES: Spain\n- RESIDENTIAL_IE: Ireland\n- RESIDENTIAL_GB: United Kingdom\n- RESIDENTIAL_IN: India\n- RESIDENTIAL_JP: Japan\n- RESIDENTIAL_FR: France\n- RESIDENTIAL_DE: Germany\n- RESIDENTIAL_NZ: New Zealand\n- RESIDENTIAL_PH: Philippines\n- RESIDENTIAL_KR: South Korea\n- RESIDENTIAL_SA: Saudi Arabia\n- RESIDENTIAL_ZA: South Africa\n- RESIDENTIAL_AR: Argentina\n- RESIDENTIAL_AU: Australia\n- RESIDENTIAL_BR: Brazil\n- RESIDENTIAL_TR: Turkey\n- RESIDENTIAL_CA: Canada\n- RESIDENTIAL_MX: Mexico\n- RESIDENTIAL_IT: Italy\n- RESIDENTIAL_NL: Netherlands\n- RESIDENTIAL_ISP: ISP proxy\n- US-CA: California (deprecated, routes through RESIDENTIAL_ISP)\n- US-NY: New York (deprecated, routes through RESIDENTIAL_ISP)\n- US-TX: Texas (deprecated, routes through RESIDENTIAL_ISP)\n- US-FL: Florida (deprecated, routes through RESIDENTIAL_ISP)\n- US-WA: Washington (deprecated, routes through RESIDENTIAL_ISP)\n- NONE: No proxy\n Can also be a GeoTarget object for granular city/state targeting: {\"country\": \"US\", \"subdivision\": \"CA\", \"city\": \"San Francisco\"}",
"default": "RESIDENTIAL"
},
"webhook_url": {
@@ -21298,6 +22659,11 @@
"title": "Disable Cache",
"default": false
},
+ "ignore_workflow_system_prompt": {
+ "type": "boolean",
+ "title": "Ignore Workflow System Prompt",
+ "default": false
+ },
"next_loop_on_failure": {
"type": "boolean",
"title": "Next Loop On Failure",
@@ -21449,6 +22815,11 @@
],
"title": "Model"
},
+ "ignore_workflow_system_prompt": {
+ "type": "boolean",
+ "title": "Ignore Workflow System Prompt",
+ "default": false
+ },
"next_loop_on_failure": {
"type": "boolean",
"title": "Next Loop On Failure",
@@ -21523,7 +22894,7 @@
"title": "CredentialType",
"description": "Type of credential stored in the system."
},
- "skyvern__schemas__run_blocks__CredentialType": {
+ "skyvern__schemas__credential_type__CredentialType": {
"type": "string",
"enum": [
"skyvern",
diff --git a/skyvern/forge/prompts/skyvern/workflow-copilot-request-policy.j2 b/skyvern/forge/prompts/skyvern/workflow-copilot-request-policy.j2
new file mode 100644
index 000000000..a396450d1
--- /dev/null
+++ b/skyvern/forge/prompts/skyvern/workflow-copilot-request-policy.j2
@@ -0,0 +1,10 @@
+Classify the latest Workflow Copilot request. Return only JSON with keys:
+testing_intent=require_test|skip_test|unspecified; credential_input_kind=none|raw_secret|credential_id|credential_name|website_stored_credential|placeholder; credential_refs; login_page_urls; requires_user_clarification.
+Use skip_test for untested draft / I'll test it myself / just sketch it / draft only. Use raw_secret for inline login credentials, especially passwords, plus API keys, tokens, bearer headers, cookies, TOTP/OTP codes, private keys, card numbers, or CVVs.
+Latest user message:
+```{{ user_message }}```
+Recent chat history:
+```{{ chat_history }}```
+Current workflow YAML:
+```{{ workflow_yaml }}```
+Global context: ```{{ global_llm_context }}```
diff --git a/skyvern/forge/prompts/skyvern/workflow-copilot-user.j2 b/skyvern/forge/prompts/skyvern/workflow-copilot-user.j2
index af1d3a2dd..b4b4fe131 100644
--- a/skyvern/forge/prompts/skyvern/workflow-copilot-user.j2
+++ b/skyvern/forge/prompts/skyvern/workflow-copilot-user.j2
@@ -42,6 +42,10 @@ Overall goal (long-term memory):
No previous context available.
{% endif %}
+{% if request_policy_summary is defined and request_policy_summary %}
+REQUEST POLICY: {{ request_policy_summary }}
+Follow this policy. If `allow_run_blocks` is false, do not call block-running tools. If `resolved_credentials` are present, use those `credential_id` values.
+{% endif %}
DEBUGGER RUN INFORMATION:
{% if debug_run_info %}
diff --git a/skyvern/forge/sdk/copilot/agent.py b/skyvern/forge/sdk/copilot/agent.py
index e4ccd93e2..ba004c48a 100644
--- a/skyvern/forge/sdk/copilot/agent.py
+++ b/skyvern/forge/sdk/copilot/agent.py
@@ -21,6 +21,7 @@ if TYPE_CHECKING:
import structlog
import yaml
+from litellm.exceptions import NotFoundError as LiteLLMNotFoundError
from pydantic import ValidationError
from skyvern.forge import app
@@ -33,6 +34,7 @@ from skyvern.forge.sdk.copilot.output_utils import (
looks_like_workflow_delivery_claim,
parse_final_response,
)
+from skyvern.forge.sdk.copilot.request_policy import RequestPolicy, build_request_policy, redact_raw_secrets_for_prompt
from skyvern.forge.sdk.copilot.tracing_setup import _copilot_model_name, ensure_tracing_initialized, is_tracing_enabled
from skyvern.forge.sdk.schemas.persistent_browser_sessions import is_final_status
from skyvern.forge.sdk.schemas.workflow_copilot import (
@@ -63,6 +65,13 @@ _UNTESTED_DRAFT_REQUEST_RE = re.compile(
re.IGNORECASE,
)
+
+def _resolve_request_policy_handler(fallback_handler: Any) -> Any:
+ with contextlib.suppress(RuntimeError, AttributeError):
+ return app.WORKFLOW_COPILOT_FAST_LLM_API_HANDLER or fallback_handler
+ return fallback_handler
+
+
_BLOCK_GOAL_CONTEXT_PREAMBLE = (
"Interpret the latest user message in the context of the prior conversation. If it is a correction, "
"refinement, or continuation, preserve the established website, actions, filters, and output requirements "
@@ -191,6 +200,7 @@ def _build_user_context(
global_llm_context: str,
debug_run_info_text: str,
user_message: str,
+ request_policy_summary: str = "",
) -> str:
"""Render untrusted context into the user message with code fencing.
@@ -202,14 +212,16 @@ def _build_user_context(
copilot path in ``workflow_copilot.py`` and ``feasibility_gate.py``
both apply the same guard.
"""
+ workflow_yaml = redact_raw_secrets_for_prompt(workflow_yaml or "")
return prompt_engine.load_prompt(
template="workflow-copilot-user",
- workflow_yaml=escape_code_fences(workflow_yaml or ""),
+ workflow_yaml=escape_code_fences(workflow_yaml),
workflow_summary=escape_code_fences(_build_workflow_summary(workflow_yaml)),
- chat_history=escape_code_fences(chat_history_text),
- global_llm_context=escape_code_fences(global_llm_context or ""),
- debug_run_info=escape_code_fences(debug_run_info_text),
- user_message=escape_code_fences(user_message),
+ chat_history=escape_code_fences(redact_raw_secrets_for_prompt(chat_history_text)),
+ global_llm_context=escape_code_fences(redact_raw_secrets_for_prompt(global_llm_context)),
+ debug_run_info=escape_code_fences(redact_raw_secrets_for_prompt(debug_run_info_text)),
+ request_policy_summary=escape_code_fences(redact_raw_secrets_for_prompt(request_policy_summary)),
+ user_message=escape_code_fences(redact_raw_secrets_for_prompt(user_message)),
)
@@ -898,6 +910,25 @@ def _fallback_llm_key(config: CopilotConfig, current_llm_key: str) -> str | None
return fallback_key
+def _build_request_policy_clarification_result(
+ policy: RequestPolicy,
+ prior_global_llm_context: str | None,
+ prior_workflow_yaml: str | None,
+) -> AgentResult:
+ structured = StructuredContext.from_json_str(prior_global_llm_context)
+ structured.decisions_made.append(f"request-policy clarification required: {policy.credential_input_kind}")
+ return AgentResult(
+ user_response=policy.clarification_question
+ or "I need one more detail before I can build and test this workflow safely.",
+ updated_workflow=None,
+ global_llm_context=structured.to_json_str(),
+ response_type="ASK_QUESTION",
+ workflow_yaml=prior_workflow_yaml or None,
+ workflow_was_persisted=False,
+ clear_proposed_workflow=True,
+ )
+
+
async def run_copilot_agent(
stream: EventSourceStream,
organization_id: str,
@@ -911,32 +942,52 @@ async def run_copilot_agent(
config: CopilotConfig | None = None,
) -> AgentResult:
copilot_config = config or CopilotConfig(security_rules=security_rules)
- allow_untested_workflow_draft = _user_requests_untested_workflow_draft(chat_request.message)
- credential_validation_result = await _credential_validation_result_for_user_message(
+ chat_history_text = _format_chat_history(chat_history)
+ safe_chat_history_text = redact_raw_secrets_for_prompt(chat_history_text)
+ safe_workflow_yaml = redact_raw_secrets_for_prompt(chat_request.workflow_yaml or "")
+ safe_global_llm_context = redact_raw_secrets_for_prompt(global_llm_context or "")
+ request_policy = await build_request_policy(
user_message=chat_request.message,
+ workflow_yaml=safe_workflow_yaml,
+ chat_history=safe_chat_history_text,
+ global_llm_context=safe_global_llm_context,
organization_id=organization_id,
- global_llm_context=global_llm_context,
- allow_untested_workflow_draft=allow_untested_workflow_draft,
+ handler=_resolve_request_policy_handler(llm_api_handler),
)
- if credential_validation_result is not None:
- return credential_validation_result
+ if request_policy.user_response_policy == "ask_clarification":
+ return _build_request_policy_clarification_result(
+ request_policy,
+ prior_global_llm_context=global_llm_context,
+ prior_workflow_yaml=chat_request.workflow_yaml,
+ )
+
+ allow_untested_workflow_draft = request_policy.testing_intent == "skip_test"
+ agent_user_message = chat_request.message
+ if allow_untested_workflow_draft and len(agent_user_message) < 160:
+ previous_user_messages = [msg.content for msg in chat_history if msg.sender == "user"]
+ if previous_user_messages:
+ agent_user_message = (
+ f"{agent_user_message}\n\nDraft the workflow requested earlier:\n"
+ f"{redact_raw_secrets_for_prompt(previous_user_messages[-1])}"
+ )
+ safe_chat_history_text = ""
# Preflight feasibility classifier — fires on every turn so mid-session pivots
# to impossible targets are caught the same as first-turn structural mismatches.
from skyvern.forge.sdk.copilot.feasibility_gate import run_feasibility_gate
feasibility_verdict = await run_feasibility_gate(
- user_message=chat_request.message,
- workflow_yaml=chat_request.workflow_yaml or "",
- chat_history=_format_chat_history(chat_history),
- global_llm_context=global_llm_context or "",
+ user_message=agent_user_message,
+ workflow_yaml=safe_workflow_yaml,
+ chat_history=safe_chat_history_text,
+ global_llm_context=safe_global_llm_context,
handler=llm_api_handler,
)
if feasibility_verdict.verdict == "ask_clarification" and feasibility_verdict.question:
return _build_feasibility_clarification_result(
question=feasibility_verdict.question,
rationale=feasibility_verdict.rationale,
- user_message=chat_request.message,
+ user_message=agent_user_message,
prior_global_llm_context=global_llm_context,
prior_workflow_yaml=chat_request.workflow_yaml,
)
@@ -980,7 +1031,6 @@ async def run_copilot_agent(
)
validated_browser_session_id = await _resolve_live_browser_session_id(chat_request, organization_id)
- chat_history_text = _format_chat_history(chat_history)
ctx = CopilotContext(
organization_id=organization_id,
@@ -990,12 +1040,13 @@ async def run_copilot_agent(
browser_session_id=validated_browser_session_id,
stream=stream,
api_key=api_key,
- user_message=chat_request.message,
+ user_message=agent_user_message,
allow_untested_workflow_draft=allow_untested_workflow_draft,
+ request_policy=request_policy,
block_goal_main_goal=_build_block_goal_main_goal(
- user_message=chat_request.message,
- chat_history_text=chat_history_text,
- global_llm_context=global_llm_context,
+ user_message=agent_user_message,
+ chat_history_text=safe_chat_history_text,
+ global_llm_context=safe_global_llm_context,
),
workflow_copilot_chat_id=chat_request.workflow_copilot_chat_id,
)
@@ -1020,11 +1071,12 @@ async def run_copilot_agent(
)
user_message = _build_user_context(
- workflow_yaml=chat_request.workflow_yaml or "",
- chat_history_text=chat_history_text,
- global_llm_context=global_llm_context or "",
- debug_run_info_text=debug_run_info_text,
- user_message=chat_request.message,
+ workflow_yaml=safe_workflow_yaml,
+ chat_history_text=safe_chat_history_text,
+ global_llm_context=safe_global_llm_context,
+ debug_run_info_text=redact_raw_secrets_for_prompt(debug_run_info_text),
+ user_message=agent_user_message,
+ request_policy_summary=request_policy.prompt_summary(),
)
LOG.info(
@@ -1044,6 +1096,7 @@ async def run_copilot_agent(
"organization_id": organization_id,
"llm_key": llm_key,
"user_message_len": str(len(user_message)),
+ **{f"request_policy_{key}": str(value) for key, value in request_policy.to_trace_data().items()},
},
)
@@ -1073,17 +1126,30 @@ async def run_copilot_agent(
try:
async with MCPServerManager([mcp_server]) as manager:
agent.mcp_servers = list(manager.active_servers)
- result = await run_with_enforcement(
- agent=agent,
- initial_input=user_message,
- ctx=ctx,
- stream=stream,
- max_turns=copilot_config.max_turns,
- hooks=CopilotRunHooks(ctx),
- run_config=attempt_run_config,
- session=session,
- copilot_config=copilot_config,
- )
+ attempts = 2 if ctx.allow_untested_workflow_draft else 1
+ for attempt in range(attempts):
+ try:
+ result = await run_with_enforcement(
+ agent=agent,
+ initial_input=user_message,
+ ctx=ctx,
+ stream=stream,
+ max_turns=copilot_config.max_turns,
+ hooks=CopilotRunHooks(ctx),
+ run_config=attempt_run_config,
+ session=session,
+ copilot_config=copilot_config,
+ )
+ break
+ except Exception as exc:
+ if (
+ attempt + 1 < attempts
+ and ctx.last_workflow is None
+ and isinstance(exc, LiteLLMNotFoundError)
+ ):
+ LOG.warning("Retrying untested draft agent loop after model lookup failure")
+ continue
+ raise
LOG.info(
"Copilot agent model attempt succeeded",
workflow_permanent_id=chat_request.workflow_permanent_id,
diff --git a/skyvern/forge/sdk/copilot/context.py b/skyvern/forge/sdk/copilot/context.py
index 7f77a18c8..5c3fb1be0 100644
--- a/skyvern/forge/sdk/copilot/context.py
+++ b/skyvern/forge/sdk/copilot/context.py
@@ -16,6 +16,7 @@ COPILOT_RESPONSE_TYPES: tuple[str, ...] = get_args(ResponseType)
if TYPE_CHECKING:
from skyvern.forge.sdk.copilot.narration import NarratorState
+ from skyvern.forge.sdk.copilot.request_policy import RequestPolicy
class UrlVisit(BaseModel):
@@ -165,6 +166,7 @@ class CopilotContext(AgentContext):
user_message: str = ""
block_goal_main_goal: str = ""
allow_untested_workflow_draft: bool = False
+ request_policy: RequestPolicy | None = None
# Tool tracking
consecutive_tool_tracker: list[str] = field(default_factory=list)
diff --git a/skyvern/forge/sdk/copilot/request_policy.py b/skyvern/forge/sdk/copilot/request_policy.py
new file mode 100644
index 000000000..85d3f45ed
--- /dev/null
+++ b/skyvern/forge/sdk/copilot/request_policy.py
@@ -0,0 +1,313 @@
+from __future__ import annotations
+
+import asyncio
+import re
+from dataclasses import dataclass, field
+from typing import Any
+from urllib.parse import urlparse
+
+import structlog
+
+from skyvern.config import settings
+from skyvern.forge import app
+from skyvern.forge.prompts import prompt_engine
+from skyvern.forge.sdk.copilot.output_utils import parse_final_response
+from skyvern.forge.sdk.copilot.tracing_setup import copilot_span
+from skyvern.forge.sdk.schemas.credentials import Credential
+from skyvern.utils.strings import escape_code_fences
+
+LOG = structlog.get_logger()
+PROMPT_NAME = "workflow-copilot-request-policy"
+_TESTING_INTENTS = {"require_test", "skip_test", "unspecified"}
+_KINDS = {"none", "raw_secret", "credential_id", "credential_name", "website_stored_credential", "placeholder"}
+_CREDENTIAL_ID_RE = re.compile(r"\bcred_[A-Za-z0-9][A-Za-z0-9_-]*\b")
+_RAW_SECRET_PATTERNS = (
+ re.compile(r"\b(?:password|passcode|api[_ -]?key|secret|token|bearer|authorization)\s*[:=]\s*\S+", re.I),
+ re.compile(r"\beyJ[A-Za-z0-9_-]{10,}\.[A-Za-z0-9_-]{10,}\.[A-Za-z0-9_-]{10,}\b"),
+ re.compile(r"\bsk-[A-Za-z0-9_-]{16,}\b"),
+ re.compile(r"-----BEGIN [A-Z ]*PRIVATE KEY-----"),
+)
+
+
+@dataclass
+class RequestPolicy:
+ testing_intent: str = "unspecified"
+ credential_input_kind: str = "none"
+ credential_refs: list[str] = field(default_factory=list)
+ login_page_urls: list[str] = field(default_factory=list)
+ requires_user_clarification: bool = False
+ allow_update_workflow: bool = True
+ allow_run_blocks: bool = True
+ allow_missing_credentials_in_draft: bool = False
+ user_response_policy: str = "proceed"
+ resolved_credentials: list[Credential] = field(default_factory=list)
+ invalid_credential_ids: list[str] = field(default_factory=list)
+ clarification_question: str | None = None
+ raw_secret_detected: bool = False
+
+ def to_trace_data(self) -> dict[str, Any]:
+ return {
+ "testing_intent": self.testing_intent,
+ "credential_input_kind": self.credential_input_kind,
+ "allow_update_workflow": self.allow_update_workflow,
+ "allow_run_blocks": self.allow_run_blocks,
+ "allow_missing_credentials_in_draft": self.allow_missing_credentials_in_draft,
+ "resolved_credential_count": len(self.resolved_credentials),
+ "raw_secret_detected": self.raw_secret_detected,
+ }
+
+ def prompt_summary(self) -> str:
+ lines = [
+ f"testing_intent: {self.testing_intent}",
+ f"credential_input_kind: {self.credential_input_kind}",
+ f"allow_update_workflow: {self.allow_update_workflow}",
+ f"allow_run_blocks: {self.allow_run_blocks}",
+ f"allow_missing_credentials_in_draft: {self.allow_missing_credentials_in_draft}",
+ ]
+ if self.resolved_credentials:
+ lines += [
+ "resolved_credentials:",
+ *[f"- {_safe_label(credential)}" for credential in self.resolved_credentials],
+ ]
+ if self.invalid_credential_ids:
+ lines.append("invalid_credential_ids: " + ", ".join(f"`{cid}`" for cid in self.invalid_credential_ids))
+ return "\n".join(lines)
+
+
+def _clean_list(values: list[Any]) -> list[str]:
+ return list(dict.fromkeys(str(value).strip() for value in values if str(value).strip()))
+
+
+def _credential_ids(text: str) -> list[str]:
+ return list(dict.fromkeys(_CREDENTIAL_ID_RE.findall(text or "")))
+
+
+def _raw_secret_detected(text: str) -> bool:
+ return any(pattern.search(text or "") for pattern in _RAW_SECRET_PATTERNS)
+
+
+def redact_raw_secrets_for_prompt(text: str) -> str:
+ redacted = text or ""
+ for pattern in _RAW_SECRET_PATTERNS:
+ redacted = pattern.sub("[REDACTED_SECRET]", redacted)
+ return redacted
+
+
+def _classification_from_raw(raw: Any) -> RequestPolicy:
+ if isinstance(raw, str):
+ raw = parse_final_response(raw)
+ if not isinstance(raw, dict):
+ return RequestPolicy()
+ testing_intent = raw.get("testing_intent")
+ credential_input_kind = raw.get("credential_input_kind")
+ policy = RequestPolicy(
+ testing_intent=testing_intent if testing_intent in _TESTING_INTENTS else "unspecified",
+ credential_input_kind=credential_input_kind if credential_input_kind in _KINDS else "none",
+ credential_refs=_clean_list(raw.get("credential_refs") or []),
+ login_page_urls=_clean_list(raw.get("login_page_urls") or []),
+ requires_user_clarification=bool(raw.get("requires_user_clarification")),
+ )
+ return policy
+
+
+async def _classify_request(
+ user_message: str, workflow_yaml: str, chat_history: str, global_llm_context: str, handler: Any
+) -> RequestPolicy:
+ ids = _credential_ids(user_message)
+ if _raw_secret_detected(user_message):
+ return RequestPolicy(credential_input_kind="raw_secret", credential_refs=ids, raw_secret_detected=True)
+ if handler is None:
+ return RequestPolicy(credential_input_kind="credential_id" if ids else "none", credential_refs=ids)
+
+ prompt = prompt_engine.load_prompt(
+ template=PROMPT_NAME,
+ user_message=escape_code_fences(user_message),
+ workflow_yaml=escape_code_fences(redact_raw_secrets_for_prompt(workflow_yaml)[:2048]),
+ chat_history=escape_code_fences(redact_raw_secrets_for_prompt(chat_history)[:2048]),
+ global_llm_context=escape_code_fences(redact_raw_secrets_for_prompt(global_llm_context)[:2048]),
+ )
+ try:
+ raw = await asyncio.wait_for(
+ handler(prompt=prompt, prompt_name=PROMPT_NAME),
+ timeout=settings.COPILOT_FEASIBILITY_GATE_TIMEOUT_SECONDS,
+ )
+ except asyncio.TimeoutError:
+ LOG.warning("request-policy classifier timed out")
+ return RequestPolicy(credential_input_kind="credential_id" if ids else "none", credential_refs=ids)
+ except Exception as exc:
+ LOG.warning("request-policy classifier failed", error=str(exc))
+ return RequestPolicy(credential_input_kind="credential_id" if ids else "none", credential_refs=ids)
+
+ policy = _classification_from_raw(raw)
+ policy.credential_refs = _clean_list(policy.credential_refs + ids)
+ if ids and policy.credential_input_kind in ("none", "placeholder"):
+ policy.credential_input_kind = "credential_id"
+ return policy
+
+
+async def _load_credentials(organization_id: str) -> list[Credential]:
+ page = 1
+ credentials: list[Credential] = []
+ while True:
+ items = await app.DATABASE.credentials.get_credentials(organization_id=organization_id, page=page, page_size=50)
+ credentials.extend(items)
+ if len(items) < 50:
+ return sorted(credentials, key=lambda c: getattr(c, "created_at", None) or "", reverse=True)
+ page += 1
+
+
+def _safe_label(credential: Credential) -> str:
+ parts = [f"`{credential.credential_id}`", credential.name]
+ parts += [f"Login Page URL: {credential.tested_url}"] if credential.tested_url else []
+ return " - ".join(parts)
+
+
+def _block(policy: RequestPolicy, question: str, candidates: list[Credential] | None = None) -> None:
+ policy.requires_user_clarification = True
+ policy.user_response_policy = "ask_clarification"
+ policy.allow_update_workflow = policy.allow_run_blocks = False
+ if candidates:
+ question += "\n\nSafe matches:\n" + "\n".join(f"- {_safe_label(candidate)}" for candidate in candidates)
+ policy.clarification_question = question
+
+
+def _url_parts(url: str) -> tuple[str, str] | None:
+ parsed = urlparse(url if "://" in url else f"https://{url}")
+ if not parsed.netloc:
+ return None
+ host = parsed.netloc.lower()
+ path = parsed.path.rstrip("/")
+ return f"{parsed.scheme.lower()}://{host}{path}", f"{parsed.scheme.lower()}://{host}"
+
+
+def _match_by_url(credentials: list[Credential], urls: list[str]) -> list[Credential]:
+ indexed = [
+ (credential, parts)
+ for credential in credentials
+ if credential.tested_url and (parts := _url_parts(credential.tested_url))
+ ]
+ requested = [parts for url in urls if (parts := _url_parts(url))]
+ for index in range(2):
+ matches = [
+ credential for credential, parts in indexed if any(parts[index] == target[index] for target in requested)
+ ]
+ if matches:
+ return matches
+ return []
+
+
+def _clarification_question(policy: RequestPolicy) -> str:
+ if policy.credential_input_kind == "credential_name":
+ return "Which saved credential name should I use? Please provide the exact credential name or a credential ID beginning with cred_."
+ if policy.credential_input_kind == "website_stored_credential":
+ return "Which website or login page should I use to look up stored credentials?"
+ return "I need one more detail before I can build and test this workflow safely."
+
+
+async def _resolve_credentials(policy: RequestPolicy, organization_id: str) -> None:
+ if policy.credential_input_kind == "credential_id":
+ ids = _clean_list([ref for ref in policy.credential_refs if ref.startswith("cred_")])
+ if not ids:
+ return
+ existing = await app.DATABASE.credentials.get_credentials_by_ids(ids, organization_id=organization_id)
+ found = {credential.credential_id for credential in existing}
+ policy.resolved_credentials = existing
+ policy.invalid_credential_ids = [credential_id for credential_id in ids if credential_id not in found]
+ if policy.invalid_credential_ids and policy.testing_intent != "skip_test":
+ formatted = ", ".join(f"`{credential_id}`" for credential_id in policy.invalid_credential_ids)
+ _block(
+ policy,
+ f"The credential ID(s) {formatted} were not found in this organization. Please provide a valid saved credential ID or explicitly ask for an unvalidated draft that will not be run yet.",
+ )
+ elif policy.invalid_credential_ids:
+ policy.allow_run_blocks = False
+ policy.allow_missing_credentials_in_draft = True
+ return
+
+ if policy.credential_input_kind == "credential_name" and not policy.credential_refs:
+ _block(
+ policy,
+ "Which saved credential name should I use? Please provide the exact credential name or a credential ID beginning with cred_.",
+ )
+ return
+ if policy.credential_input_kind == "website_stored_credential" and not policy.login_page_urls:
+ _block(policy, "Which website or login page should I use to look up stored credentials?")
+ return
+ if policy.credential_input_kind not in ("credential_name", "website_stored_credential"):
+ return
+
+ credentials = await _load_credentials(organization_id)
+ if policy.credential_input_kind == "credential_name":
+ for ref in policy.credential_refs:
+ matches = [credential for credential in credentials if credential.name == ref]
+ if len(matches) == 1:
+ policy.resolved_credentials.append(matches[0])
+ elif matches:
+ _block(
+ policy, "I found multiple stored credentials with that exact name. Which one should I use?", matches
+ )
+ return
+ elif policy.testing_intent == "skip_test":
+ policy.allow_run_blocks, policy.allow_missing_credentials_in_draft = False, True
+ else:
+ _block(
+ policy,
+ f"I could not find a stored credential named `{ref}`. Please choose an existing credential by exact name or a credential ID beginning with cred_.",
+ )
+ return
+ return
+
+ matches = _match_by_url(credentials, policy.login_page_urls)
+ if len(matches) == 1:
+ policy.resolved_credentials = matches
+ elif matches:
+ _block(policy, "I found multiple stored credentials for that login page. Which one should I use?", matches)
+ else:
+ _block(
+ policy,
+ "I could not find a stored credential for that login page. Please select a saved credential by exact name or a credential ID beginning with cred_, or create one in the Credentials UI.",
+ )
+
+
+async def build_request_policy(
+ *,
+ user_message: str,
+ workflow_yaml: str,
+ chat_history: str,
+ global_llm_context: str,
+ organization_id: str,
+ handler: Any,
+) -> RequestPolicy:
+ policy = await _classify_request(user_message, workflow_yaml, chat_history, global_llm_context, handler)
+ policy.raw_secret_detected = policy.raw_secret_detected or policy.credential_input_kind == "raw_secret"
+ if policy.testing_intent == "skip_test":
+ policy.allow_run_blocks = False
+ policy.allow_missing_credentials_in_draft = True
+ if policy.credential_input_kind != "raw_secret":
+ policy.requires_user_clarification = False
+
+ if policy.raw_secret_detected:
+ _block(
+ policy,
+ "Please do not paste raw login credentials or secrets in chat because they can enter model telemetry and execution traces. Store the credential in the Skyvern Credentials UI and reply with its exact saved credential name or a credential ID beginning with cred_. DO NOT PROVIDE RAW LOGIN/PASSWORD.",
+ )
+ elif policy.requires_user_clarification:
+ _block(policy, _clarification_question(policy))
+ else:
+ try:
+ await _resolve_credentials(policy, organization_id)
+ except Exception:
+ LOG.warning(
+ "request-policy credential resolution failed",
+ organization_id=organization_id,
+ credential_input_kind=policy.credential_input_kind,
+ exc_info=True,
+ )
+ _block(
+ policy,
+ "I could not verify the requested credential metadata for this organization. Please provide a valid saved credential by exact name or a credential ID beginning with cred_.",
+ )
+
+ with copilot_span("request_policy", data=policy.to_trace_data()):
+ LOG.info("request-policy decision", **policy.to_trace_data())
+ return policy
diff --git a/skyvern/forge/sdk/copilot/runtime.py b/skyvern/forge/sdk/copilot/runtime.py
index d5d7c2d03..0f502f26f 100644
--- a/skyvern/forge/sdk/copilot/runtime.py
+++ b/skyvern/forge/sdk/copilot/runtime.py
@@ -30,6 +30,7 @@ from skyvern.forge.sdk.core import skyvern_context
from skyvern.library.skyvern_browser import SkyvernBrowser
if TYPE_CHECKING:
+ from skyvern.forge.sdk.copilot.request_policy import RequestPolicy
from skyvern.forge.sdk.routes.event_source_stream import EventSourceStream
LOG = structlog.get_logger()
@@ -95,6 +96,7 @@ class AgentContext:
last_workflow: Any | None = None
last_workflow_yaml: str | None = None
allow_untested_workflow_draft: bool = False
+ request_policy: RequestPolicy | None = None
effective_workflow_proxy_location: Any | None = None
copilot_run_start_monotonic: float | None = None
diff --git a/skyvern/forge/sdk/copilot/tools.py b/skyvern/forge/sdk/copilot/tools.py
index b97b0239e..8f121de70 100644
--- a/skyvern/forge/sdk/copilot/tools.py
+++ b/skyvern/forge/sdk/copilot/tools.py
@@ -49,6 +49,7 @@ from skyvern.forge.sdk.copilot.output_utils import (
sanitize_tool_result_for_llm,
truncate_output,
)
+from skyvern.forge.sdk.copilot.request_policy import RequestPolicy
from skyvern.forge.sdk.copilot.runtime import AgentContext, ensure_browser_session
from skyvern.forge.sdk.copilot.screenshot_utils import enqueue_screenshot_from_result
from skyvern.forge.sdk.copilot.tracing_setup import copilot_span
@@ -742,6 +743,25 @@ def _tool_loop_error(ctx: AgentContext, tool_name: str, arguments: dict[str, Any
return None
+def _request_policy_tool_error(ctx: AgentContext, tool_name: str) -> str | None:
+ policy = getattr(ctx, "request_policy", None)
+ if not isinstance(policy, RequestPolicy):
+ return None
+ if tool_name == "update_workflow" and not policy.allow_update_workflow:
+ return (
+ "Request policy blocks workflow updates for the latest user message. "
+ "Ask the user for safe stored credential metadata instead."
+ )
+ if tool_name in BLOCK_RUNNING_TOOLS and not policy.allow_run_blocks:
+ if policy.testing_intent == "skip_test":
+ return "Request policy says the latest user message asked for an untested draft. Use update_workflow only."
+ return (
+ "Request policy blocks block-running tools for the latest user message. "
+ "Ask the user for the required safe credential or clarification before testing."
+ )
+ return None
+
+
_PARAMETER_TYPE_PLACEHOLDERS: dict[WorkflowParameterType, Any] = {
WorkflowParameterType.STRING: "",
WorkflowParameterType.INTEGER: 0,
@@ -823,6 +843,10 @@ async def _update_workflow(
*,
allow_missing_credentials: bool | None = None,
) -> dict[str, Any]:
+ policy_error = _request_policy_tool_error(ctx, "update_workflow")
+ if policy_error is not None:
+ return {"ok": False, "error": policy_error}
+
workflow_yaml = params["workflow_yaml"]
if allow_missing_credentials is None:
allow_missing_credentials = getattr(ctx, "allow_untested_workflow_draft", False) is True
@@ -3669,6 +3693,10 @@ async def run_blocks_tool(
"""
copilot_ctx = ctx.context
arguments = {"block_labels": block_labels, "parameters": parameters or {}}
+ policy_error = _request_policy_tool_error(copilot_ctx, "run_blocks_and_collect_debug")
+ if policy_error:
+ return json.dumps({"ok": False, "error": policy_error})
+
loop_error = _tool_loop_error(copilot_ctx, "run_blocks_and_collect_debug", arguments)
if loop_error:
return json.dumps({"ok": False, "error": loop_error})
@@ -3779,6 +3807,10 @@ async def update_and_run_blocks_tool(
"""
copilot_ctx = ctx.context
arguments = {"workflow_yaml": workflow_yaml, "block_labels": block_labels, "parameters": parameters or {}}
+ policy_error = _request_policy_tool_error(copilot_ctx, "update_and_run_blocks")
+ if policy_error:
+ return json.dumps({"ok": False, "error": policy_error})
+
loop_error = _tool_loop_error(copilot_ctx, "update_and_run_blocks", arguments)
if loop_error:
return json.dumps({"ok": False, "error": loop_error})
diff --git a/tests/unit/test_copilot_agent_helpers.py b/tests/unit/test_copilot_agent_helpers.py
index f94ab7655..5a752507b 100644
--- a/tests/unit/test_copilot_agent_helpers.py
+++ b/tests/unit/test_copilot_agent_helpers.py
@@ -969,6 +969,39 @@ class TestUserSuppliedCredentialIdValidation:
assert result is None
get_credentials_by_ids.assert_awaited_once_with(["cred_valid"], organization_id="org-1")
+ @pytest.mark.asyncio
+ async def test_request_policy_url_matching_and_skip_draft(self, monkeypatch) -> None:
+ from skyvern.forge.sdk.copilot import request_policy as policy_module
+ from skyvern.forge.sdk.copilot.request_policy import build_request_policy
+
+ credential = SimpleNamespace(credential_id="cred_bank", name="Bank", tested_url="https://bank.co.uk/login")
+ credentials = SimpleNamespace(get_credentials=AsyncMock(return_value=[credential]))
+ monkeypatch.setattr(policy_module.app, "DATABASE", SimpleNamespace(credentials=credentials))
+
+ async def handler(**kwargs):
+ return handler.response
+
+ args = dict(workflow_yaml="", global_llm_context="", organization_id="org-1", handler=handler)
+ handler.response = {
+ "credential_input_kind": "website_stored_credential",
+ "login_page_urls": ["https://evil.co.uk/login"],
+ }
+ url_policy = await build_request_policy(user_message="use the saved login", chat_history="", **args)
+ assert url_policy.user_response_policy == "ask_clarification" and not url_policy.resolved_credentials
+
+ handler.response = {
+ "testing_intent": "skip_test",
+ "credential_input_kind": "credential_name",
+ "credential_refs": ["azure_credentials"],
+ "requires_user_clarification": True,
+ }
+ skip_policy = await build_request_policy(
+ user_message="just draft without testing", chat_history="user: use azure_credentials", **args
+ )
+ assert skip_policy.user_response_policy == "proceed"
+ assert skip_policy.allow_update_workflow and not skip_policy.allow_run_blocks
+ assert skip_policy.allow_missing_credentials_in_draft
+
def test_translate_untested_draft_request_surfaces_unvalidated_workflow(self) -> None:
wf = SimpleNamespace(name="drafted")
ctx = _ctx(