Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

enable UrlBlock building in workflow service #1689

Merged
merged 1 commit into from
Jan 31, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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