Skip to content

Automate browser based workflows with AI

Revert "feat: add total_cost to runs response endpoint" (#6050)

Aaron Perezd4ad6981464d
diff --git a/skyvern/schemas/runs.py b/skyvern/schemas/runs.py
index f8d8ead27..714f1d8db 100644
--- a/skyvern/schemas/runs.py
+++ b/skyvern/schemas/runs.py
@@ -373,10 +373,6 @@ class BaseRunResponse(BaseModel):
default=None,
description="Total number of steps executed in this run",
)
- total_cost: float | None = Field(
- default=None,
- description="Estimated cost of this run",
- )
class TaskRunResponse(BaseRunResponse):
diff --git a/skyvern/services/run_service.py b/skyvern/services/run_service.py
index d288e98c5..0dde3e122 100644
--- a/skyvern/services/run_service.py
+++ b/skyvern/services/run_service.py
@@ -42,13 +42,6 @@ async def get_run_response(run_id: str, organization_id: str | None = None) -> R
elif run.task_run_type == RunType.ui_tars:
run_engine = RunEngine.ui_tars
- task_total_cost: float | None = None
- if run.organization_id and task_v1_response.step_count:
- _, completed_step_count = await app.DATABASE.tasks.get_step_counts_by_task_ids(
- task_ids=[run.run_id], organization_id=run.organization_id
- )
- task_total_cost = 0.05 * completed_step_count
-
return TaskRunResponse(
run_id=run.run_id,
run_type=run.task_run_type,
@@ -79,7 +72,6 @@ async def get_run_response(run_id: str, organization_id: str | None = None) -> R
),
errors=task_v1_response.errors,
step_count=task_v1_response.step_count,
- total_cost=task_total_cost,
)
elif run.task_run_type == RunType.task_v2:
task_v2 = await app.DATABASE.observer.get_task_v2(run.run_id, organization_id=organization_id)
diff --git a/skyvern/services/task_v2_service.py b/skyvern/services/task_v2_service.py
index c39da1699..68a2b0e0f 100644
--- a/skyvern/services/task_v2_service.py
+++ b/skyvern/services/task_v2_service.py
@@ -2058,7 +2058,6 @@ async def build_task_v2_run_response(task_v2: TaskV2) -> TaskRunResponse:
),
errors=workflow_run_resp.errors if workflow_run_resp else None,
step_count=workflow_run_resp.step_count if workflow_run_resp else None,
- total_cost=workflow_run_resp.total_cost if workflow_run_resp else None,
)
diff --git a/skyvern/services/workflow_service.py b/skyvern/services/workflow_service.py
index e9f659c35..58ca6d0b6 100644
--- a/skyvern/services/workflow_service.py
+++ b/skyvern/services/workflow_service.py
@@ -133,7 +133,6 @@ async def get_workflow_run_response(
workflow_run_id=workflow_run.workflow_run_id,
organization_id=organization_id,
include_step_count=True,
- include_cost=True,
)
app_url = f"{settings.SKYVERN_APP_URL.rstrip('/')}/runs/{workflow_run.workflow_run_id}"
return WorkflowRunResponse(
@@ -172,5 +171,4 @@ async def get_workflow_run_response(
),
errors=workflow_run_resp.errors,
step_count=workflow_run_resp.total_steps,
- total_cost=workflow_run_resp.total_cost,
)
diff --git a/tests/unit/services/test_get_workflow_run_response_passthrough.py b/tests/unit/services/test_get_workflow_run_response_passthrough.py
index 82e9caf17..634ef100e 100644
--- a/tests/unit/services/test_get_workflow_run_response_passthrough.py
+++ b/tests/unit/services/test_get_workflow_run_response_passthrough.py
@@ -47,7 +47,6 @@ async def test_get_workflow_run_response_passes_through_all_fields() -> None:
parameters={},
errors=None,
total_steps=4,
- total_cost=0.2,
)
with (
@@ -72,6 +71,5 @@ async def test_get_workflow_run_response_passes_through_all_fields() -> None:
assert resp.run_with == "code"
assert resp.status == RunStatus.completed
assert resp.step_count == 4
- assert resp.total_cost == 0.2
assert resp.run_request is not None
assert resp.run_request.browser_session_id == "pbs_123"