Skip to content

Automate browser based workflows with AI

use browser session id in taskv2 POST (#2744)

Shuchang Zhengefd26070902b
diff --git a/skyvern/forge/sdk/routes/agent_protocol.py b/skyvern/forge/sdk/routes/agent_protocol.py
index 50eacc1a7..5ba68624f 100644
--- a/skyvern/forge/sdk/routes/agent_protocol.py
+++ b/skyvern/forge/sdk/routes/agent_protocol.py
@@ -1821,6 +1821,7 @@ async def run_task_v2(
extracted_information_schema=data.extracted_information_schema,
error_code_mapping=data.error_code_mapping,
max_screenshot_scrolling_times=data.max_screenshot_scrolling_times,
+ browser_session_id=data.browser_session_id,
)
except MissingBrowserAddressError as e:
raise HTTPException(status_code=400, detail=str(e)) from e
diff --git a/skyvern/services/task_v2_service.py b/skyvern/services/task_v2_service.py
index e11cdfa4a..2609785ab 100644
--- a/skyvern/services/task_v2_service.py
+++ b/skyvern/services/task_v2_service.py
@@ -166,6 +166,7 @@ async def initialize_task_v2(
create_task_run: bool = False,
model: dict[str, Any] | None = None,
max_screenshot_scrolling_times: int | None = None,
+ browser_session_id: str | None = None,
) -> TaskV2:
task_v2 = await app.DATABASE.create_task_v2(
prompt=user_prompt,
@@ -226,6 +227,7 @@ async def initialize_task_v2(
request_id=None,
workflow_request=WorkflowRequestBody(
max_screenshot_scrolling_times=max_screenshot_scrolling_times,
+ browser_session_id=browser_session_id,
),
workflow_permanent_id=new_workflow.workflow_permanent_id,
organization=organization,