Skip to content
Merged
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
2 changes: 1 addition & 1 deletion examples/integrations/temporal/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ npm install
```
BROWSERBASE_API_KEY=your_api_key
BROWSERBASE_PROJECT_ID=your_project_id
ANTHROPIC_API_KEY=your_anthropic_key # or OPENAI_API_KEY
OPENAI_API_KEY=your_openai_key # or ANTHROPIC_API_KEY depending on the model you choose
```

3. Start Temporal (if not already running):
Expand Down
18 changes: 12 additions & 6 deletions examples/integrations/temporal/src/research-activities.ts
Original file line number Diff line number Diff line change
Expand Up @@ -92,19 +92,25 @@ export async function initializeBrowser(): Promise<BrowserSession> {
simulateNetworkDisconnect('browser initialization');

const config: ConstructorParams = {
verbose: 1,
verbose: 0,
domSettleTimeoutMs: 8000,
env: "BROWSERBASE",
apiKey: process.env.BROWSERBASE_API_KEY,
modelName: "openai/gpt-4o",
modelClientOptions: {
apiKey: process.env.OPENAI_API_KEY,
},
browserbaseSessionCreateParams: {
proxies: true,
// Only available in paid plans
// proxies: true,
projectId: process.env.BROWSERBASE_PROJECT_ID!,
browserSettings: {
viewport: {
width: 1024,
height: 768
},
advancedStealth: true
// Only available on Scale Plans
// advancedStealth: true
}
},
};
Expand Down Expand Up @@ -172,9 +178,9 @@ export async function navigateToSearchPage(session: BrowserSession): Promise<voi

stagehand = await reconnectToSession(session);

console.log(`[${session.attemptId}] Navigating to Google...`);
await stagehand.page.goto('https://www.google.com');
console.log(`[${session.attemptId}] Successfully navigated to Google`);
console.log(`[${session.attemptId}] Navigating to Brave...`);
await stagehand.page.goto('https://search.brave.com/');
console.log(`[${session.attemptId}] Successfully navigated to Brave`);

} catch (error: any) {
console.error(`[${session.attemptId}] Navigation failed:`, error.message);
Expand Down