Skip to content
Open
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
72 changes: 72 additions & 0 deletions docs/cloud/agent/structured-output.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -55,3 +55,75 @@ for (const post of result.output.posts) {
}
```
</CodeGroup>

## Scrape multiple sites concurrently

Each `client.run()` call creates its own session, so you can run them in parallel with `asyncio.gather` (Python) or `Promise.all` (TypeScript). Every result is fully typed.

<CodeGroup>
```python Python
import asyncio
from browser_use_sdk.v3 import AsyncBrowserUse
from pydantic import BaseModel

class Product(BaseModel):
name: str
price: str
url: str

class Results(BaseModel):
products: list[Product]

async def main():
client = AsyncBrowserUse()

sites = [
"Find the top 3 laptops on amazon.com with their prices",
"Find the top 3 laptops on bestbuy.com with their prices",
"Find the top 3 laptops on newegg.com with their prices",
]

results = await asyncio.gather(*[
client.run(task, output_schema=Results)
for task in sites
])

for result in results:
for p in result.output.products:
print(f"{p.name} — {p.price}")

asyncio.run(main())
```
```typescript TypeScript
import { BrowserUse } from "browser-use-sdk/v3";
import { z } from "zod";

const Product = z.object({
name: z.string(),
price: z.string(),
url: z.string(),
});

const Results = z.object({
products: z.array(Product),
});

const client = new BrowserUse();

const sites = [
"Find the top 3 laptops on amazon.com with their prices",
"Find the top 3 laptops on bestbuy.com with their prices",
"Find the top 3 laptops on newegg.com with their prices",
];

const results = await Promise.all(
sites.map((task) => client.run(task, { schema: Results }))
);

for (const result of results) {
for (const p of result.output.products) {
console.log(`${p.name} — ${p.price}`);
}
}
```
</CodeGroup>
13 changes: 13 additions & 0 deletions docs/cloud/llms.txt
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,19 @@ export BROWSER_USE_API_KEY=bu_your_key_here
```


Concurrent scraping — each `run()` creates its own session, so run them in parallel:
```python
results = await asyncio.gather(*[
client.run(task, output_schema=MySchema)
for task in ["Scrape site A", "Scrape site B", "Scrape site C"]
])
```
```javascript
const results = await Promise.all(
tasks.map((task) => client.run(task, { schema: MySchema }))
Copy link
Copy Markdown

@cubic-dev-ai cubic-dev-ai bot Mar 31, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2: The JavaScript example references tasks without defining it, so the snippet will fail when copied as-is.

Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At docs/cloud/llms.txt, line 33:

<comment>The JavaScript example references `tasks` without defining it, so the snippet will fail when copied as-is.</comment>

<file context>
@@ -21,6 +21,19 @@ export BROWSER_USE_API_KEY=bu_your_key_here
+```
+```javascript
+const results = await Promise.all(
+  tasks.map((task) => client.run(task, { schema: MySchema }))
+);
+```
</file context>
Suggested change
tasks.map((task) => client.run(task, { schema: MySchema }))
["Scrape site A", "Scrape site B", "Scrape site C"].map((task) => client.run(task, { schema: MySchema }))
Fix with Cubic

);
```

## Get Started
- [Quick start](https://docs.browser-use.com/cloud/quickstart): State-of-the-art AI browser automation with stealth browsers, CAPTCHA solving, residential proxies, and managed infrastructure.
- [Prompt for Vibecoders](https://docs.browser-use.com/cloud/vibecoding): Complete Cloud SDK reference for AI coding agents.
Expand Down
13 changes: 13 additions & 0 deletions docs/llms.txt
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,19 @@ export BROWSER_USE_API_KEY=bu_your_key_here
```


Concurrent scraping — each `run()` creates its own session, so run them in parallel:
```python
results = await asyncio.gather(*[
client.run(task, output_schema=MySchema)
for task in ["Scrape site A", "Scrape site B", "Scrape site C"]
])
```
```javascript
const results = await Promise.all(
tasks.map((task) => client.run(task, { schema: MySchema }))
Copy link
Copy Markdown

@cubic-dev-ai cubic-dev-ai bot Mar 31, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2: The JavaScript snippet references an undefined tasks variable, so the example is not runnable as written.

Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At docs/llms.txt, line 33:

<comment>The JavaScript snippet references an undefined `tasks` variable, so the example is not runnable as written.</comment>

<file context>
@@ -21,6 +21,19 @@ export BROWSER_USE_API_KEY=bu_your_key_here
+```
+```javascript
+const results = await Promise.all(
+  tasks.map((task) => client.run(task, { schema: MySchema }))
+);
+```
</file context>
Suggested change
tasks.map((task) => client.run(task, { schema: MySchema }))
["Scrape site A", "Scrape site B", "Scrape site C"].map((task) => client.run(task, { schema: MySchema }))
Fix with Cubic

);
```

## Get Started
- [Quick start](https://docs.browser-use.com/cloud/quickstart): State-of-the-art AI browser automation with stealth browsers, CAPTCHA solving, residential proxies, and managed infrastructure.
- [Prompt for Vibecoders](https://docs.browser-use.com/cloud/vibecoding): Complete Cloud SDK reference for AI coding agents.
Expand Down
Loading