@@ -32,9 +32,13 @@ import os
3232from stagehand import Stagehand
3333
3434client = Stagehand(
35- api_key = os.environ.get(" STAGEHAND_API_KEY" ), # This is the default and can be omitted
36- # or 'production' | 'local'; defaults to "production".
37- environment = " dev" ,
35+ browserbase_api_key = os.environ.get(
36+ " BROWSERBASE_API_KEY"
37+ ), # This is the default and can be omitted
38+ browserbase_project_id = os.environ.get(
39+ " BROWSERBASE_PROJECT_ID"
40+ ), # This is the default and can be omitted
41+ model_api_key = os.environ.get(" MODEL_API_KEY" ), # This is the default and can be omitted
3842)
3943
4044response = client.sessions.act(
@@ -44,10 +48,10 @@ response = client.sessions.act(
4448print (response.actions)
4549```
4650
47- While you can provide an ` api_key ` keyword argument,
51+ While you can provide a ` browserbase_api_key ` keyword argument,
4852we recommend using [ python-dotenv] ( https://pypi.org/project/python-dotenv/ )
49- to add ` STAGEHAND_API_KEY ="My API Key"` to your ` .env ` file
50- so that your API Key is not stored in source control.
53+ to add ` BROWSERBASE_API_KEY ="My Browserbase API Key"` to your ` .env ` file
54+ so that your Browserbase API Key is not stored in source control.
5155
5256## Async usage
5357
@@ -59,9 +63,13 @@ import asyncio
5963from stagehand import AsyncStagehand
6064
6165client = AsyncStagehand(
62- api_key = os.environ.get(" STAGEHAND_API_KEY" ), # This is the default and can be omitted
63- # or 'production' | 'local'; defaults to "production".
64- environment = " dev" ,
66+ browserbase_api_key = os.environ.get(
67+ " BROWSERBASE_API_KEY"
68+ ), # This is the default and can be omitted
69+ browserbase_project_id = os.environ.get(
70+ " BROWSERBASE_PROJECT_ID"
71+ ), # This is the default and can be omitted
72+ model_api_key = os.environ.get(" MODEL_API_KEY" ), # This is the default and can be omitted
6573)
6674
6775
@@ -100,7 +108,13 @@ from stagehand import AsyncStagehand
100108
101109async def main () -> None :
102110 async with AsyncStagehand(
103- api_key = os.environ.get(" STAGEHAND_API_KEY" ), # This is the default and can be omitted
111+ browserbase_api_key = os.environ.get(
112+ " BROWSERBASE_API_KEY"
113+ ), # This is the default and can be omitted
114+ browserbase_project_id = os.environ.get(
115+ " BROWSERBASE_PROJECT_ID"
116+ ), # This is the default and can be omitted
117+ model_api_key = os.environ.get(" MODEL_API_KEY" ), # This is the default and can be omitted
104118 http_client = DefaultAioHttpClient(),
105119 ) as client:
106120 response = await client.sessions.act(
0 commit comments