[docs]: fix userDataDir example for Browserbase sessions#1654
Merged
Conversation
userDataDir is not a valid browserbaseSessionCreateParams property. For Browserbase, use browserSettings.context for persistence instead. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
|
Contributor
There was a problem hiding this comment.
No issues found across 1 file
Confidence score: 5/5
- Automated review surfaced no issues in the provided summaries.
- No files require special attention.
Architecture diagram
sequenceDiagram
participant App as Application Code
participant SDK as Stagehand SDK
participant FS as Local FileSystem
participant BB as Browserbase API
participant Context as Browserbase Context Store
Note over App,Context: Session Initialization & Data Persistence Flow
App->>SDK: new Stagehand(options)
App->>SDK: init()
alt env: "LOCAL"
SDK->>SDK: Parse localBrowserLaunchOptions
SDK->>FS: Access userDataDir (Path)
SDK->>SDK: Launch Playwright/Puppeteer
Note right of SDK: Browser reads/writes profile<br/>data to local directory
else env: "BROWSERBASE"
SDK->>SDK: Parse browserbaseSessionCreateParams
SDK->>BB: POST /sessions (browserSettings.context)
activate BB
alt Context ID provided
BB->>Context: Retrieve/Lock persistent state
Context-->>BB: Session state loaded
else persist: true
BB->>Context: Create new persistent volume
end
BB-->>SDK: HTTP 201 (sessionId, debuggerUrl)
deactivate BB
SDK->>SDK: Connect to Remote CDP
end
SDK-->>App: Session Ready
loop During Session
App->>SDK: execute actions (act, extract, etc)
opt env: "BROWSERBASE"
SDK->>BB: Commands via WebSocket
BB->>Context: Sync browser state (async)
end
end
App->>SDK: close()
alt env: "BROWSERBASE"
SDK->>BB: Terminate Session
BB->>Context: Flush & Save State
end
Contributor
Greptile OverviewGreptile SummaryCorrected user data persistence documentation by removing invalid
Confidence Score: 5/5
Important Files Changed
Sequence DiagramsequenceDiagram
participant User
participant Stagehand
participant LocalBrowser
participant Browserbase
alt Local Session (userDataDir)
User->>Stagehand: new Stagehand({env: "LOCAL", localBrowserLaunchOptions: {userDataDir}})
Stagehand->>LocalBrowser: Launch with userDataDir
LocalBrowser-->>Stagehand: Browser ready with persisted data
end
alt Browserbase Session (contexts)
User->>Stagehand: new Stagehand({env: "BROWSERBASE", browserbaseSessionCreateParams: {browserSettings: {context}}})
Stagehand->>Browserbase: Create session with context.id
Browserbase-->>Stagehand: Session ready with persisted context
end
User->>Stagehand: init()
Stagehand-->>User: Session ready
|
pirate
approved these changes
Feb 4, 2026
Contributor
Author
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
userDataDirfrombrowserbaseSessionCreateParamsexample (never a valid option)browserSettings.contextfor persistenceContext
The documentation incorrectly showed
userDataDiras a validbrowserbaseSessionCreateParamsproperty. Per the schema in/packages/core/lib/v3/types/public/api.ts,userDataDiris only valid inLocalBrowserLaunchOptionsforenv: "LOCAL"sessions.For Browserbase persistence, users should use
browserSettings.contextinstead.Test plan
🤖 Generated with Claude Code
Summary by cubic
Fixed docs for user data persistence by removing the invalid userDataDir example for Browserbase sessions and showing the correct contexts-based approach. Split guidance into Local vs Browserbase to reduce confusion.
Written for commit 1166b79. Summary will update on new commits. Review in cubic