Skip to content

Commit 7e0cf6f

Browse files
reverting more files except test folder
1 parent b3ea794 commit 7e0cf6f

File tree

5 files changed

+9
-348
lines changed

5 files changed

+9
-348
lines changed

.env.example

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,4 @@ MODEL_API_KEY = "your-favorite-llm-api-key"
22
BROWSERBASE_API_KEY = "browserbase-api-key"
33
BROWSERBASE_PROJECT_ID = "browserbase-project-id"
44
STAGEHAND_API_URL = "api_url"
5-
STAGEHAND_ENV= "LOCAL or BROWSERBASE"
5+
STAGEHAND_ENV= "LOCAL or BROWSERBASE"

run_integration_tests.sh

Lines changed: 0 additions & 306 deletions
This file was deleted.

stagehand/handlers/extract_handler.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -166,4 +166,4 @@ async def _extract_page_text(self) -> ExtractResult:
166166

167167
tree = await get_accessibility_tree(self.stagehand_page, self.logger)
168168
output_string = tree["simplified"]
169-
return ExtractResult(data=output_string)
169+
return ExtractResult(data=output_string)

stagehand/main.py

Lines changed: 6 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -88,27 +88,7 @@ def __init__(
8888
self.wait_for_captcha_solves = self.config.wait_for_captcha_solves
8989
self.system_prompt = self.config.system_prompt
9090
self.verbose = self.config.verbose
91-
92-
# Smart environment detection
93-
if self.config.env:
94-
self.env = self.config.env.upper()
95-
else:
96-
# Auto-detect environment based on available configuration
97-
has_browserbase_config = bool(
98-
self.browserbase_api_key and self.browserbase_project_id
99-
)
100-
has_local_config = bool(self.config.local_browser_launch_options)
101-
102-
if has_local_config and not has_browserbase_config:
103-
# Local browser options specified but no Browserbase config
104-
self.env = "LOCAL"
105-
elif not has_browserbase_config and not has_local_config:
106-
# No configuration specified, default to LOCAL for easier local development
107-
self.env = "LOCAL"
108-
else:
109-
# Default to BROWSERBASE if Browserbase config is available
110-
self.env = "BROWSERBASE"
111-
91+
self.env = self.config.env.upper() if self.config.env else "BROWSERBASE"
11292
self.local_browser_launch_options = (
11393
self.config.local_browser_launch_options or {}
11494
)
@@ -218,14 +198,9 @@ def cleanup_handler(sig, frame):
218198
return
219199

220200
self.__class__._cleanup_called = True
221-
if self.env == "BROWSERBASE":
222-
print(
223-
f"\n[{signal.Signals(sig).name}] received. Ending Browserbase session..."
224-
)
225-
else:
226-
print(
227-
f"\n[{signal.Signals(sig).name}] received. Cleaning up Stagehand resources..."
228-
)
201+
print(
202+
f"\n[{signal.Signals(sig).name}] received. Ending Browserbase session..."
203+
)
229204

230205
try:
231206
# Try to get the current event loop
@@ -264,15 +239,9 @@ async def _async_cleanup(self):
264239
"""Async cleanup method called from signal handler."""
265240
try:
266241
await self.close()
267-
if self.env == "BROWSERBASE" and self.session_id:
268-
print(f"Session {self.session_id} ended successfully")
269-
else:
270-
print("Stagehand resources cleaned up successfully")
242+
print(f"Session {self.session_id} ended successfully")
271243
except Exception as e:
272-
if self.env == "BROWSERBASE":
273-
print(f"Error ending Browserbase session: {str(e)}")
274-
else:
275-
print(f"Error cleaning up Stagehand resources: {str(e)}")
244+
print(f"Error ending Browserbase session: {str(e)}")
276245
finally:
277246
# Force exit after cleanup completes (or fails)
278247
# Use os._exit to avoid any further Python cleanup that might hang

stagehand/types/__init__.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,7 @@
1414
TreeResult,
1515
)
1616
from .agent import (
17-
AgentConfig,
18-
AgentExecuteOptions,
19-
AgentResult,
17+
AgentConfig
2018
)
2119
from .llm import (
2220
ChatMessage,

0 commit comments

Comments
 (0)