Skip to content

Commit 5253c79

Browse files
add two params to config and fix test
1 parent b80a175 commit 5253c79

2 files changed

Lines changed: 13 additions & 5 deletions

File tree

stagehand/config.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,8 @@ class StagehandConfig(BaseModel):
3030
headless (bool): Run browser in headless mode
3131
system_prompt (Optional[str]): System prompt to use for LLM interactions.
3232
local_browser_launch_options (Optional[dict[str, Any]]): Local browser launch options.
33+
use_api (bool): Whether to use API mode.
34+
experimental (bool): Enable experimental features.
3335
"""
3436

3537
env: Literal["BROWSERBASE", "LOCAL"] = "BROWSERBASE"
@@ -94,6 +96,12 @@ class StagehandConfig(BaseModel):
9496
alias="localBrowserLaunchOptions",
9597
description="Local browser launch options",
9698
)
99+
use_api: bool = Field(
100+
True, alias="useAPI", description="Whether to use API mode"
101+
)
102+
experimental: bool = Field(
103+
False, description="Enable experimental features"
104+
)
97105

98106
model_config = ConfigDict(populate_by_name=True)
99107

tests/integration/api/test_core_api.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ def browserbase_config(self):
3333
@pytest_asyncio.fixture
3434
async def stagehand_api(self, browserbase_config):
3535
"""Create a Stagehand instance for BROWSERBASE API testing"""
36-
if not (os.getenv("BROWSERBASE_API_KEY") and os.getenv("BROWSERBASE_PROJECT_ID") and os.getenv("STAGEHAND_URL_API")):
36+
if not (os.getenv("BROWSERBASE_API_KEY") and os.getenv("BROWSERBASE_PROJECT_ID") and os.getenv("STAGEHAND_API_URL")):
3737
pytest.skip("Browserbase credentials and API URL not available")
3838

3939
stagehand = Stagehand(config=browserbase_config)
@@ -45,7 +45,7 @@ async def stagehand_api(self, browserbase_config):
4545
@pytest.mark.integration
4646
@pytest.mark.api
4747
@pytest.mark.skipif(
48-
not (os.getenv("BROWSERBASE_API_KEY") and os.getenv("BROWSERBASE_PROJECT_ID") and os.getenv("STAGEHAND_URL_API")),
48+
not (os.getenv("BROWSERBASE_API_KEY") and os.getenv("BROWSERBASE_PROJECT_ID") and os.getenv("STAGEHAND_API_URL")),
4949
reason="Browserbase credentials and API URL are not available for API integration tests",
5050
)
5151
async def test_stagehand_api_initialization(self, stagehand_api):
@@ -56,7 +56,7 @@ async def test_stagehand_api_initialization(self, stagehand_api):
5656
@pytest.mark.integration
5757
@pytest.mark.api
5858
@pytest.mark.skipif(
59-
not (os.getenv("BROWSERBASE_API_KEY") and os.getenv("BROWSERBASE_PROJECT_ID") and os.getenv("STAGEHAND_URL_API")),
59+
not (os.getenv("BROWSERBASE_API_KEY") and os.getenv("BROWSERBASE_PROJECT_ID") and os.getenv("STAGEHAND_API_URL")),
6060
reason="Browserbase credentials and API URL are not available for API integration tests",
6161
)
6262
async def test_api_observe_and_act_workflow(self, stagehand_api):
@@ -97,7 +97,7 @@ async def test_api_observe_and_act_workflow(self, stagehand_api):
9797
@pytest.mark.integration
9898
@pytest.mark.api
9999
@pytest.mark.skipif(
100-
not (os.getenv("BROWSERBASE_API_KEY") and os.getenv("BROWSERBASE_PROJECT_ID") and os.getenv("STAGEHAND_URL_API")),
100+
not (os.getenv("BROWSERBASE_API_KEY") and os.getenv("BROWSERBASE_PROJECT_ID") and os.getenv("STAGEHAND_API_URL")),
101101
reason="Browserbase credentials and API URL are not available for API integration tests",
102102
)
103103
async def test_api_basic_navigation_and_observe(self, stagehand_api):
@@ -123,7 +123,7 @@ async def test_api_basic_navigation_and_observe(self, stagehand_api):
123123
@pytest.mark.integration
124124
@pytest.mark.api
125125
@pytest.mark.skipif(
126-
not (os.getenv("BROWSERBASE_API_KEY") and os.getenv("BROWSERBASE_PROJECT_ID") and os.getenv("STAGEHAND_URL_API")),
126+
not (os.getenv("BROWSERBASE_API_KEY") and os.getenv("BROWSERBASE_PROJECT_ID") and os.getenv("STAGEHAND_API_URL")),
127127
reason="Browserbase credentials and API URL are not available for API integration tests",
128128
)
129129
async def test_api_extraction_functionality(self, stagehand_api):

0 commit comments

Comments
 (0)