Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
124 changes: 0 additions & 124 deletions docs/references/constructor.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -258,127 +258,3 @@ After calling `stagehand.init()`, you receive an `InitResult` object:
<ParamField path="sessionId" type="string" required>
Unique identifier for the browser session.
</ParamField>

### Code Examples

<Tabs>
<Tab title="Browserbase">

<CodeGroup>
```typescript TypeScript
import { Stagehand } from "@browserbasehq/stagehand";

const stagehand = new Stagehand({
env: "BROWSERBASE",
apiKey: process.env.BROWSERBASE_API_KEY,
projectId: process.env.BROWSERBASE_PROJECT_ID,
verbose: 1,
});

const { sessionUrl } = await stagehand.init();
console.log(`View session at: ${sessionUrl}`);
```

```python Python
from stagehand import Stagehand
import os

stagehand = Stagehand(
env="BROWSERBASE",
api_key=os.environ["BROWSERBASE_API_KEY"],
project_id=os.environ["BROWSERBASE_PROJECT_ID"],
verbose=1,
)

result = await stagehand.init()
print(f"View session at: {result.session_url}")
```
</CodeGroup>

</Tab>
<Tab title="Local Development">

<CodeGroup>
```typescript TypeScript
import { Stagehand } from "@browserbasehq/stagehand";

const stagehand = new Stagehand({
env: "LOCAL",
verbose: 2,
localBrowserLaunchOptions: {
headless: false,
},
});

const { debugUrl, sessionId } = await stagehand.init();
console.log(`Session: ${sessionId}`);
```

```python Python
from stagehand import Stagehand

stagehand = Stagehand(
env="LOCAL",
verbose=2,
local_browser_launch_options={
"headless": False,
},
)

result = await stagehand.init()
print(f"Session: {result.session_id}")
```
</CodeGroup>

</Tab>
<Tab title="Advanced Configuration">

<CodeGroup>
```typescript TypeScript
import { Stagehand } from "@browserbasehq/stagehand";

const stagehand = new Stagehand({
env: "LOCAL",
modelName: "gpt-4o",
domSettleTimeoutMs: 15000,
enableCaching: true,
selfHeal: true,
experimental: true,
localBrowserLaunchOptions: {
headless: false,
args: ['--no-sandbox', '--disable-setuid-sandbox'],
viewport: { width: 1920, height: 1080 },
ignoreHTTPSErrors: true,
},
systemPrompt: "You are a helpful web automation assistant.",
logInferenceToFile: true,
});

await stagehand.init();
```

```python Python
from stagehand import Stagehand

stagehand = Stagehand(
env="LOCAL",
model_name="gpt-4o",
dom_settle_timeout_ms=15000,
enable_caching=True,
self_heal=True,
experimental=True,
local_browser_launch_options={
"headless": False,
"args": ['--no-sandbox', '--disable-setuid-sandbox'],
"viewport": {"width": 1920, "height": 1080},
"ignore_https_errors": True,
},
system_prompt="You are a helpful web automation assistant.",
)

await stagehand.init()
```
</CodeGroup>

</Tab>
</Tabs>