Migrate an app from Browser Use to Browserbase running on Composio Instant (toolkit `browserbase_tool`, tools `BROWSERBASE_TOOL_*`). Covers apps that call Composio's `BROWSER_USE_*` tools, Browser Use Cloud (REST or SDK), Browser Use browsers over CDP, the open-source `browser-use` library, and Browser Use MCP or n8n setups. Use when asked to move a browser agent, live view or sign-in hand-off off Browser Use onto Browserbase through Composio, with no Browserbase account of your own.
Installs into .claude/skills of the current project.
Sponsors
SSkills DirectorySkills Directory
Know which skills are safe — weekly.
SSkills DirectorySkills Directory
Is that skill safe to install?
Are you the author of Migrate Browser Use To Browserbase?
Add the live security badge to your README. It updates with every re-scan.
[](https://www.skillsdirectory.com/skills/gabrielmoreira-migrate-browser-use-to-browserbase)
---
name: migrate-browser-use-to-browserbase
description: Migrate an app from Browser Use to Browserbase running on Composio Instant (toolkit `browserbase_tool`, tools `BROWSERBASE_TOOL_*`). Covers apps that call Composio's `BROWSER_USE_*` tools, Browser Use Cloud (REST or SDK), Browser Use browsers over CDP, the open-source `browser-use` library, and Browser Use MCP or n8n setups. Use when asked to move a browser agent, live view or sign-in hand-off off Browser Use onto Browserbase through Composio, with no Browserbase account of your own.
---
# Migrate Browser Use to Browserbase on Composio Instant
You are moving an app's browser agent from Browser Use to Browserbase, run through Composio
Instant. Instant runs Browserbase on Composio's account and bills the Composio project's prepaid
balance: the app needs only its `COMPOSIO_API_KEY`, no Browserbase key. Browserbase runs its own
agent: task text carries over, but there is no model choice and no step budget.
Work in order: inventory, plan, check schemas, rewrite, verify. Ask the user before any paid test.
## Reference flow
Every call goes through one tool router session. `execute` returns `{data, error, log_id, result_type}`;
stop unless the status is 2xx, `error` is empty and `result_type` is `"completed"`.
```
POST {host}/api/v3.1/tool_router/session {"user_id": U, "toolkits": {"enable": ["browserbase_tool"]}}
-> session_id = S
once per user: BROWSERBASE_TOOL_CREATE_CONTEXT {} -> data.id = P (store it with the user)
POST .../session/S/execute BROWSERBASE_TOOL_RUN_AGENT {"task": T, "profile_id": P}
-> data.runId = R
loop every 3 s: BROWSERBASE_TOOL_GET_RUN {"run_id": R}
-> status; sessionId once the browser is up; result.summary when COMPLETED; cause on failure
BROWSERBASE_TOOL_LIST_RUN_MESSAGES {"run_id": R, "since": M, "limit": 100} -> data[], nextSince = M (a message ID string; omit on the first call)
first time sessionId appears: BROWSERBASE_TOOL_GET_SESSION_DEBUG_URLS {"session_id": sessionId}
-> live_url (keep this first one; append &navbar=false)
stop: BROWSERBASE_TOOL_STOP_RUN {"run_id": R}, then GET_RUN until STOPPED
sign out: BROWSERBASE_TOOL_DELETE_CONTEXT {"profile_id": P}
```
## 1. Inventory every Browser Use touchpoint
Search the whole repo, including README, `AGENTS.md`, `CLAUDE.md`, `.env.example`, config and UI
text (skip `node_modules`, build output and installed skills), for each pattern below:
| Look for | What it is |
|---|---|
| `BROWSER_USE_`, `BROWSER_TOOL_`, `"browser_use"`, `"browser_tool"` | Composio `browser_use` / `browser_tool` toolkit |
| `api.browser-use.com`, `browser_use_sdk`, `browser-use-sdk`, `BROWSER_USE_API_KEY` | Browser Use Cloud REST or SDK |
| `from browser_use`, `import browser_use`, a `browser-use` dependency | The open-source `browser-use` library |
| `--cli-mcp`, `@browser_use/pi`, `n8n-nodes-browser-use` | Browser Use MCP server, pi or n8n |
| `connect_over_cdp`, `connectOverCDP`, `cdp_url`, `cdpUrl`, `Page.startScreencast`, `Input.dispatch`, `/json/list` | A browser driven over CDP, or a CDP screencast used as a live view |
| `live_view_url`, `keep_alive`, `max_cost_usd`, and `model` or `session_id` passed to Browser Use calls | Browser Use run fields |
| "Browser Use" in prose | Docs or UI text to reword for the new provider |
Also read the code: wrappers and string-built URLs can hide a call. Group findings into
workflows (start a task, poll, show progress, live view, sign-in wait, stop, sign out) and say
what each becomes before you edit. Each kind of finding maps to a section of step 5.
## 2. Decisions to make first
- **End-user ID.** Use the app's own signed-in user ID as the Composio `user_id`. With no accounts
(one shared login, anonymous visitors), create a random ID per chat or visitor and keep it in
their state. Never one shared ID: browsers and profiles would be shared between people.
- **Where the profile ID lives.** Next to that user (database row or chat state). Lose it and the
user loses their sign-in, and the old profile is never deleted.
- **Composio host.** Read it from an env var (keep the app's existing name if it has one,
otherwise `COMPOSIO_BASE_URL`; default `https://backend.composio.dev`).
- **How the session reaches Instant.** With Instant on for the project, a session runs a tool on
Instant when the user has no connection of their own for that toolkit; nothing extra goes in
the session body. If users may have their own connection, force Instant as below.
- **Call Instant explicitly.** Through a tool router session (`POST /api/v3.1/tool_router/session`,
then `/{id}/execute`), or the SDK with `account="instant_account"` (Python) /
`{ account: "instant_account" }` (TypeScript). Unpinned tool listings can serve an older version
with different argument names.
- **Enable the new toolkit.** Change the session's toolkit list (`toolkits.enable`) from
`browser_use` to the new toolkit. With the SDK's direct execute, also pass the Instant account.
- **Check success explicitly.** The session execute response is
`{data, error, log_id, result_type}` with no `successful` field (that field belongs to the
direct `tools.execute` API). A call succeeded only when the HTTP status is 2xx, `error` is
empty **and** `result_type` is `"completed"` (`resultType` in the TypeScript SDK).
Many refusals come back as HTTP 200 with an `error` string (a refused field, or a provider
404); some as HTTP 4xx (6602 refused ID, 6604 tool not allowed on Instant). Check both, and
match provider codes in the `error` text. A run
succeeded only when its status is `COMPLETED`. A failed run can still carry text.
## 3. Check the live schemas
Before writing code, read each tool you will call from
`GET https://backend.composio.dev/api/v3.1/tools/<SLUG>` (header `x-api-key`), or
`composio execute <SLUG> --get-schema`. Never guess an argument name.
## 4. Tool map (Composio `BROWSER_USE_*` → Browserbase)
| Browser Use | Browserbase | Change |
|---|---|---|
| (none) | `BROWSERBASE_TOOL_CREATE_CONTEXT {}` | Browserbase calls a profile a *context*. One per end user, once. Store `id`. |
| `BROWSER_USE_START_RUN` | `BROWSERBASE_TOOL_RUN_AGENT` | Send `task`, `profile_id`, optional `resultSchema`, `pauseWhen`, `variables`. Remove `model`, `max_cost_usd`, `keep_alive`, `session_id`: each is refused with an error. |
| `BROWSER_USE_GET_RUN` / `GET_RUN_STATUS` | `BROWSERBASE_TOOL_GET_RUN {run_id}` | Fields are top level: no `run` wrapper. |
| `BROWSER_USE_LIST_RUN_EVENTS` | `BROWSERBASE_TOOL_LIST_RUN_MESSAGES {run_id, since, limit}` | `limit` ≤ 100. Read `data[]` and pass `nextSince` back as `since`. |
| `live_view_url` | `BROWSERBASE_TOOL_GET_SESSION_DEBUG_URLS {session_id}` | `session_id` = the run's `sessionId` from `GET_RUN`. Read `live_url` and `pages[]`. |
| `BROWSER_USE_CANCEL_RUN` | `BROWSERBASE_TOOL_STOP_RUN {run_id}` | Also closes the run's browser. |
| (none) | `BROWSERBASE_TOOL_RESUME_RUN {run_id, task}` | Continue a `PAUSED` run. |
| `BROWSER_USE_QUEUE_SESSION_MESSAGE` | `RESUME_RUN` on a paused run, or a new `RUN_AGENT` with the same `profile_id` | A finished run's browser is gone; cookies come back from the profile, open tabs don't. |
| forgetting a session to sign out | `BROWSERBASE_TOOL_DELETE_CONTEXT {profile_id}` | New profile next time. |
| `CREATE/GET/STOP_BROWSER_SESSION` | `CREATE_SESSION` / `GET_SESSION` / `RELEASE_SESSION` | Only for apps that drive the browser themselves (CDP). `timeout` (60 to 21600 s) or `timeoutMinutes` is required on Instant. |
### IDs
- Run ID: `data.runId` (`data.id` is the same). Control calls (`GET_RUN`, `STOP_RUN`, `RESUME_RUN`,
`LIST_RUN_MESSAGES`) take it as `run_id`.
- Browser session ID: `sessionId` on `GET_RUN`, present once the browser is up. Browser calls
take it as `session_id`.
- On Instant every ID is signed to your user. Always pass IDs back exactly as returned, even
though some tool schemas describe `run_id` as a UUID.
- A made-up or wrong ID gets the same refusal (6602) as another user's ID: treat it as "not
yours or not found". `DELETE_CONTEXT` on a profile that is already gone returns 404: treat that
as signed out.
- Don't send `projectId` on any call (`CREATE_CONTEXT` and `CREATE_SESSION` list it, but Instant
uses Composio's project).
## 5. Rewrite by kind of integration
### Composio Browser Use toolkit
Apply the tool map. Then map the responses:
- Status: `PENDING`, `RUNNING` → running; `PAUSED` → waiting for the user; `COMPLETED` → done;
`FAILED`, `TIMED_OUT` → failed; `STOPPED` → cancelled.
- Result: `result.summary` (text) and `result.output` (shaped by `resultSchema`). Errors:
`cause.message`, `cause.code`.
- Messages: each item is `{id, createdAt, message: {role, content}}`. `content` is a string or a
list of parts: `text` (the agent talking), `tool-call` (`toolName`, `input`), `tool-result`.
Name steps from `toolName` (`goto` → "Open <host>", `click`, `type`, `pageEvaluate` → "Read the
page", `done` → "Wrap up"). There are no completion events: take status from `GET_RUN`.
- Current page: `pages[].url` / `pages[].title` from `GET_SESSION_DEBUG_URLS` (skip `about:`
pages). Replaces parsing `[state] Title | URL` lines.
- A simple task may be answered with a plain page fetch and no browser, so `sessionId` and the
live view never appear. That is normal.
### Browser Use Cloud (REST or SDK)
Replace the client with Composio calls through the tool map. A blocking SDK helper
(`wait_for_completion`, `client.run`) becomes a poll loop on `GET_RUN` with a deadline; on timeout
call `STOP_RUN`, then read `GET_RUN` until it is terminal. A structured output schema maps
directly to `resultSchema`; still validate `result.output` in app code. Secrets the agent needs go
in `variables`, not task text. Remove `BROWSER_USE_API_KEY` and the SDK dependency.
### CDP
For a Browser Use browser driven by Playwright or your own code: create it with
`BROWSERBASE_TOOL_CREATE_SESSION {timeoutMinutes}` and connect to `connectUrl`; close it with
`RELEASE_SESSION` in a `finally` block. For CDP screencast/input code used as a live view, see
step 7.
### Open-source library
Either keep the library and point it at a Browserbase browser (`connectUrl` as its CDP URL; check
your version accepts one), or remove it and run hosted runs with `RUN_AGENT`. Custom actions
(`@tools.action`) don't move to a hosted run: run them in app code before or after. Record the
choice.
### MCP, pi or n8n
Replace the Browser Use MCP config with a Composio MCP server that includes the
`browserbase_tool` toolkit. If the app must force Instant or cap spend per call, call tools from
app code instead of handing them to a model. For n8n, use an HTTP Request node to the tool router
execute endpoint.
## 6. Sign-in persistence and the sign-in wait
Browser Use kept a browser open (`keep_alive` + reused session). Browserbase gives each run a fresh
browser, so keep sign-ins in the profile: pass the same `profile_id` on every run for that user.
Cookies save when the run's browser closes. Remove per-mode browser bookkeeping.
Replace "wait N seconds for the user to sign in" task text with pause and resume:
1. Start the run with `pauseWhen`, e.g. `"<Site> shows a sign-in, join, security check or
verification code page that only the user can complete"`. In the task, tell the agent to open
the sign-in page before pausing and never to type into sign-in forms.
2. While `GET_RUN` is `PAUSED` and the open page is a sign-in URL, show a sign-in prompt with the
live view in control mode.
3. When the open page is no longer a sign-in URL, call `RESUME_RUN` once with
`task: "The user has finished signing in. Carry on with the original task: <task>"`.
`GET_RUN.updatedAt` stays fixed while paused: use it to tell pauses apart (never resume the
same pause twice) and to time the wait.
4. Past your limit (e.g. 4 minutes), call `STOP_RUN` and report that sign-in is needed.
An app with no sign-in flow should not pass `pauseWhen`. If a run is `PAUSED` anyway, stop it
and report why.
## 7. Live view
Delete CDP screencast and input code (`/json/list`, `Page.startScreencast`,
`Input.dispatchMouseEvent`, `Input.dispatchKeyEvent`). Embed `live_url`:
```html
<iframe src="{live_url}&navbar=false" sandbox="allow-same-origin allow-scripts"
allow="clipboard-read; clipboard-write" style="width:1280px;height:800px;border:0"></iframe>
```
- `GET_SESSION_DEBUG_URLS` returns a new URL on every call. Keep the first one for the run, or the
frame reloads on every poll.
- It is interactive. For watch-only, cover it with a transparent element that takes pointer
events; remove it when the user takes control. Scale with CSS.
- Before `GET_RUN` returns a `sessionId`, the browser's state is unknown, not closed. Mark it
closed only when the debug URL call fails or the run has ended.
- The URL has no auth of its own: give it only to the user who owns the run; never log it.
## 8. Models, cost and limits
- Model pickers (Fast / Accurate): Browserbase picks the model. Collapse to one mode.
- `max_cost_usd`: no per-run cap. Price: **$0.25 per `RUN_AGENT` and $0.25 per `RESUME_RUN`**.
Reads, stops, messages, live view and profile calls: $0. Standalone `CREATE_SESSION` (CDP only):
$0.12 per browser hour for the timeout you set, at start. `GET_RUN_USAGE {run_id}` shows the
run's model usage (not what Composio billed).
- Refused on Instant: `agentId`, proxies, verified/stealth mode, extensions, `projectId`. List any
the app relied on as a gap.
- Files: read run downloads with `LIST_DOWNLOADS` on the run's `sessionId`.
## 9. Keep it safe
- One Composio `user_id` per end user, reused. Every profile, run and session ID is signed to the
user that created it; another user's ID, or an ID with its signature stripped, is refused before
it reaches Browserbase (code 6602 or just "Invalid arguments": treat both as refused).
- Never put passwords in task text, `variables` or chat; the user signs in in the live view.
- Update README, "how it works" pages and `.env.example` too.
## 10. Verify
1. Type-check and build (for a plain script, compile it).
2. Search again for the step 1 patterns. Anything
left must be deliberate; list it. Don't leave Browser Use field names in comments.
3. One plain run ("Open https://example.com and tell me the page title"): status reaches
`COMPLETED` and `result.summary` shows.
4. Stop works: start a run, call `STOP_RUN`, read `GET_RUN` until `STOPPED`.
5. If the app has a sign-in flow: one run on a site that needs sign-in, without signing in; the run
pauses, the prompt and live view show, and it is stopped at the limit.
6. Clean up: stop every run, delete every test profile.
Report: changed files, each Browser Use feature and its replacement, gaps, spend, check results.