1010from stagehand import Stagehand , StagehandConfig , AgentConfig , configure_logging
1111from stagehand .schemas import AgentExecuteOptions , AgentProvider
1212
13+ from browserbase .types import SessionCreateParams as BrowserbaseSessionCreateParams
14+
1315# Create a custom theme for consistent styling
1416custom_theme = Theme (
1517 {
2729
2830load_dotenv ()
2931
32+ browserbase_session_create_params = BrowserbaseSessionCreateParams (
33+ project_id = os .getenv ("BROWSERBASE_PROJECT_ID" ),
34+ proxies = True ,
35+ )
36+
3037# Configure logging with the utility function
3138configure_logging (
3239 level = logging .INFO , # Set to INFO for regular logs, DEBUG for detailed
@@ -40,6 +47,7 @@ async def main():
4047 # env="LOCAL",
4148 api_key = os .getenv ("BROWSERBASE_API_KEY" ),
4249 project_id = os .getenv ("BROWSERBASE_PROJECT_ID" ),
50+ browserbase_session_create_params = browserbase_session_create_params ,
4351 model_name = "gpt-4o" ,
4452 self_heal = True ,
4553 system_prompt = "You are a browser automation assistant that helps users navigate websites effectively." ,
@@ -70,7 +78,7 @@ async def main():
7078 options = {"apiKey" : os .getenv ("MODEL_API_KEY" )}
7179 )
7280 agent_result = await agent .execute (
73- instruction = "Play a game of 2048" ,
81+ instruction = "Search for the game 2048 and play one game. " ,
7482 max_steps = 20 ,
7583 auto_screenshot = True ,
7684 )
0 commit comments