// Stealth mode with proxy
const session = await bb.sessions.create({
projectId: process.env.BROWSERBASE_PROJECT_ID!,
proxies: true,
browserSettings: {
advancedStealth: true,
os: "windows",
},
});
// Long-running session with keep-alive
const session = await bb.sessions.create({
projectId: process.env.BROWSERBASE_PROJECT_ID!,
timeout: 21600, // 6 hours
keepAlive: true,
});
// Session with context persistence
const session = await bb.sessions.create({
projectId: process.env.BROWSERBASE_PROJECT_ID!,
browserSettings: {
context: {
id: "user-session-context",
persist: true,
},
},
});
// Custom viewport and ad blocking
const session = await bb.sessions.create({
projectId: process.env.BROWSERBASE_PROJECT_ID!,
browserSettings: {
viewport: { width: 1440, height: 900 },
blockAds: true,
},
});
// Mobile viewport
const session = await bb.sessions.create({
projectId: process.env.BROWSERBASE_PROJECT_ID!,
browserSettings: {
viewport: { width: 390, height: 844 },
},
});
// Session in specific region with metadata
const session = await bb.sessions.create({
projectId: process.env.BROWSERBASE_PROJECT_ID!,
region: "eu-central-1",
userMetadata: {
jobId: "job_456",
environment: "production",
},
});