Skip to content

Commit

Permalink
🔄 synced local 'skyvern/' with remote 'skyvern/'
Browse files Browse the repository at this point in the history
<!-- ELLIPSIS_HIDDEN -->

> [!IMPORTANT]
> Add `UrlBlock` support for GOTO_URL tasks in workflow execution and observer initialization.
>
>   - **Behavior**:
>     - Add `UrlBlock` handling in `execute_step()` in `agent.py` for tasks without navigation or data extraction goals.
>     - Add `_generate_goto_url_task()` in `observer_service.py` to create `UrlBlock` for initial observer tasks.
>   - **Models**:
>     - Update `StepStatus` in `models.py` to allow transition to `completed` from `created`.
>   - **Workflow Service**:
>     - Add `UrlBlock` support in `block_yaml_to_block()` in `service.py` to convert YAML to `UrlBlock`.
>   - **Misc**:
>     - Remove `is_last` terminal status check in `validate_update()` in `models.py`.
>
> <sup>This description was created by </sup>[<img alt="Ellipsis" src="https://img.shields.io/badge/Ellipsis-blue?color=175173">](https://www.ellipsis.dev?ref=Skyvern-AI%2Fskyvern-cloud&utm_source=github&utm_medium=referral)<sup> for b1093ead99be460ddc0b933ecdb9a3b5bbf6ffe3. It will automatically update as commits are pushed.</sup>

<!-- ELLIPSIS_HIDDEN -->
  • Loading branch information
wintonzheng committed Jan 31, 2025
1 parent 6a2edc1 commit bd885b3
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 bd885b3

Please sign in to comment.