Automate browser based workflows with AI
Python aiapiautomationbrowserbrowser-automationcomputergptllmplaywrightpowerautomatepuppeteerpythonrpaseleniumvisionworkflow
move startup and teardown events to forge api_app.py (#3730)
Shuchang Zheng6cfe998f8ac3
diff --git a/skyvern/forge/api_app.py b/skyvern/forge/api_app.pyindex 68593be65..3d96ae28f 100644--- a/skyvern/forge/api_app.py+++ b/skyvern/forge/api_app.py@@ -55,7 +55,19 @@ def custom_openapi() -> dict:async def lifespan(_: FastAPI) -> AsyncGenerator[None, Any]:"""Lifespan context manager for FastAPI app startup and shutdown."""LOG.info("Server started")+ if forge_app.api_app_startup_event:+ LOG.info("Calling api app startup event")+ try:+ await forge_app.api_app_startup_event()+ except Exception:+ LOG.exception("Failed to execute api app startup event")yield+ if forge_app.api_app_shutdown_event:+ LOG.info("Calling api app shutdown event")+ try:+ await forge_app.api_app_shutdown_event()+ except Exception:+ LOG.exception("Failed to execute api app shutdown event")LOG.info("Server shutting down")diff --git a/skyvern/forge/app.py b/skyvern/forge/app.pyindex 33d22283d..e801afc71 100644--- a/skyvern/forge/app.py+++ b/skyvern/forge/app.py@@ -127,6 +127,8 @@ scrape_exclude: ScrapeExcludeFunc | None = Noneauthentication_function: Callable[[str], Awaitable[Organization]] | None = Noneauthenticate_user_function: Callable[[str], Awaitable[str | None]] | None = Nonesetup_api_app: Callable[[FastAPI], None] | None = None+api_app_startup_event: Callable[[], Awaitable[None]] | None = None+api_app_shutdown_event: Callable[[], Awaitable[None]] | None = Noneagent = ForgeAgent()