@@ -71,9 +71,9 @@ def __init__(
7171 config = service_locator .get_configuration ()
7272
7373 self ._max_open_pages_per_browser = max_open_pages_per_browser
74- self .stagehand_options = stagehand_options or StagehandOptions ()
74+ self ._stagehand_options = stagehand_options or StagehandOptions ()
7575
76- is_local = self .stagehand_options .env == 'LOCAL'
76+ is_local = self ._stagehand_options .env == 'LOCAL'
7777
7878 # browser_launch_options take priority over browser_new_context_options for shared keys.
7979 self ._browser_launch_options : dict [str , Any ] = {
@@ -93,14 +93,14 @@ def __init__(
9393 self ._stagehand_init_params : dict [str , Any ] = {
9494 'server' : 'local' if is_local else 'remote' ,
9595 'local_headless' : self ._browser_launch_options ['headless' ],
96- 'local_ready_timeout_s' : self .stagehand_options .local_ready_timeout_s ,
96+ 'local_ready_timeout_s' : self ._stagehand_options .local_ready_timeout_s ,
9797 }
98- if self .stagehand_options .model_api_key is not None :
99- self ._stagehand_init_params ['model_api_key' ] = self .stagehand_options .model_api_key
98+ if self ._stagehand_options .model_api_key is not None :
99+ self ._stagehand_init_params ['model_api_key' ] = self ._stagehand_options .model_api_key
100100
101101 if not is_local :
102- self ._stagehand_init_params ['browserbase_api_key' ] = self .stagehand_options .browserbase_api_key
103- self ._stagehand_init_params ['browserbase_project_id' ] = self .stagehand_options .project_id
102+ self ._stagehand_init_params ['browserbase_api_key' ] = self ._stagehand_options .browserbase_api_key
103+ self ._stagehand_init_params ['browserbase_project_id' ] = self ._stagehand_options .project_id
104104
105105 self ._stagehand_client : AsyncStagehand | None = None
106106 self ._playwright_context_manager = async_playwright ()
@@ -145,6 +145,11 @@ def browser_new_context_options(self) -> Mapping[str, Any]:
145145 def max_open_pages_per_browser (self ) -> int :
146146 return self ._max_open_pages_per_browser
147147
148+ @property
149+ def stagehand_options (self ) -> StagehandOptions :
150+ """Return the Stagehand-specific configuration options."""
151+ return self ._stagehand_options
152+
148153 @override
149154 async def __aenter__ (self ) -> StagehandBrowserPlugin :
150155 if self ._active :
@@ -153,7 +158,7 @@ async def __aenter__(self) -> StagehandBrowserPlugin:
153158 self ._active = True
154159 self ._playwright = await self ._playwright_context_manager .__aenter__ ()
155160
156- if self .stagehand_options .env == 'LOCAL' :
161+ if self ._stagehand_options .env == 'LOCAL' :
157162 if 'executable_path' not in self ._browser_launch_options :
158163 chrome_path = self ._playwright .chromium .executable_path
159164 self ._browser_launch_options ['executable_path' ] = chrome_path
@@ -195,6 +200,6 @@ async def new_browser(self) -> BrowserController:
195200 return StagehandBrowserController (
196201 playwright = self ._playwright ,
197202 stagehand_client = self ._stagehand_client ,
198- stagehand_options = self .stagehand_options ,
203+ stagehand_options = self ._stagehand_options ,
199204 max_open_pages_per_browser = self ._max_open_pages_per_browser ,
200205 )
0 commit comments