Skip to content

Automate browser based workflows with AI

add disable_cache to block (#3713)

Shuchang Zhengd4aa212f20a1
diff --git a/skyvern/forge/sdk/workflow/models/block.py b/skyvern/forge/sdk/workflow/models/block.py
index a17900ca1..57eb460ad 100644
--- a/skyvern/forge/sdk/workflow/models/block.py
+++ b/skyvern/forge/sdk/workflow/models/block.py
@@ -432,6 +432,7 @@ class BaseTaskBlock(Block):
totp_verification_url: str | None = None
totp_identifier: str | None = None
cache_actions: bool = False
+ disable_cache: bool = False
complete_verification: bool = True
include_action_history_in_verification: bool = False
download_timeout: float | None = None # minutes
diff --git a/skyvern/forge/sdk/workflow/service.py b/skyvern/forge/sdk/workflow/service.py
index f62ebce09..5f06bf373 100644
--- a/skyvern/forge/sdk/workflow/service.py
+++ b/skyvern/forge/sdk/workflow/service.py
@@ -644,7 +644,7 @@ class WorkflowService:
# Try executing with script code if available
block_executed_with_code = False
- valid_to_run_code = block.label and block.label in script_blocks_by_label
+ valid_to_run_code = block.label and block.label in script_blocks_by_label and not block.disable_cache
if valid_to_run_code:
script_block = script_blocks_by_label[block.label]
LOG.info(
@@ -2517,6 +2517,7 @@ class WorkflowService:
totp_verification_url=block_yaml.totp_verification_url,
totp_identifier=block_yaml.totp_identifier,
cache_actions=block_yaml.cache_actions,
+ disable_cache=block_yaml.disable_cache,
complete_criterion=block_yaml.complete_criterion,
terminate_criterion=block_yaml.terminate_criterion,
complete_verification=block_yaml.complete_verification,
@@ -2695,6 +2696,7 @@ class WorkflowService:
totp_verification_url=block_yaml.totp_verification_url,
totp_identifier=block_yaml.totp_identifier,
cache_actions=block_yaml.cache_actions,
+ disable_cache=block_yaml.disable_cache,
# DO NOT run complete verification for action block
complete_verification=False,
max_steps_per_run=1,
@@ -2724,6 +2726,7 @@ class WorkflowService:
totp_verification_url=block_yaml.totp_verification_url,
totp_identifier=block_yaml.totp_identifier,
cache_actions=block_yaml.cache_actions,
+ disable_cache=block_yaml.disable_cache,
complete_criterion=block_yaml.complete_criterion,
terminate_criterion=block_yaml.terminate_criterion,
complete_verification=block_yaml.complete_verification,
@@ -2750,6 +2753,7 @@ class WorkflowService:
model=block_yaml.model,
continue_on_failure=block_yaml.continue_on_failure,
cache_actions=block_yaml.cache_actions,
+ disable_cache=block_yaml.disable_cache,
complete_verification=False,
)
@@ -2775,6 +2779,7 @@ class WorkflowService:
totp_verification_url=block_yaml.totp_verification_url,
totp_identifier=block_yaml.totp_identifier,
cache_actions=block_yaml.cache_actions,
+ disable_cache=block_yaml.disable_cache,
complete_criterion=block_yaml.complete_criterion,
terminate_criterion=block_yaml.terminate_criterion,
complete_verification=block_yaml.complete_verification,
@@ -2814,6 +2819,7 @@ class WorkflowService:
totp_verification_url=block_yaml.totp_verification_url,
totp_identifier=block_yaml.totp_identifier,
cache_actions=block_yaml.cache_actions,
+ disable_cache=block_yaml.disable_cache,
complete_on_download=True,
complete_verification=True,
download_timeout=block_yaml.download_timeout,
diff --git a/skyvern/schemas/workflows.py b/skyvern/schemas/workflows.py
index 1c6b0a566..be0673506 100644
--- a/skyvern/schemas/workflows.py
+++ b/skyvern/schemas/workflows.py
@@ -223,6 +223,7 @@ class TaskBlockYAML(BlockYAML):
totp_verification_url: str | None = None
totp_identifier: str | None = None
cache_actions: bool = False
+ disable_cache: bool = False
complete_criterion: str | None = None
terminate_criterion: str | None = None
complete_verification: bool = True
@@ -359,6 +360,7 @@ class ActionBlockYAML(BlockYAML):
totp_verification_url: str | None = None
totp_identifier: str | None = None
cache_actions: bool = False
+ disable_cache: bool = False
class NavigationBlockYAML(BlockYAML):
@@ -379,6 +381,7 @@ class NavigationBlockYAML(BlockYAML):
totp_verification_url: str | None = None
totp_identifier: str | None = None
cache_actions: bool = False
+ disable_cache: bool = False
complete_criterion: str | None = None
terminate_criterion: str | None = None
complete_verification: bool = True
@@ -397,6 +400,7 @@ class ExtractionBlockYAML(BlockYAML):
max_steps_per_run: int | None = None
parameter_keys: list[str] | None = None
cache_actions: bool = False
+ disable_cache: bool = False
class LoginBlockYAML(BlockYAML):
@@ -413,6 +417,7 @@ class LoginBlockYAML(BlockYAML):
totp_verification_url: str | None = None
totp_identifier: str | None = None
cache_actions: bool = False
+ disable_cache: bool = False
complete_criterion: str | None = None
terminate_criterion: str | None = None
complete_verification: bool = True
@@ -440,6 +445,7 @@ class FileDownloadBlockYAML(BlockYAML):
totp_verification_url: str | None = None
totp_identifier: str | None = None
cache_actions: bool = False
+ disable_cache: bool = False
download_timeout: float | None = None