Skip to content

Commit

Permalink
enable UrlBlock building in workflow service (#1689)
Browse files Browse the repository at this point in the history
  • Loading branch information
wintonzheng authored Jan 31, 2025
1 parent 6a2edc1 commit 405d132
Show file tree
Hide file tree
Showing 4 changed files with 213 additions and 136 deletions.
22 changes: 22 additions & 0 deletions skyvern/forge/agent.py
Original file line number Diff line number Diff line change
Expand Up @@ -342,6 +342,28 @@ async def execute_step(
detailed_output,
) = await self._initialize_execution_state(task, step, workflow_run, browser_session_id)

if (
not task.navigation_goal
and not task.data_extraction_goal
and not task.complete_criterion
and not task.terminate_criterion
):
# most likely a GOTO_URL task block
# mark step as completed and mark task as completed
step = await self.update_step(
step, status=StepStatus.completed, is_last=True, output=AgentStepOutput(action_results=[])
)
task = await self.update_task(task, status=TaskStatus.completed)
await self.clean_up_task(
task=task,
last_step=step,
api_key=api_key,
need_call_webhook=True,
close_browser_on_completion=close_browser_on_completion,
browser_session_id=browser_session_id,
)
return step, detailed_output, None

if page := await browser_state.get_working_page():
await self.register_async_operations(organization, task, page)

Expand Down
5 changes: 1 addition & 4 deletions skyvern/forge/sdk/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ class StepStatus(StrEnum):

def can_update_to(self, new_status: StepStatus) -> bool:
allowed_transitions: dict[StepStatus, set[StepStatus]] = {
StepStatus.created: {StepStatus.running, StepStatus.failed, StepStatus.canceled},
StepStatus.created: {StepStatus.running, StepStatus.failed, StepStatus.canceled, StepStatus.completed},
StepStatus.running: {StepStatus.completed, StepStatus.failed, StepStatus.canceled},
StepStatus.failed: set(),
StepStatus.completed: set(),
Expand Down Expand Up @@ -80,9 +80,6 @@ def validate_update(
if self.output is not None and output is not None:
raise ValueError(f"cant_override_output({self.step_id})")

if is_last and not self.status.is_terminal():
raise ValueError(f"is_last_but_status_not_terminal({self.status},{self.step_id})")

if is_last is False:
raise ValueError(f"cant_set_is_last_to_false({self.step_id})")

Expand Down
Loading

0 comments on commit 405d132

Please sign in to comment.