From 7754599797c91f2b864403a4592bc04b70f3a144 Mon Sep 17 00:00:00 2001 From: Shuchang Zheng Date: Sun, 29 Dec 2024 10:33:58 -0800 Subject: [PATCH] get observer cruise API --- skyvern/forge/sdk/routes/agent_protocol.py | 9 +++++++++ skyvern/forge/sdk/services/observer_service.py | 4 ++++ 2 files changed, 13 insertions(+) diff --git a/skyvern/forge/sdk/routes/agent_protocol.py b/skyvern/forge/sdk/routes/agent_protocol.py index 4485691b7..aa47828c4 100644 --- a/skyvern/forge/sdk/routes/agent_protocol.py +++ b/skyvern/forge/sdk/routes/agent_protocol.py @@ -1097,3 +1097,12 @@ async def observer_cruise( max_iterations_override=x_max_iterations_override, ) return observer_cruise + + +@base_router.get("/cruise/{observer_cruise_id}") +@base_router.get("/cruise/{observer_cruise_id}/", include_in_schema=False) +async def get_observer_cruise( + observer_cruise_id: str, + organization: Organization = Depends(org_auth_service.get_current_org), +) -> ObserverCruise: + return await observer_service.get_observer_cruise(observer_cruise_id, organization.organization_id) diff --git a/skyvern/forge/sdk/services/observer_service.py b/skyvern/forge/sdk/services/observer_service.py index 2bba5d577..49a1febd7 100644 --- a/skyvern/forge/sdk/services/observer_service.py +++ b/skyvern/forge/sdk/services/observer_service.py @@ -919,3 +919,7 @@ async def _record_thought_screenshot(observer_thought: ObserverThought, workflow artifact_type=ArtifactType.SCREENSHOT_LLM, data=screenshot, ) + + +async def get_observer_cruise(observer_cruise_id: str, organization_id: str | None = None) -> ObserverCruise: + return await app.DATABASE.get_observer_cruise(observer_cruise_id, organization_id=organization_id)