Skip to content

Commit 80413be

Browse files
feat(api): manual updates
1 parent 72c5372 commit 80413be

File tree

6 files changed

+488
-196
lines changed

6 files changed

+488
-196
lines changed

.stats.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
configured_endpoints: 7
22
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/browserbase%2Fstagehand-3607b588cab78536eb7de9f6acffe8ddda1d34aebe5910c2147421aa6c16bf22.yml
33
openapi_spec_hash: fb507e8d38b4978a5717fbb144197868
4-
config_hash: 2f1ec44e7e07906e07bdc6e075763da9
4+
config_hash: fc6606301b5142487a69d296f154b265

README.md

Lines changed: 24 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -32,9 +32,13 @@ import os
3232
from stagehand import Stagehand
3333

3434
client = 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

4044
response = client.sessions.act(
@@ -44,10 +48,10 @@ response = client.sessions.act(
4448
print(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,
4852
we 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
5963
from stagehand import AsyncStagehand
6064

6165
client = 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

101109
async 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(

src/stagehand/__init__.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@
66
from ._types import NOT_GIVEN, Omit, NoneType, NotGiven, Transport, ProxiesTypes, omit, not_given
77
from ._utils import file_from_path
88
from ._client import (
9-
ENVIRONMENTS,
109
Client,
1110
Stream,
1211
Timeout,
@@ -74,7 +73,6 @@
7473
"AsyncStream",
7574
"Stagehand",
7675
"AsyncStagehand",
77-
"ENVIRONMENTS",
7876
"file_from_path",
7977
"BaseModel",
8078
"DEFAULT_TIMEOUT",

0 commit comments

Comments
 (0)