Skip to content

Automate browser based workflows with AI

show input value before the value is interpretated into a real secret (#3364)

Shuchang Zheng916e4699d064
diff --git a/skyvern/config.py b/skyvern/config.py
index 8ab1fdf0d..d826bda59 100644
--- a/skyvern/config.py
+++ b/skyvern/config.py
@@ -304,7 +304,7 @@ class Settings(BaseSettings):
SVG_MAX_LENGTH: int = 100000
ENABLE_LOG_ARTIFACTS: bool = False
- ENABLE_CODE_BLOCK: bool = True
+ ENABLE_CODE_BLOCK: bool = False
TASK_BLOCKED_SITE_FALLBACK_URL: str = "https://www.google.com"
diff --git a/skyvern/core/script_generations/skyvern_page.py b/skyvern/core/script_generations/skyvern_page.py
index 53ac05d3d..2f9fc4ed4 100644
--- a/skyvern/core/script_generations/skyvern_page.py
+++ b/skyvern/core/script_generations/skyvern_page.py
@@ -168,6 +168,7 @@ class SkyvernPage:
status=action_status,
data=data,
kwargs=kwargs,
+ call_result=call.result,
)
# Auto-create screenshot artifact after execution
@@ -190,6 +191,7 @@ class SkyvernPage:
status: ActionStatus = ActionStatus.pending,
data: str | dict[str, Any] = "",
kwargs: dict[str, Any] | None = None,
+ call_result: Any | None = None,
) -> Action | None:
"""Create an action record in the database before execution if task_id and step_id are available."""
try:
@@ -206,6 +208,7 @@ class SkyvernPage:
response: str | None = kwargs.get("response")
if not response:
if action_type == ActionType.INPUT_TEXT:
+ text = str(call_result)
response = text
elif action_type == ActionType.SELECT_OPTION:
if select_option:
@@ -343,8 +346,8 @@ class SkyvernPage:
intention: str | None = None,
data: str | dict[str, Any] | None = None,
timeout: float = settings.BROWSER_ACTION_TIMEOUT_MS,
- ) -> None:
- await self._input_text(xpath, value, ai_infer, intention, data, timeout)
+ ) -> str:
+ return await self._input_text(xpath, value, ai_infer, intention, data, timeout)
@action_wrap(ActionType.INPUT_TEXT)
async def type(
@@ -355,8 +358,8 @@ class SkyvernPage:
intention: str | None = None,
data: str | dict[str, Any] | None = None,
timeout: float = settings.BROWSER_ACTION_TIMEOUT_MS,
- ) -> None:
- await self._input_text(xpath, value, ai_infer, intention, data, timeout)
+ ) -> str:
+ return await self._input_text(xpath, value, ai_infer, intention, data, timeout)
async def _input_text(
self,
@@ -366,7 +369,7 @@ class SkyvernPage:
intention: str | None = None,
data: str | dict[str, Any] | None = None,
timeout: float = settings.BROWSER_ACTION_TIMEOUT_MS,
- ) -> None:
+ ) -> str:
"""Input text into an element identified by ``xpath``.
When ``intention`` and ``data`` are provided a new input text action is
@@ -380,6 +383,7 @@ class SkyvernPage:
# format the text with the actual value of the parameter if it's a secret when running a workflow
context = skyvern_context.current()
value = value or ""
+ transformed_value = value
if ai_infer and intention:
try:
prompt = context.prompt if context else None
@@ -402,10 +406,11 @@ class SkyvernPage:
LOG.exception(f"Failed to adapt value for input text action on xpath={xpath}, value={value}")
if context and context.workflow_run_id:
- value = await _get_actual_value_of_parameter_if_secret(context.workflow_run_id, value)
+ transformed_value = await _get_actual_value_of_parameter_if_secret(context.workflow_run_id, value)
locator = self.page.locator(f"xpath={xpath}")
- await handler_utils.input_sequentially(locator, value, timeout=timeout)
+ await handler_utils.input_sequentially(locator, transformed_value, timeout=timeout)
+ return value
@action_wrap(ActionType.UPLOAD_FILE)
async def upload_file(