From e77c46997a8a3a02b3ae631fd8acc56b403c3877 Mon Sep 17 00:00:00 2001 From: LawyZheng Date: Tue, 10 Feb 2026 13:07:23 +0800 Subject: [PATCH] speculative step with mouse movement (#4679) --- skyvern/forge/agent.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/skyvern/forge/agent.py b/skyvern/forge/agent.py index a1617cfe..235ea599 100644 --- a/skyvern/forge/agent.py +++ b/skyvern/forge/agent.py @@ -1795,6 +1795,7 @@ class ForgeAgent: async def _speculate_next_step_plan( self, + organization: Organization, task: Task, current_step: Step, next_step: Step, @@ -1812,6 +1813,9 @@ class ForgeAgent: try: next_step.is_speculative = True + if page := await browser_state.get_working_page(): + await self.register_async_operations(organization, task, page) + scraped_page, extract_action_prompt, use_caching, prompt_name = await self.build_and_record_step_prompt( task, next_step, @@ -1830,6 +1834,8 @@ class ForgeAgent: default=app.LLM_API_HANDLER, ) + self.async_operation_pool.run_operation(task.task_id, AgentPhase.llm) + llm_json_response = await llm_api_handler( prompt=extract_action_prompt, prompt_name=prompt_name, @@ -3766,6 +3772,7 @@ class ForgeAgent: speculative_task = asyncio.create_task( self._speculate_next_step_plan( + organization=organization, task=task, current_step=step, next_step=next_step,