Skip to content

Automate browser based workflows with AI

chore: replace script_mode print() with LOG.debug to cut log volume (SKY-9945) (#6030)

LawyZhengaf842b8667c3
diff --git a/skyvern/core/script_generations/real_skyvern_page_ai.py b/skyvern/core/script_generations/real_skyvern_page_ai.py
index 3abb13fb1..ac143212f 100644
--- a/skyvern/core/script_generations/real_skyvern_page_ai.py
+++ b/skyvern/core/script_generations/real_skyvern_page_ai.py
@@ -1271,17 +1271,7 @@ class RealSkyvernPageAi(SkyvernPageAi):
LOG.warning("ai_extract cache store failed; ignoring", exc_info=True)
if context and context.script_mode:
- print(f"\n✨ πŸ“Š Extracted Information:\n{'-' * 50}")
-
- try:
- # Pretty print JSON if result is a dict/list
- if isinstance(result, (dict, list)):
- print(json.dumps(result, indent=2, ensure_ascii=False))
- else:
- print(result)
- except Exception:
- print(result)
- print(f"{'-' * 50}\n")
+ LOG.debug("Extracted information", result=result)
return result
async def ai_validate(
diff --git a/skyvern/core/script_generations/script_skyvern_page.py b/skyvern/core/script_generations/script_skyvern_page.py
index a2d4c8059..18c4d8202 100644
--- a/skyvern/core/script_generations/script_skyvern_page.py
+++ b/skyvern/core/script_generations/script_skyvern_page.py
@@ -180,22 +180,6 @@ class ScriptSkyvernPage(SkyvernPage):
and screenshot artifacts after action execution.
"""
- # Emoji mapping for different action types
- ACTION_EMOJIS = {
- ActionType.CLICK: "πŸ‘†",
- ActionType.INPUT_TEXT: "⌨️",
- ActionType.UPLOAD_FILE: "πŸ“€",
- ActionType.DOWNLOAD_FILE: "πŸ“₯",
- ActionType.HOVER: "πŸ–±οΈ",
- ActionType.SELECT_OPTION: "🎯",
- ActionType.WAIT: "⏳",
- ActionType.SOLVE_CAPTCHA: "πŸ”“",
- ActionType.VERIFICATION_CODE: "πŸ”",
- ActionType.SCROLL: "πŸ“œ",
- ActionType.COMPLETE: "βœ…",
- ActionType.TERMINATE: "πŸ›‘",
- }
-
prompt = kwargs.get("prompt", "")
# Backward compatibility: use intention if provided and prompt is empty
@@ -209,16 +193,10 @@ class ScriptSkyvernPage(SkyvernPage):
action_status = ActionStatus.completed
- # Print action in script mode
context = skyvern_context.current()
if context and context.script_mode:
- emoji = ACTION_EMOJIS.get(action, "πŸ”§")
action_name = action.value if hasattr(action, "value") else str(action)
- print(f"{emoji} {action_name.replace('_', ' ').title()}", end="")
- if prompt:
- print(f": {prompt}")
- else:
- print()
+ LOG.debug("Script action", action=action_name, prompt=prompt)
# Download detection for click actions
download_triggered: bool | None = None
@@ -256,9 +234,8 @@ class ScriptSkyvernPage(SkyvernPage):
# Note: Action status would be updated to completed here if update method existed
- # Print success in script mode
if context and context.script_mode:
- print(" βœ“ Completed")
+ LOG.debug("Action completed")
return call.result
except Exception as e:
@@ -966,7 +943,7 @@ class ScriptSkyvernPage(SkyvernPage):
context = skyvern_context.current()
is_script_mode = context and context.script_mode
if is_script_mode:
- print(f"🌐 Navigating to: {url}")
+ LOG.debug("Navigating to URL", url=url)
timeout = kwargs.pop("timeout", settings.BROWSER_LOADING_TIMEOUT_MS)
max_retries = kwargs.pop("max_retries", NAVIGATION_MAX_RETRY_TIME)
@@ -977,7 +954,7 @@ class ScriptSkyvernPage(SkyvernPage):
try:
await self.page.goto(url, timeout=timeout, **kwargs)
if is_script_mode:
- print(" βœ“ Page loaded")
+ LOG.debug("Page loaded")
return
except Exception as e:
last_error = e
@@ -1037,7 +1014,7 @@ class ScriptSkyvernPage(SkyvernPage):
return
if context.skip_complete_verification:
if context.script_mode:
- print(" ⏭ Skipping complete() verification (--no-verify)")
+ LOG.debug("Skipping complete() verification (--no-verify)")
return
# In script mode, add a settle delay before verification. Scripts execute