Skip to content

Commit 0e6127a

Browse files
Expose max_status_failures across wait helpers
Co-authored-by: Shri Sukhani <shrisukhani@users.noreply.github.com>
1 parent aba5f13 commit 0e6127a

22 files changed

Lines changed: 134 additions & 0 deletions

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -107,6 +107,7 @@ These methods now support explicit polling controls:
107107

108108
- `poll_interval_seconds` (default `2.0`)
109109
- `max_wait_seconds` (default `600.0`)
110+
- `max_status_failures` (default `5`)
110111

111112
Example:
112113

hyperbrowser/client/managers/async_manager/agents/browser_use.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,7 @@ async def start_and_wait(
5555
params: StartBrowserUseTaskParams,
5656
poll_interval_seconds: float = 2.0,
5757
max_wait_seconds: Optional[float] = 600.0,
58+
max_status_failures: int = POLLING_ATTEMPTS,
5859
) -> BrowserUseTaskResponse:
5960
job_start_resp = await self.start(params)
6061
job_id = job_start_resp.job_id
@@ -68,6 +69,7 @@ async def start_and_wait(
6869
in {"completed", "failed", "stopped"},
6970
poll_interval_seconds=poll_interval_seconds,
7071
max_wait_seconds=max_wait_seconds,
72+
max_status_failures=max_status_failures,
7173
)
7274
return await retry_operation_async(
7375
operation_name=f"Fetching browser-use task job {job_id}",

hyperbrowser/client/managers/async_manager/agents/claude_computer_use.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@ async def start_and_wait(
4949
params: StartClaudeComputerUseTaskParams,
5050
poll_interval_seconds: float = 2.0,
5151
max_wait_seconds: Optional[float] = 600.0,
52+
max_status_failures: int = POLLING_ATTEMPTS,
5253
) -> ClaudeComputerUseTaskResponse:
5354
job_start_resp = await self.start(params)
5455
job_id = job_start_resp.job_id
@@ -62,6 +63,7 @@ async def start_and_wait(
6263
in {"completed", "failed", "stopped"},
6364
poll_interval_seconds=poll_interval_seconds,
6465
max_wait_seconds=max_wait_seconds,
66+
max_status_failures=max_status_failures,
6567
)
6668
return await retry_operation_async(
6769
operation_name=f"Fetching Claude Computer Use task job {job_id}",

hyperbrowser/client/managers/async_manager/agents/cua.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@ async def start_and_wait(
4747
params: StartCuaTaskParams,
4848
poll_interval_seconds: float = 2.0,
4949
max_wait_seconds: Optional[float] = 600.0,
50+
max_status_failures: int = POLLING_ATTEMPTS,
5051
) -> CuaTaskResponse:
5152
job_start_resp = await self.start(params)
5253
job_id = job_start_resp.job_id
@@ -60,6 +61,7 @@ async def start_and_wait(
6061
in {"completed", "failed", "stopped"},
6162
poll_interval_seconds=poll_interval_seconds,
6263
max_wait_seconds=max_wait_seconds,
64+
max_status_failures=max_status_failures,
6365
)
6466
return await retry_operation_async(
6567
operation_name=f"Fetching CUA task job {job_id}",

hyperbrowser/client/managers/async_manager/agents/gemini_computer_use.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@ async def start_and_wait(
4949
params: StartGeminiComputerUseTaskParams,
5050
poll_interval_seconds: float = 2.0,
5151
max_wait_seconds: Optional[float] = 600.0,
52+
max_status_failures: int = POLLING_ATTEMPTS,
5253
) -> GeminiComputerUseTaskResponse:
5354
job_start_resp = await self.start(params)
5455
job_id = job_start_resp.job_id
@@ -62,6 +63,7 @@ async def start_and_wait(
6263
in {"completed", "failed", "stopped"},
6364
poll_interval_seconds=poll_interval_seconds,
6465
max_wait_seconds=max_wait_seconds,
66+
max_status_failures=max_status_failures,
6567
)
6668
return await retry_operation_async(
6769
operation_name=f"Fetching Gemini Computer Use task job {job_id}",

hyperbrowser/client/managers/async_manager/agents/hyper_agent.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@ async def start_and_wait(
4949
params: StartHyperAgentTaskParams,
5050
poll_interval_seconds: float = 2.0,
5151
max_wait_seconds: Optional[float] = 600.0,
52+
max_status_failures: int = POLLING_ATTEMPTS,
5253
) -> HyperAgentTaskResponse:
5354
job_start_resp = await self.start(params)
5455
job_id = job_start_resp.job_id
@@ -62,6 +63,7 @@ async def start_and_wait(
6263
in {"completed", "failed", "stopped"},
6364
poll_interval_seconds=poll_interval_seconds,
6465
max_wait_seconds=max_wait_seconds,
66+
max_status_failures=max_status_failures,
6567
)
6668
return await retry_operation_async(
6769
operation_name=f"Fetching HyperAgent task {job_id}",

hyperbrowser/client/managers/async_manager/crawl.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@ async def start_and_wait(
4949
return_all_pages: bool = True,
5050
poll_interval_seconds: float = 2.0,
5151
max_wait_seconds: Optional[float] = 600.0,
52+
max_status_failures: int = POLLING_ATTEMPTS,
5253
) -> CrawlJobResponse:
5354
job_start_resp = await self.start(params)
5455
job_id = job_start_resp.job_id
@@ -61,6 +62,7 @@ async def start_and_wait(
6162
is_terminal_status=lambda status: status in {"completed", "failed"},
6263
poll_interval_seconds=poll_interval_seconds,
6364
max_wait_seconds=max_wait_seconds,
65+
max_status_failures=max_status_failures,
6466
)
6567

6668
if not return_all_pages:

hyperbrowser/client/managers/async_manager/extract.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@ async def start_and_wait(
4747
params: StartExtractJobParams,
4848
poll_interval_seconds: float = 2.0,
4949
max_wait_seconds: Optional[float] = 600.0,
50+
max_status_failures: int = POLLING_ATTEMPTS,
5051
) -> ExtractJobResponse:
5152
job_start_resp = await self.start(params)
5253
job_id = job_start_resp.job_id
@@ -59,6 +60,7 @@ async def start_and_wait(
5960
is_terminal_status=lambda status: status in {"completed", "failed"},
6061
poll_interval_seconds=poll_interval_seconds,
6162
max_wait_seconds=max_wait_seconds,
63+
max_status_failures=max_status_failures,
6264
)
6365
return await retry_operation_async(
6466
operation_name=f"Fetching extract job {job_id}",

hyperbrowser/client/managers/async_manager/scrape.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,7 @@ async def start_and_wait(
5555
return_all_pages: bool = True,
5656
poll_interval_seconds: float = 2.0,
5757
max_wait_seconds: Optional[float] = 600.0,
58+
max_status_failures: int = POLLING_ATTEMPTS,
5859
) -> BatchScrapeJobResponse:
5960
job_start_resp = await self.start(params)
6061
job_id = job_start_resp.job_id
@@ -67,6 +68,7 @@ async def start_and_wait(
6768
is_terminal_status=lambda status: status in {"completed", "failed"},
6869
poll_interval_seconds=poll_interval_seconds,
6970
max_wait_seconds=max_wait_seconds,
71+
max_status_failures=max_status_failures,
7072
)
7173

7274
if not return_all_pages:
@@ -142,6 +144,7 @@ async def start_and_wait(
142144
params: StartScrapeJobParams,
143145
poll_interval_seconds: float = 2.0,
144146
max_wait_seconds: Optional[float] = 600.0,
147+
max_status_failures: int = POLLING_ATTEMPTS,
145148
) -> ScrapeJobResponse:
146149
job_start_resp = await self.start(params)
147150
job_id = job_start_resp.job_id
@@ -154,6 +157,7 @@ async def start_and_wait(
154157
is_terminal_status=lambda status: status in {"completed", "failed"},
155158
poll_interval_seconds=poll_interval_seconds,
156159
max_wait_seconds=max_wait_seconds,
160+
max_status_failures=max_status_failures,
157161
)
158162
return await retry_operation_async(
159163
operation_name=f"Fetching scrape job {job_id}",

hyperbrowser/client/managers/async_manager/web/batch_fetch.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,7 @@ async def start_and_wait(
5757
return_all_pages: bool = True,
5858
poll_interval_seconds: float = 2.0,
5959
max_wait_seconds: Optional[float] = 600.0,
60+
max_status_failures: int = POLLING_ATTEMPTS,
6061
) -> BatchFetchJobResponse:
6162
job_start_resp = await self.start(params)
6263
job_id = job_start_resp.job_id
@@ -69,6 +70,7 @@ async def start_and_wait(
6970
is_terminal_status=lambda status: status in {"completed", "failed"},
7071
poll_interval_seconds=poll_interval_seconds,
7172
max_wait_seconds=max_wait_seconds,
73+
max_status_failures=max_status_failures,
7274
)
7375

7476
if not return_all_pages:

0 commit comments

Comments
 (0)