functions

โดย browserbase

ปรับใช้ระบบอัตโนมัติของเบราว์เซอร์แบบไร้เซิร์ฟเวอร์เป็นฟังก์ชันคลาวด์โดยใช้ Browserbase ใช้เมื่อผู้ใช้ต้องการปรับใช้ระบบอัตโนมัติของเบราว์เซอร์เพื่อทำงานตามกำหนดการหรือ cron,…

npx skills add https://github.com/browserbase/skills --skill functions

Browserbase Functions

Deploy serverless browser automation using the official browse CLI.

Prerequisites

Get an API key from: https://browserbase.com/settings

export BROWSERBASE_API_KEY="your_api_key"

Creating a Function Project

1. Initialize

browse functions init my-function
cd my-function

This creates:

my-function/
├── package.json
├── index.ts        # Your function code
└── .env            # Add credentials here

2. Add Credentials to .env

echo "BROWSERBASE_API_KEY=$BROWSERBASE_API_KEY" >> .env

3. Install Dependencies

pnpm install

Function Structure

import { defineFn } from "@browserbasehq/sdk-functions";
import { chromium } from "playwright-core";

defineFn("my-function", async (context) => {
  const { session, params } = context;

  // Connect to browser
  const browser = await chromium.connectOverCDP(session.connectUrl);
  const page = browser.contexts()[0]!.pages()[0]!;

  // Your automation
  await page.goto(params.url || "https://example.com");
  const title = await page.title();

  // Return JSON-serializable result
  return { success: true, title };
});

Key objects:

  • context.session.connectUrl - CDP endpoint to connect Playwright
  • context.params - Input parameters from invocation

Development Workflow

1. Start Dev Server

browse functions dev index.ts

Server runs at http://127.0.0.1:14113

2. Test Locally

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"}}'

3. Iterate

The dev server auto-reloads on file changes. Use console.log() for debugging - output appears in the terminal.

Deploying

browse functions publish index.ts

Output:

Function published successfully
Build ID: xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx
Function ID: xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx

Save the Function ID - you need it to invoke.

Quick Reference

CommandDescription
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.

Skills เพิ่มเติมจาก browserbase

optimize-agent-prompt
browserbase
สร้างและปรับปรุงเดโมของ Browserbase Agent API ผ่าน outer loop แบบ Autobrowse: รันงานที่กำหนด รวบรวมข้อความจาก Agent และบันทึกเซสชัน ให้คะแนนผลลัพธ์ ปรับปรุงฮิวริสติกของ system prompt หนึ่งรายการ และยืนยันการลู่เข้า ใช้เมื่อสร้างเดโมหรือ POC ของ Browserbase Agents ปรับปรุง system prompt ของ Agent วินิจฉัยการรันของ Agent ที่ไม่เสถียร หรือนำ auto-research/autobrowse ไปใช้กับ Browserbase Agents API
add-webmcp
browserbase
วิเคราะห์เว็บแอปพลิเคชันที่มีอยู่ ระบุความสามารถที่ผู้ใช้มองเห็นได้อย่างปลอดภัยในเส้นทาง ฟอร์ม การทำงานของเซิร์ฟเวอร์ ตัวจัดการ และสคีมา จากนั้นนำเครื่องมือ WebMCP ของบุคคลที่หนึ่งไปใช้ และตรวจสอบการค้นพบและการเรียกใช้ด้วย Stagehand ใช้เมื่อผู้ใช้ขอให้ทำให้โค้ดเบสพร้อมสำหรับเอเจนต์ เปิดเผยคุณสมบัติของเว็บไซต์เป็นเครื่องมือ WebMCP หรือเพิ่ม WebMCP ลงในแอปโดยตรงแทนที่จะสร้างสคริปต์ฉีดแบบสแตนด์อโลนจาก URL
browse
browserbase
ใช้ browse CLI สำหรับการทำงานอัตโนมัติของเบราว์เซอร์ Browserbase, คลาวด์ API ของ Browserbase, Browserbase Functions, เทมเพลต, การดึงข้อมูล/ค้นหาเว็บ, การวินิจฉัย และ Browse.sh…
browse
browserbase
ใช้ browse CLI สำหรับระบบอัตโนมัติของเบราว์เซอร์ Browserbase, คลาวด์ API ของ Browserbase, ฟังก์ชันของ Browserbase, เทมเพลต, การดึงข้อมูล/ค้นหาเว็บ, การวินิจฉัย และ Browse.sh…
browser-automation
browserbase
ใช้เครื่องมือ MCP เพื่อทำให้การโต้ตอบกับเว็บเบราว์เซอร์เป็นอัตโนมัติ ใช้เมื่อผู้ใช้ขอให้เรียกดูเว็บไซต์ นำทางหน้าเว็บ ดึงข้อมูลจากเว็บไซต์ ถ่ายภาพหน้าจอ…
functions
browserbase
แนะนำการปรับใช้ระบบอัตโนมัติของเบราว์เซอร์แบบ serverless โดยใช้ Browserbase Functions CLI อย่างเป็นทางการ ใช้เมื่อผู้ใช้ต้องการปรับใช้ระบบอัตโนมัติเพื่อทำงานบน...
agent-experience
browserbase
ตรวจสอบประสบการณ์นักพัฒนาของผลิตภัณฑ์ SDK ไซต์เอกสาร หรือ SKILL.md โดยการส่ง Claude subagents หลายตัวเข้าไปด้วย prompt งานขนาดเล็กและข้อมูลจริง…
autobrowse
browserbase
ระบบอัตโนมัติเบราว์เซอร์ที่ปรับปรุงตัวเองผ่านลูปการวิจัยอัตโนมัติ ดำเนินการงานท่องเว็บซ้ำ อ่านร่องรอย และปรับปรุงทักษะการนำทาง...