create task, task v2 and workflow run with browser_session_id (#2872)

This commit is contained in:
Shuchang Zheng 2025-07-03 18:45:04 -07:00 committed by GitHub
parent 70661ae5a0
commit 9d6e30f1de
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
6 changed files with 10 additions and 0 deletions

View file

@ -243,6 +243,7 @@ class ForgeAgent:
model=task_request.model, model=task_request.model,
max_screenshot_scrolling_times=task_request.max_screenshot_scrolls, max_screenshot_scrolling_times=task_request.max_screenshot_scrolls,
extra_http_headers=task_request.extra_http_headers, extra_http_headers=task_request.extra_http_headers,
browser_session_id=task_request.browser_session_id,
) )
LOG.info( LOG.info(
"Created new task", "Created new task",

View file

@ -151,6 +151,7 @@ class AgentDB:
model: dict[str, Any] | None = None, model: dict[str, Any] | None = None,
max_screenshot_scrolling_times: int | None = None, max_screenshot_scrolling_times: int | None = None,
extra_http_headers: dict[str, str] | None = None, extra_http_headers: dict[str, str] | None = None,
browser_session_id: str | None = None,
) -> Task: ) -> Task:
try: try:
async with self.Session() as session: async with self.Session() as session:
@ -180,6 +181,7 @@ class AgentDB:
model=model, model=model,
max_screenshot_scrolling_times=max_screenshot_scrolling_times, max_screenshot_scrolling_times=max_screenshot_scrolling_times,
extra_http_headers=extra_http_headers, extra_http_headers=extra_http_headers,
browser_session_id=browser_session_id,
) )
session.add(new_task) session.add(new_task)
await session.commit() await session.commit()
@ -1553,6 +1555,7 @@ class AgentDB:
workflow_permanent_id: str, workflow_permanent_id: str,
workflow_id: str, workflow_id: str,
organization_id: str, organization_id: str,
browser_session_id: str | None = None,
proxy_location: ProxyLocation | None = None, proxy_location: ProxyLocation | None = None,
webhook_callback_url: str | None = None, webhook_callback_url: str | None = None,
totp_verification_url: str | None = None, totp_verification_url: str | None = None,
@ -1567,6 +1570,7 @@ class AgentDB:
workflow_permanent_id=workflow_permanent_id, workflow_permanent_id=workflow_permanent_id,
workflow_id=workflow_id, workflow_id=workflow_id,
organization_id=organization_id, organization_id=organization_id,
browser_session_id=browser_session_id,
proxy_location=proxy_location, proxy_location=proxy_location,
status="created", status="created",
webhook_callback_url=webhook_callback_url, webhook_callback_url=webhook_callback_url,

View file

@ -144,6 +144,7 @@ def convert_to_task(task_obj: TaskModel, debug_enabled: bool = False, workflow_p
started_at=task_obj.started_at, started_at=task_obj.started_at,
finished_at=task_obj.finished_at, finished_at=task_obj.finished_at,
max_screenshot_scrolls=task_obj.max_screenshot_scrolling_times, max_screenshot_scrolls=task_obj.max_screenshot_scrolling_times,
browser_session_id=task_obj.browser_session_id,
) )
return task return task
@ -268,6 +269,7 @@ def convert_to_workflow_run(
parent_workflow_run_id=workflow_run_model.parent_workflow_run_id, parent_workflow_run_id=workflow_run_model.parent_workflow_run_id,
workflow_id=workflow_run_model.workflow_id, workflow_id=workflow_run_model.workflow_id,
organization_id=workflow_run_model.organization_id, organization_id=workflow_run_model.organization_id,
browser_session_id=workflow_run_model.browser_session_id,
status=WorkflowRunStatus[workflow_run_model.status], status=WorkflowRunStatus[workflow_run_model.status],
failure_reason=workflow_run_model.failure_reason, failure_reason=workflow_run_model.failure_reason,
proxy_location=( proxy_location=(

View file

@ -242,6 +242,7 @@ class Task(TaskBase):
organization_id: str organization_id: str
workflow_run_id: str | None = None workflow_run_id: str | None = None
workflow_permanent_id: str | None = None workflow_permanent_id: str | None = None
browser_session_id: str | None = None
order: int | None = None order: int | None = None
retry: int | None = None retry: int | None = None
max_steps_per_run: int | None = None max_steps_per_run: int | None = None

View file

@ -111,6 +111,7 @@ class WorkflowRun(BaseModel):
workflow_id: str workflow_id: str
workflow_permanent_id: str workflow_permanent_id: str
organization_id: str organization_id: str
browser_session_id: str | None = None
status: WorkflowRunStatus status: WorkflowRunStatus
extra_http_headers: dict[str, str] | None = None extra_http_headers: dict[str, str] | None = None
proxy_location: ProxyLocation | None = None proxy_location: ProxyLocation | None = None

View file

@ -783,6 +783,7 @@ class WorkflowService:
workflow_permanent_id=workflow_permanent_id, workflow_permanent_id=workflow_permanent_id,
workflow_id=workflow_id, workflow_id=workflow_id,
organization_id=organization_id, organization_id=organization_id,
browser_session_id=workflow_request.browser_session_id,
proxy_location=workflow_request.proxy_location, proxy_location=workflow_request.proxy_location,
webhook_callback_url=workflow_request.webhook_callback_url, webhook_callback_url=workflow_request.webhook_callback_url,
totp_verification_url=workflow_request.totp_verification_url, totp_verification_url=workflow_request.totp_verification_url,