16 chapters · 94 min
Skills
Chapter 12 of 16
Deploy serverless browser automation as cloud functions using Browserbase.
1 minute · 112 words · 13 sections
Deploy serverless browser automation using the official browse CLI.
Get an API key from: https://browserbase.com/settings (opens in a new tab)
export BROWSERBASE_API_KEY="your_api_key"browse functions init my-function
cd my-functionThis creates:
my-function/
├── package.json
├── index.ts # Your function code
└── .env # Add credentials hereecho "BROWSERBASE_API_KEY=$BROWSERBASE_API_KEY" >> .envpnpm installimport { defineFn } from "@browserbasehq/sdk-functions";
import { chromium } from "playwright-core";
defineFn("my-function", async (context) => {
const { session, params } = context;
// Connect to browser
const
Key objects:
context.session.connectUrl - CDP endpoint to connect Playwrightcontext.params - Input parameters from invocationbrowse functions dev index.tsServer runs at http://127.0.0.1:14113
curl -X POST http://127.0.0.1:14113/v1/functions/my-function/invoke \
-H "Content-Type: application/json" \
-d '{"params": {"url": "https://news.ycombinator.com"}}'The dev server auto-reloads on file changes. Use console.log() for debugging - output appears in the terminal.
browse functions publish index.tsOutput:
Function published successfully
Build ID: xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx
Function ID: xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxxSave the Function ID - you need it to invoke.
| Command | Description |
|---|---|
browse functions init <name> | Create new project |
browse functions dev <file> | Start local dev server |
browse functions publish <file> | Deploy to Browserbase |
For invocation examples, common patterns, and troubleshooting, see REFERENCE.md (opens in a new tab).
Install this repository
npx skills add browserbase/skills/plugin marketplace add browserbase/skillsSkills install per repository, not per chapter — the CLI has no documented per-skill form, so we do not print one.
Deploy serverless browser automation as cloud functions using Browserbase. Use when the user wants to deploy browser automation to run on a schedule or cron, create a webhook endpoint for browser tasks, run automation in the cloud instead of locally, or asks about Browserbase Functions.
The verbatim description from this skill’s front matter — the string an agent matches on to decide whether to load it.
BashReadWriteEditskills/functions/SKILL.mdmain, last pushed 5 August 2026.SKILL.md, not by matching a directory convention. One layout observed: skills/*/SKILL.md.h1 and no skipped levels:.claude-plugin/marketplace.json by Browserbase, declaring 5 plugins. It is read for editorial metadata only — never as the skill index, which is always the repository tree./browserbase/skills.md.md2 files · 5 KB
Everything this skill ships beside its prose. All of it is set here, as subchapters of chapter 12.
Everything else published alongside the skill.