Automate browser based workflows with AI
Python aiapiautomationbrowserbrowser-automationcomputergptllmplaywrightpowerautomatepuppeteerpythonrpaseleniumvisionworkflow
Improve quickstart cli (#4205)
Stanislav Novosad92280d58905a
diff --git a/skyvern/cli/commands.py b/skyvern/cli/commands.pyindex 2387f2d13..c06fbf244 100644--- a/skyvern/cli/commands.py+++ b/skyvern/cli/commands.py@@ -4,7 +4,7 @@ from dotenv import load_dotenvfrom skyvern.utils.env_paths import resolve_backend_env_pathfrom .docs import docs_app-from .init_command import init, init_browser+from .init_command import init_browser, init_envfrom .quickstart import quickstart_appfrom .run_commands import run_appfrom .status import status_app@@ -46,7 +46,7 @@ def init_callback() -> None:"""Run full initialization when no subcommand is provided."""if ctx.invoked_subcommand is None:- init(no_postgres=no_postgres)+ init_env(no_postgres=no_postgres)@init_app.command(name="browser")diff --git a/skyvern/cli/init_command.py b/skyvern/cli/init_command.pyindex 888a312e6..9284bbecb 100644--- a/skyvern/cli/init_command.py+++ b/skyvern/cli/init_command.py@@ -19,9 +19,9 @@ from .llm_setup import setup_llm_providers, update_or_add_env_varfrom .mcp import setup_local_organization, setup_mcp-def init(+def init_env(no_postgres: bool = typer.Option(False, "--no-postgres", help="Skip starting PostgreSQL container"),-) -> None:+) -> bool:"""Interactive initialization command for Skyvern."""console.print(Panel(@@ -104,7 +104,7 @@ def init(api_key = Prompt.ask("Please re-enter your Skyvern API key", password=True)if not api_key:console.print("[bold red]Error: API key cannot be empty. Aborting initialization.[/bold red]")- return+ return Falseupdate_or_add_env_var("SKYVERN_BASE_URL", base_url)analytics_id_input = Prompt.ask("Please enter your email for analytics (press enter to skip)", default="")@@ -134,6 +134,8 @@ def init(console.print("[bold]To start using Skyvern, run:[/bold]")console.print(Padding("skyvern run server", (1, 4), style="reverse green"))+ return run_local+def init_browser() -> None:"""Initialize only the browser configuration and install Chromium."""diff --git a/skyvern/cli/llm_setup.py b/skyvern/cli/llm_setup.pyindex 4220b2a36..4a0f79edb 100644--- a/skyvern/cli/llm_setup.py+++ b/skyvern/cli/llm_setup.py@@ -1,3 +1,5 @@+import os+from dotenv import load_dotenv, set_keyfrom rich.panel import Panelfrom rich.prompt import Confirm, Prompt@@ -51,6 +53,7 @@ def update_or_add_env_var(key: str, value: str) -> None:load_dotenv(env_path)set_key(env_path, key, value)+ os.environ[key] = valuedef setup_llm_providers() -> None:diff --git a/skyvern/cli/quickstart.py b/skyvern/cli/quickstart.pyindex e026cba21..4e4ae1920 100644--- a/skyvern/cli/quickstart.py+++ b/skyvern/cli/quickstart.py@@ -9,7 +9,7 @@ from rich.progress import Progress, SpinnerColumn, TextColumn# Import console after skyvern.cli to ensure proper initializationfrom skyvern.cli.console import console-from skyvern.cli.init_command import init # init is used directly+from skyvern.cli.init_command import init_env # init is used directlyfrom skyvern.cli.utils import start_servicesquickstart_app = typer.Typer(help="Quickstart command to set up and run Skyvern with one command.")@@ -59,7 +59,7 @@ def quickstart(try:# Initialize Skyvernconsole.print("\n[bold blue]Initializing Skyvern...[/bold blue]")- init(no_postgres=no_postgres)+ run_local = init_env(no_postgres=no_postgres)# Skip browser installation if requestedif not skip_browser_install:@@ -76,8 +76,15 @@ def quickstart(console.print("⏭️ [yellow]Skipping Chromium installation as requested.[/yellow]")# Start services- console.print("\n[bold blue]Starting Skyvern services...[/bold blue]")- asyncio.run(start_services(server_only=server_only))+ if run_local:+ start_now = typer.confirm("\nDo you want to start Skyvern services now?", default=True)+ if start_now:+ console.print("\n[bold blue]Starting Skyvern services...[/bold blue]")+ asyncio.run(start_services(server_only=server_only))+ else:+ console.print(+ "\n[yellow]Skipping service startup. You can start services later with 'skyvern run all'[/yellow]"+ )except KeyboardInterrupt:console.print("\n[bold yellow]Quickstart process interrupted by user.[/bold yellow]")