-
Notifications
You must be signed in to change notification settings - Fork 662
Allow session id to be passed through env vars #760
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
If a user instantiates a browserbase session ( which would supports live view url ), this allows them to continue the session with stagehand. This is helpful for developers who want to embed the stagehand session in their product since they can now use the live view url provided by browserbase instantiation.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
PR Summary
Added support for resuming Browserbase sessions via environment variables by modifying browserbaseSessionID
configuration in stagehand.config.ts
to read from BROWSERBASE_SESSION_ID
.
- Modified
stagehand.config.ts
to readbrowserbaseSessionID
fromprocess.env.BROWSERBASE_SESSION_ID
- Enables seamless session resumption for developers embedding Stagehand in their products
- Maintains backward compatibility as environment variable defaults to
undefined
if not set - Allows reuse of live view URL from existing Browserbase sessions
💡 (1/5) You can manually trigger the bot by mentioning @greptileai in a comment!
1 file(s) reviewed, 1 comment(s)
Edit PR Review Bot Settings | Greptile
@@ -20,7 +20,7 @@ const StagehandConfig: ConstructorParams = { | |||
apiKey: process.env.BROWSERBASE_API_KEY /* API key for authentication */, | |||
projectId: process.env.BROWSERBASE_PROJECT_ID /* Project identifier */, | |||
browserbaseSessionID: | |||
undefined /* Session ID for resuming Browserbase sessions */, | |||
process.env.BROWSERBASE_SESSION_ID /* Session ID for resuming Browserbase sessions */, | |||
browserbaseSessionCreateParams: { | |||
projectId: process.env.BROWSERBASE_PROJECT_ID!, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
logic: Non-null assertion operator (!) used here could cause runtime errors if BROWSERBASE_PROJECT_ID is undefined
projectId: process.env.BROWSERBASE_PROJECT_ID!, | |
projectId: process.env.BROWSERBASE_PROJECT_ID, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
unrelated to my change
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
also the suggestion seems wrong since BROWSERBASE_PROJECT_ID
is required env var.
@kamath slack community links in readme seem to be broken so i am unable to learn more |
If a user instantiates a browserbase session ( which would support live view url ), this allows them to continue the session with stagehand.
why
This is helpful for developers who want to embed the stagehand session in their product since they can now use the live view url provided by browserbase instantiation.
what changed
Allow session id to be passed through env vars
test plan
Backward compatible change since default will still be
undefined
.