Skip to content

Commit 7f1376e

Browse files
Add sync and async Claude/Gemini task examples
Co-authored-by: Shri Sukhani <shrisukhani@users.noreply.github.com>
1 parent da47b71 commit 7f1376e

File tree

5 files changed

+120
-0
lines changed

5 files changed

+120
-0
lines changed

README.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -259,11 +259,13 @@ Ready-to-run examples are available in `examples/`:
259259

260260
- `examples/async_batch_fetch.py`
261261
- `examples/async_browser_use_task.py`
262+
- `examples/async_claude_computer_use_task.py`
262263
- `examples/async_crawl.py`
263264
- `examples/async_cua_task.py`
264265
- `examples/async_extension_create.py`
265266
- `examples/async_extension_list.py`
266267
- `examples/async_extract.py`
268+
- `examples/async_gemini_computer_use_task.py`
267269
- `examples/async_hyper_agent_task.py`
268270
- `examples/async_profile_list.py`
269271
- `examples/async_scrape.py`
@@ -274,11 +276,13 @@ Ready-to-run examples are available in `examples/`:
274276
- `examples/async_web_search.py`
275277
- `examples/sync_batch_fetch.py`
276278
- `examples/sync_browser_use_task.py`
279+
- `examples/sync_claude_computer_use_task.py`
277280
- `examples/sync_crawl.py`
278281
- `examples/sync_cua_task.py`
279282
- `examples/sync_extension_create.py`
280283
- `examples/sync_extension_list.py`
281284
- `examples/sync_extract.py`
285+
- `examples/sync_gemini_computer_use_task.py`
282286
- `examples/sync_hyper_agent_task.py`
283287
- `examples/sync_profile_list.py`
284288
- `examples/sync_scrape.py`
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
"""
2+
Asynchronous Claude Computer Use task example.
3+
4+
Run:
5+
export HYPERBROWSER_API_KEY="your_api_key"
6+
python3 examples/async_claude_computer_use_task.py
7+
"""
8+
9+
import asyncio
10+
11+
from hyperbrowser import AsyncHyperbrowser
12+
from hyperbrowser.models.agents.claude_computer_use import (
13+
StartClaudeComputerUseTaskParams,
14+
)
15+
16+
17+
async def main() -> None:
18+
async with AsyncHyperbrowser() as client:
19+
result = await client.agents.claude_computer_use.start_and_wait(
20+
StartClaudeComputerUseTaskParams(
21+
task="Open https://example.com and summarize the page.",
22+
max_steps=4,
23+
)
24+
)
25+
print(f"Job status: {result.status}")
26+
print(f"Steps collected: {len(result.steps)}")
27+
28+
29+
if __name__ == "__main__":
30+
asyncio.run(main())
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
"""
2+
Asynchronous Gemini Computer Use task example.
3+
4+
Run:
5+
export HYPERBROWSER_API_KEY="your_api_key"
6+
python3 examples/async_gemini_computer_use_task.py
7+
"""
8+
9+
import asyncio
10+
11+
from hyperbrowser import AsyncHyperbrowser
12+
from hyperbrowser.models.agents.gemini_computer_use import (
13+
StartGeminiComputerUseTaskParams,
14+
)
15+
16+
17+
async def main() -> None:
18+
async with AsyncHyperbrowser() as client:
19+
result = await client.agents.gemini_computer_use.start_and_wait(
20+
StartGeminiComputerUseTaskParams(
21+
task="Open https://example.com and summarize the page.",
22+
max_steps=4,
23+
)
24+
)
25+
print(f"Job status: {result.status}")
26+
print(f"Steps collected: {len(result.steps)}")
27+
28+
29+
if __name__ == "__main__":
30+
asyncio.run(main())
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
"""
2+
Synchronous Claude Computer Use task example.
3+
4+
Run:
5+
export HYPERBROWSER_API_KEY="your_api_key"
6+
python3 examples/sync_claude_computer_use_task.py
7+
"""
8+
9+
from hyperbrowser import Hyperbrowser
10+
from hyperbrowser.models.agents.claude_computer_use import (
11+
StartClaudeComputerUseTaskParams,
12+
)
13+
14+
15+
def main() -> None:
16+
with Hyperbrowser() as client:
17+
result = client.agents.claude_computer_use.start_and_wait(
18+
StartClaudeComputerUseTaskParams(
19+
task="Open https://example.com and summarize the page.",
20+
max_steps=4,
21+
)
22+
)
23+
print(f"Job status: {result.status}")
24+
print(f"Steps collected: {len(result.steps)}")
25+
26+
27+
if __name__ == "__main__":
28+
main()
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
"""
2+
Synchronous Gemini Computer Use task example.
3+
4+
Run:
5+
export HYPERBROWSER_API_KEY="your_api_key"
6+
python3 examples/sync_gemini_computer_use_task.py
7+
"""
8+
9+
from hyperbrowser import Hyperbrowser
10+
from hyperbrowser.models.agents.gemini_computer_use import (
11+
StartGeminiComputerUseTaskParams,
12+
)
13+
14+
15+
def main() -> None:
16+
with Hyperbrowser() as client:
17+
result = client.agents.gemini_computer_use.start_and_wait(
18+
StartGeminiComputerUseTaskParams(
19+
task="Open https://example.com and summarize the page.",
20+
max_steps=4,
21+
)
22+
)
23+
print(f"Job status: {result.status}")
24+
print(f"Steps collected: {len(result.steps)}")
25+
26+
27+
if __name__ == "__main__":
28+
main()

0 commit comments

Comments
 (0)