diff --git a/docs/cloud/agent/human-in-the-loop.mdx b/docs/cloud/agent/human-in-the-loop.mdx index 816f4047..f736ae9f 100644 --- a/docs/cloud/agent/human-in-the-loop.mdx +++ b/docs/cloud/agent/human-in-the-loop.mdx @@ -5,7 +5,9 @@ icon: hand --- Use a human checkpoint for approvals, authentication, payments, or review. -After a run stops, get its `live_view_url` from the `browser.ready` event: +Get its `live_view_url` with the SDK's event-wait helper, which follows event +cursors instead of searching only the first page. Wait for the run to stop at +the checkpoint before letting a person interact: ```python Python @@ -15,16 +17,11 @@ client = BrowserUse() run = client.runs.create( "Open the login page and stop for human review" ) -run = client.runs.wait_for_completion(run.id) - -events = client.runs.events(run.id, limit=100) -ready = next( - event for event in events.events - if event.type == "browser.ready" -) +ready = client.runs.wait_for_event(run.id, "browser.ready") +client.runs.wait_for_completion(run.id) print(ready.data["live_view_url"]) -# After the human finishes: +input("Press Enter after finishing the human step...") next_run = client.runs.create( "Continue from the current page", session_id=run.session_id, @@ -32,30 +29,31 @@ next_run = client.runs.create( ``` ```typescript TypeScript import { BrowserUse } from "browser-use-sdk/v4"; +import * as readline from "node:readline/promises"; const client = new BrowserUse(); const run = await client.runs.create({ task: "Open the login page and stop for human review", - model: "grok-4.5", + model: "gpt-5.6-luna", + modelParams: { reasoning: { effort: "xhigh" } }, }); +const ready = await client.runs.waitForEvent(run.id, "browser.ready"); await client.runs.waitForCompletion(run.id); +console.log(ready.data.live_view_url); -const events = await client.runs.events(run.id, { - limit: 100, -}); -const ready = events.events.find( - (event) => event.type === "browser.ready", -); -console.log(ready?.data.live_view_url); - -// After the human finishes: +const rl = readline.createInterface({ input: process.stdin, output: process.stdout }); +await rl.question("Press Enter after finishing the human step..."); +rl.close(); const nextRun = await client.runs.create({ task: "Continue from the current page", - model: "grok-4.5", + model: "gpt-5.6-luna", + modelParams: { reasoning: { effort: "xhigh" } }, sessionId: run.sessionId, }); ``` The same session preserves the conversation and workspace and reuses the live -browser while it is available. Treat live-view URLs as credentials. +browser while it is available. Complete the human step before that browser +expires. In a web app, replace the terminal prompt with an explicit Continue +control. Treat live-view URLs as credentials. diff --git a/docs/cloud/agent/scripts.mdx b/docs/cloud/agent/scripts.mdx index cfbda783..182d5503 100644 --- a/docs/cloud/agent/scripts.mdx +++ b/docs/cloud/agent/scripts.mdx @@ -57,7 +57,8 @@ first = client.runs.create( proof/run-2.json. Confirm both outputs have a fresh fetched_at value and five stories. Add scripts/README.md with the command to run it again. """, - model="grok-4.5", + model="gpt-5.6-luna", + model_params={"reasoning": {"effort": "xhigh"}}, workspace_id=workspace.id, ) client.runs.wait_for_completion(first.id) @@ -87,7 +88,8 @@ const first = await client.runs.create({ proof/run-2.json. Confirm both outputs have a fresh fetched_at value and five stories. Add scripts/README.md with the command to run it again. `, - model: "grok-4.5", + model: "gpt-5.6-luna", + modelParams: { reasoning: { effort: "xhigh" } }, workspaceId: workspace.id, }); await client.runs.waitForCompletion(first.id); @@ -119,7 +121,8 @@ later = client.runs.create( has five stories. If the script fails or the result is malformed, inspect the live page and repair the saved script before returning the new result. """, - model="grok-4.5", + model="gpt-5.6-luna", + model_params={"reasoning": {"effort": "xhigh"}}, workspace_id=workspace_id, ) result = client.runs.wait_for_completion(later.id) @@ -138,7 +141,8 @@ const later = await client.runs.create({ has five stories. If the script fails or the result is malformed, inspect the live page and repair the saved script before returning the new result. `, - model: "grok-4.5", + model: "gpt-5.6-luna", + modelParams: { reasoning: { effort: "xhigh" } }, workspaceId, }); const result = await client.runs.waitForCompletion(later.id); diff --git a/docs/cloud/agent/sessions.mdx b/docs/cloud/agent/sessions.mdx index 85da2173..bd27f72e 100644 --- a/docs/cloud/agent/sessions.mdx +++ b/docs/cloud/agent/sessions.mdx @@ -38,13 +38,15 @@ print(result.result) ```typescript TypeScript const first = await client.runs.create({ task: "Open Hacker News", - model: "grok-4.5", + model: "gpt-5.6-luna", + modelParams: { reasoning: { effort: "xhigh" } }, }); await client.runs.waitForCompletion(first.id); const followUp = await client.runs.create({ task: "Now summarize the top story", - model: "grok-4.5", + model: "gpt-5.6-luna", + modelParams: { reasoning: { effort: "xhigh" } }, sessionId: first.sessionId, }); const result = await client.runs.waitForCompletion(followUp.id); diff --git a/docs/cloud/agent/structured-output.mdx b/docs/cloud/agent/structured-output.mdx index dc992fac..0c359e35 100644 --- a/docs/cloud/agent/structured-output.mdx +++ b/docs/cloud/agent/structured-output.mdx @@ -37,7 +37,8 @@ const Story = z.object({ const run = await client.runs.create({ task: 'Find the top HN story. Return only {"title":"...","points":0}.', - model: "grok-4.5", + model: "gpt-5.6-luna", + modelParams: { reasoning: { effort: "xhigh" } }, }); const result = await client.runs.waitForCompletion(run.id); const story = Story.parse(JSON.parse(result.result ?? "{}")); diff --git a/docs/cloud/agent/workspaces.mdx b/docs/cloud/agent/workspaces.mdx index 271e16cd..0ffef421 100644 --- a/docs/cloud/agent/workspaces.mdx +++ b/docs/cloud/agent/workspaces.mdx @@ -57,7 +57,8 @@ await client.workspaces.upload( const run = await client.runs.create({ task: "Find everyone in the CSV who works at Google", - model: "grok-4.5", + model: "gpt-5.6-luna", + modelParams: { reasoning: { effort: "xhigh" } }, workspaceId: workspace.id, }); ``` diff --git a/docs/cloud/browser/live-preview.mdx b/docs/cloud/browser/live-preview.mdx index 4f5df0fd..5bbc7dfd 100644 --- a/docs/cloud/browser/live-preview.mdx +++ b/docs/cloud/browser/live-preview.mdx @@ -22,7 +22,8 @@ import { BrowserUse } from "browser-use-sdk/v4"; const client = new BrowserUse(); const run = await client.runs.create({ task: "Find the top Hacker News story", - model: "grok-4.5", + model: "gpt-5.6-luna", + modelParams: { reasoning: { effort: "xhigh" } }, }); const ready = await client.runs.waitForEvent(run.id, "browser.ready", { interval: 3_000 }); console.log(ready.data.live_view_url); @@ -121,7 +122,8 @@ run = client.runs.create( ```typescript TypeScript const run = await client.runs.create({ task: "Test the checkout flow", - model: "grok-4.5", + model: "gpt-5.6-luna", + modelParams: { reasoning: { effort: "xhigh" } }, browserSettings: { proxyCountryCode: "us", record: true }, }); ``` diff --git a/docs/cloud/browser/proxies.mdx b/docs/cloud/browser/proxies.mdx index 595cd84b..6383ef88 100644 --- a/docs/cloud/browser/proxies.mdx +++ b/docs/cloud/browser/proxies.mdx @@ -46,7 +46,8 @@ import { BrowserUse } from "browser-use-sdk/v4"; const client = new BrowserUse(); const run = await client.runs.create({ task: "Get the iPhone 16 price on amazon.de", - model: "grok-4.5", + model: "gpt-5.6-luna", + modelParams: { reasoning: { effort: "xhigh" } }, browserSettings: { proxyCountryCode: "de" }, }); ``` @@ -73,7 +74,8 @@ run = client.runs.create( ```typescript TypeScript const run = await client.runs.create({ task: "Test my staging site", - model: "grok-4.5", + model: "gpt-5.6-luna", + modelParams: { reasoning: { effort: "xhigh" } }, browserSettings: { proxyCountryCode: null }, }); ``` @@ -145,7 +147,8 @@ run = client.runs.create( ```typescript TypeScript const run = await client.runs.create({ task: "Check the account dashboard", - model: "grok-4.5", + model: "gpt-5.6-luna", + modelParams: { reasoning: { effort: "xhigh" } }, browserSettings: { proxyCountryCode: "us", customProxy: { diff --git a/docs/cloud/guides/2fa.mdx b/docs/cloud/guides/2fa.mdx index f75513da..66942695 100644 --- a/docs/cloud/guides/2fa.mdx +++ b/docs/cloud/guides/2fa.mdx @@ -21,7 +21,8 @@ run = client.runs.create( ```typescript TypeScript const run = await client.runs.create({ task: "Download my latest invoice", - model: "grok-4.5", + model: "gpt-5.6-luna", + modelParams: { reasoning: { effort: "xhigh" } }, browserSettings: { profileId: "YOUR_PROFILE_ID", proxyCountryCode: "us", @@ -43,7 +44,10 @@ the code. Then continue with the same session: first = client.runs.create( "Open the login page and stop at the 2FA prompt", ) +ready = client.runs.wait_for_event(first.id, "browser.ready") client.runs.wait_for_completion(first.id) +print(ready.data["live_view_url"]) +input("Press Enter after entering the 2FA code...") next_run = client.runs.create( "Continue after login and download the invoice", @@ -53,13 +57,20 @@ next_run = client.runs.create( ```typescript TypeScript const first = await client.runs.create({ task: "Open the login page and stop at the 2FA prompt", - model: "grok-4.5", + model: "gpt-5.6-luna", + modelParams: { reasoning: { effort: "xhigh" } }, }); +const ready = await client.runs.waitForEvent(first.id, "browser.ready"); await client.runs.waitForCompletion(first.id); +console.log(ready.data.live_view_url); +await new Promise((resolve) => { + process.stdin.once("data", resolve); +}); const nextRun = await client.runs.create({ task: "Continue after login and download the invoice", - model: "grok-4.5", + model: "gpt-5.6-luna", + modelParams: { reasoning: { effort: "xhigh" } }, sessionId: first.sessionId, }); ``` diff --git a/docs/cloud/guides/authentication.mdx b/docs/cloud/guides/authentication.mdx index 072ac852..44bcb0b1 100644 --- a/docs/cloud/guides/authentication.mdx +++ b/docs/cloud/guides/authentication.mdx @@ -42,7 +42,8 @@ import { BrowserUse } from "browser-use-sdk/v4"; const client = new BrowserUse(); const run = await client.runs.create({ task: "Open my account dashboard and summarize it", - model: "grok-4.5", + model: "gpt-5.6-luna", + modelParams: { reasoning: { effort: "xhigh" } }, browserSettings: { profileId: "YOUR_PROFILE_ID", proxyCountryCode: "us", diff --git a/docs/cloud/guides/profile-sync.mdx b/docs/cloud/guides/profile-sync.mdx index dd705ad8..754cc646 100644 --- a/docs/cloud/guides/profile-sync.mdx +++ b/docs/cloud/guides/profile-sync.mdx @@ -29,7 +29,8 @@ import { BrowserUse } from "browser-use-sdk/v4"; const client = new BrowserUse(); const run = await client.runs.create({ task: "Check my LinkedIn messages", - model: "grok-4.5", + model: "gpt-5.6-luna", + modelParams: { reasoning: { effort: "xhigh" } }, browserSettings: { profileId: "YOUR_PROFILE_ID", proxyCountryCode: "us",