Remove BROWSERBASE_PROJECT_ID requirement (#625)
* Remove BROWSERBASE_PROJECT_ID requirement The Browserbase API no longer requires a project ID to create sessions — it is inferred from the API key. Remove the env var requirement from both the TypeScript daemon and Rust CLI, and update docs accordingly. * Remove unnecessary Content-Type header since no body is sent
This commit is contained in:
@@ -1136,7 +1136,6 @@ To enable Browserbase, use the `-p` flag:
|
||||
|
||||
```bash
|
||||
export BROWSERBASE_API_KEY="your-api-key"
|
||||
export BROWSERBASE_PROJECT_ID="your-project-id"
|
||||
agent-browser -p browserbase open https://example.com
|
||||
```
|
||||
|
||||
@@ -1145,13 +1144,12 @@ Or use environment variables for CI/scripts:
|
||||
```bash
|
||||
export AGENT_BROWSER_PROVIDER=browserbase
|
||||
export BROWSERBASE_API_KEY="your-api-key"
|
||||
export BROWSERBASE_PROJECT_ID="your-project-id"
|
||||
agent-browser open https://example.com
|
||||
```
|
||||
|
||||
When enabled, agent-browser connects to a Browserbase session instead of launching a local browser. All commands work identically.
|
||||
|
||||
Get your API key and project ID from the [Browserbase Dashboard](https://browserbase.com/overview).
|
||||
Get your API key from the [Browserbase Dashboard](https://browserbase.com/overview).
|
||||
|
||||
### Browser Use
|
||||
|
||||
|
||||
@@ -82,15 +82,11 @@ pub async fn close_provider_session(session: &ProviderSession) {
|
||||
async fn connect_browserbase() -> Result<(String, Option<ProviderSession>), String> {
|
||||
let api_key = env::var("BROWSERBASE_API_KEY")
|
||||
.map_err(|_| "BROWSERBASE_API_KEY environment variable is not set")?;
|
||||
let project_id = env::var("BROWSERBASE_PROJECT_ID")
|
||||
.map_err(|_| "BROWSERBASE_PROJECT_ID environment variable is not set")?;
|
||||
|
||||
let client = reqwest::Client::new();
|
||||
let response = client
|
||||
.post("https://api.browserbase.com/v1/sessions")
|
||||
.header("Content-Type", "application/json")
|
||||
.header("X-BB-API-Key", &api_key)
|
||||
.json(&json!({ "projectId": project_id }))
|
||||
.send()
|
||||
.await
|
||||
.map_err(|e| format!("Browserbase request failed: {}", e))?;
|
||||
|
||||
@@ -120,7 +120,6 @@ Use cloud browser infrastructure when local browsers aren't available:
|
||||
```bash
|
||||
# Browserbase
|
||||
export BROWSERBASE_API_KEY="your-api-key"
|
||||
export BROWSERBASE_PROJECT_ID="your-project-id"
|
||||
agent-browser -p browserbase open https://example.com
|
||||
|
||||
# Browser Use
|
||||
|
||||
+3
-8
@@ -914,27 +914,22 @@ export class BrowserManager {
|
||||
|
||||
/**
|
||||
* Connect to Browserbase remote browser via CDP.
|
||||
* Requires BROWSERBASE_API_KEY and BROWSERBASE_PROJECT_ID environment variables.
|
||||
* Requires BROWSERBASE_API_KEY environment variable.
|
||||
*/
|
||||
private async connectToBrowserbase(): Promise<void> {
|
||||
const browserbaseApiKey = process.env.BROWSERBASE_API_KEY;
|
||||
const browserbaseProjectId = process.env.BROWSERBASE_PROJECT_ID;
|
||||
|
||||
if (!browserbaseApiKey || !browserbaseProjectId) {
|
||||
if (!browserbaseApiKey) {
|
||||
throw new Error(
|
||||
'BROWSERBASE_API_KEY and BROWSERBASE_PROJECT_ID are required when using browserbase as a provider'
|
||||
'BROWSERBASE_API_KEY is required when using browserbase as a provider'
|
||||
);
|
||||
}
|
||||
|
||||
const response = await fetch('https://api.browserbase.com/v1/sessions', {
|
||||
method: 'POST',
|
||||
headers: {
|
||||
'Content-Type': 'application/json',
|
||||
'X-BB-API-Key': browserbaseApiKey,
|
||||
},
|
||||
body: JSON.stringify({
|
||||
projectId: browserbaseProjectId,
|
||||
}),
|
||||
});
|
||||
|
||||
if (!response.ok) {
|
||||
|
||||
Reference in New Issue
Block a user