ui-tars integration (#2656)

This commit is contained in:
Wyatt Marshall
2025-06-13 01:23:39 -04:00
committed by GitHub
parent 47cf755d9c
commit 15d46aab82
18 changed files with 986 additions and 13 deletions

View File

@@ -24,6 +24,7 @@ async def get_run_response(run_id: str, organization_id: str | None = None) -> R
run.task_run_type == RunType.task_v1
or run.task_run_type == RunType.openai_cua
or run.task_run_type == RunType.anthropic_cua
or run.task_run_type == RunType.ui_tars
):
# fetch task v1 from db and transform to task run response
try:
@@ -37,6 +38,8 @@ async def get_run_response(run_id: str, organization_id: str | None = None) -> R
run_engine = RunEngine.openai_cua
elif run.task_run_type == RunType.anthropic_cua:
run_engine = RunEngine.anthropic_cua
elif run.task_run_type == RunType.ui_tars:
run_engine = RunEngine.ui_tars
return TaskRunResponse(
run_id=run.run_id,
@@ -129,7 +132,7 @@ async def cancel_run(run_id: str, organization_id: str | None = None, api_key: s
detail=f"Run not found {run_id}",
)
if run.task_run_type in [RunType.task_v1, RunType.openai_cua, RunType.anthropic_cua]:
if run.task_run_type in [RunType.task_v1, RunType.openai_cua, RunType.anthropic_cua, RunType.ui_tars]:
await cancel_task_v1(run_id, organization_id=organization_id, api_key=api_key)
elif run.task_run_type == RunType.task_v2:
await cancel_task_v2(run_id, organization_id=organization_id)
@@ -152,7 +155,7 @@ async def retry_run_webhook(run_id: str, organization_id: str | None = None, api
detail=f"Run not found {run_id}",
)
if run.task_run_type in [RunType.task_v1, RunType.openai_cua, RunType.anthropic_cua]:
if run.task_run_type in [RunType.task_v1, RunType.openai_cua, RunType.anthropic_cua, RunType.ui_tars]:
task = await app.DATABASE.get_task(run_id, organization_id=organization_id)
if not task:
raise TaskNotFound(task_id=run_id)

View File

@@ -90,6 +90,8 @@ async def run_task(
run_type = RunType.openai_cua
elif engine == RunEngine.anthropic_cua:
run_type = RunType.anthropic_cua
elif engine == RunEngine.ui_tars:
run_type = RunType.ui_tars
await app.DATABASE.create_task_run(
task_run_type=run_type,
organization_id=organization.organization_id,