Skip to content

Commit 246dabe

Browse files
committed
centralize config-constructor
1 parent 86ef22a commit 246dabe

14 files changed

+125
-408
lines changed

README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,7 @@ def main():
135135
)
136136

137137
# Initialize Stagehand
138-
stagehand = Stagehand(config=config, server_url=os.getenv("STAGEHAND_API_URL"))
138+
stagehand = Stagehand(config=config, api_url=os.getenv("STAGEHAND_API_URL"))
139139
stagehand.init()
140140
print(f"Session created: {stagehand.session_id}")
141141

@@ -185,7 +185,7 @@ async def main():
185185
)
186186

187187
# Initialize Stagehand
188-
stagehand = Stagehand(config=config, server_url=os.getenv("STAGEHAND_API_URL"))
188+
stagehand = Stagehand(config=config, api_url=os.getenv("STAGEHAND_API_URL"))
189189
await stagehand.init()
190190
print(f"Session created: {stagehand.session_id}")
191191

@@ -239,7 +239,7 @@ def main():
239239
)
240240

241241
# Initialize Stagehand
242-
stagehand = Stagehand(config=config, server_url=os.getenv("STAGEHAND_API_URL"))
242+
stagehand = Stagehand(config=config, api_url=os.getenv("STAGEHAND_API_URL"))
243243
stagehand.init()
244244
print(f"Session created: {stagehand.session_id}")
245245

examples/agent_example.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ async def main():
6464
# Create a Stagehand client using the configuration object.
6565
stagehand = Stagehand(
6666
config=config,
67-
server_url=os.getenv("STAGEHAND_API_URL"),
67+
api_url=os.getenv("STAGEHAND_API_URL"),
6868
)
6969

7070
# Initialize - this creates a new session automatically.

examples/agent_example_sync.py

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

examples/example.py

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ async def main():
5454
project_id=os.getenv("BROWSERBASE_PROJECT_ID"),
5555
headless=False,
5656
dom_settle_timeout_ms=3000,
57-
model_name="gpt-4o-mini",
57+
model_name="google/gemini-2.0-flash",
5858
self_heal=True,
5959
wait_for_captcha_solves=True,
6060
system_prompt="You are a browser automation assistant that helps users navigate websites effectively.",
@@ -63,10 +63,7 @@ async def main():
6363
verbose=2,
6464
)
6565

66-
stagehand = Stagehand(
67-
config=config,
68-
server_url=os.getenv("STAGEHAND_API_URL"),
69-
)
66+
stagehand = Stagehand(config)
7067

7168
# Initialize - this creates a new session automatically.
7269
console.print("\n🚀 [info]Initializing Stagehand...[/]")

examples/example_sync.py

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

stagehand/__init__.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
from .agent import Agent
22
from .client import Stagehand
3-
from .config import StagehandConfig
3+
from .config import StagehandConfig, default_config
44
from .handlers.observe_handler import ObserveHandler
55
from .metrics import StagehandFunctionName, StagehandMetrics
66
from .page import StagehandPage
@@ -24,6 +24,7 @@
2424
__all__ = [
2525
"Stagehand",
2626
"StagehandConfig",
27+
"default_config",
2728
"StagehandPage",
2829
"Agent",
2930
"configure_logging",

0 commit comments

Comments
 (0)