Skip to content
Merged
Show file tree
Hide file tree
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
4 changes: 4 additions & 0 deletions .github/workflows/verify.yml
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,10 @@ jobs:
runtime: node
directory: examples/typescript/getting-started-with-browserbase
command: npm install --ignore-scripts --package-lock=false && npm run typecheck
- name: Order lookup install and typecheck
runtime: node
directory: examples/typescript/order-lookup-function
command: npm ci --ignore-scripts && npm run typecheck
- name: Go dependency and compile check
runtime: go
directory: examples/go/hackernews
Expand Down
32 changes: 31 additions & 1 deletion COOKBOOK_AUTHORED.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"files": [
{
"path": "examples/README.md",
"sha256": "d4b80442ca66ab0f2c3a4d9666ff6b16bdfeed6aa4396ee76ebef5f3253ea63c",
"sha256": "43d39fb77a804337bf0f9c0df229f51d4d68dcd21b044c22fdd257b18873cd6a",
"reason": "Cookbook-authored migration, test, configuration, or collection metadata outside the pinned upstream tree."
},
{
Expand Down Expand Up @@ -481,6 +481,36 @@
"sha256": "c4fcd54c2e1b9946965ee4f87369f0b79e5b26026dfb3e5977d2babc6b191721",
"reason": "Cookbook-authored migration, test, configuration, or collection metadata outside the pinned upstream tree."
},
{
"path": "examples/typescript/order-lookup-function/.env.example",
"sha256": "3ff25e7252df7d4b76289ff5e479063de3d99e3b2ad3aec511b00eb92c97e0a2",
"reason": "Cookbook-authored migration, test, configuration, or collection metadata outside the pinned upstream tree."
},
{
"path": "examples/typescript/order-lookup-function/README.md",
"sha256": "054b1e26668656e9c99d3cd74705e64cdb458c23bbb0ae5221a529107b954256",
"reason": "Cookbook-authored migration, test, configuration, or collection metadata outside the pinned upstream tree."
},
{
"path": "examples/typescript/order-lookup-function/index.ts",
"sha256": "64b7b3ff75732e2a9d164d0af690ffa7b41b9b6b56d0d162055d16ecf5ad46a3",
"reason": "Cookbook-authored migration, test, configuration, or collection metadata outside the pinned upstream tree."
},
{
"path": "examples/typescript/order-lookup-function/package-lock.json",
"sha256": "9a6b3ae9860dbb176e5c2419aff0a7ea0ae7a97b041bb5f03939313aab749d92",
"reason": "Cookbook-authored migration, test, configuration, or collection metadata outside the pinned upstream tree."
},
{
"path": "examples/typescript/order-lookup-function/package.json",
"sha256": "1efcaf3cd530e65c218f442d5e06ec88cec3e423bda3106168e65fd681accac2",
"reason": "Cookbook-authored migration, test, configuration, or collection metadata outside the pinned upstream tree."
},
{
"path": "examples/typescript/order-lookup-function/tsconfig.json",
"sha256": "4ececca8184c89629920ea967c0055f60fc2ebd6376cde1ee8cbd3d9bb0ebbb1",
"reason": "Cookbook-authored migration, test, configuration, or collection metadata outside the pinned upstream tree."
},
{
"path": "examples/typescript/pickleball/booking-contract.ts",
"sha256": "249d22800e7f3a944fc5807bc41e4438cb09d709baf834931f35cd3ab9cf92a3",
Expand Down
125 changes: 125 additions & 0 deletions catalog.json
Original file line number Diff line number Diff line change
Expand Up @@ -14411,6 +14411,131 @@
"upstream_readme": "playbook/python/selenium/stealth/README.md",
"verification": "source-inspected",
"working_directory": "playbook/python"
},
{
"access": "public",
"caveats": [
"Uses the shared nopCommerce admin demo, which resets hourly; sample orders and availability can change.",
"Upload the matching Stagehand extension and attach API key, NOPCOMMERCE_EMAIL, and NOPCOMMERCE_PASSWORD Secrets.",
"Recordings and model-visible page content can contain sample customer details; returned fields exclude contact data.",
"Only read-only order lookup is supported; production callers must enforce customer/order authorization.",
"Missing orders and site failures return unavailable; never infer nonexistence from an unavailable result."
],
"collection": "examples",
"dependencies": {
"@browserbasehq/sdk-functions": "1.0.3",
"@browserbasehq/stagehand": "4.1.0",
"dotenv": "^16.4.5",
"playwright-core": "1.55.0",
"zod": "4.4.3"
},
"entrypoints": [
"examples/typescript/order-lookup-function/index.ts"
],
"environment_setup_command": "test -f .env || cp .env.example .env",
"environment_template": "examples/typescript/order-lookup-function/.env.example",
"environment_variables": [
{
"name": "BROWSERBASE_API_KEY",
"provider": "Browserbase",
"purpose": "Connects to the Function-managed session and the Browserbase Model Gateway.",
"requirement": "required",
"secret": true,
"default": null,
"safe_example": "<set-locally>",
"setup_url": "https://www.browserbase.com/settings",
"validation": "Non-empty; attach as a Function Secret for deployed runs or set locally in .env"
},
{
"name": "NOPCOMMERCE_EMAIL",
"provider": "nopCommerce",
"purpose": "Admin demo login email.",
"requirement": "required",
"secret": true,
"default": null,
"safe_example": "<set-locally>",
"setup_url": "https://admin-demo.nopcommerce.com/login",
"validation": "Non-empty; attach as a Function Secret for deployed runs or set locally in .env"
},
{
"name": "NOPCOMMERCE_PASSWORD",
"provider": "nopCommerce",
"purpose": "Admin demo login password.",
"requirement": "required",
"secret": true,
"default": null,
"safe_example": "<set-locally>",
"setup_url": "https://admin-demo.nopcommerce.com/login",
"validation": "Non-empty; attach as a Function Secret for deployed runs or set locally in .env"
}
],
"frameworks": [
"Stagehand",
"Playwright",
"Browserbase Functions"
],
"id": "examples-typescript-order-lookup-function",
"languages": [
"typescript"
],
"lifecycle": "current",
"manifests": [
"examples/typescript/order-lookup-function/package.json",
"examples/typescript/order-lookup-function/package-lock.json"
],
"path": "examples/typescript/order-lookup-function",
"readme": "docs/recipes/examples-typescript-order-lookup-function.md",
"run_commands": [
"npm run dev"
],
"search_aliases": [
"AI support agent",
"order lookup",
"merchant portal",
"nopCommerce",
"context.secrets"
],
"setup_commands": [
"npm ci --ignore-scripts"
],
"source": {
"kind": "cookbook-authored",
"path": "examples/typescript/order-lookup-function"
},
"summary": "Log into the nopCommerce admin demo, look up an order, and return structured fulfillment data and a session replay.",
"tags": [
"functions",
"secrets",
"stagehand-v4",
"order-lookup"
],
"title": "Order lookup for AI support with Functions and Secrets (TypeScript)",
"topics": [
"authentication",
"business-operations",
"integrations-and-orchestration"
],
"upstream_readme": "examples/typescript/order-lookup-function/README.md",
"verification": "live-tested",
"verification_evidence": [
{
"kind": "typechecked",
"date": "2026-10-19",
"runtime": "TypeScript 7.0.2; Stagehand 4.1.0; sdk-functions 1.0.3",
"command": "npm --prefix examples/typescript/order-lookup-function run typecheck",
"result": "passed",
"limits": "Static validation only."
},
{
"kind": "live-tested",
"date": "2026-10-19",
"runtime": "Browserbase Functions; Node.js 24.x; Stagehand 4.1.0; sdk-functions 1.0.3",
"command": "browse functions invoke <function-id> --params '{\"orderId\":\"1\"}'",
"result": "passed",
"limits": "Published Function authenticated against the shared nopCommerce demo and returned the matching sample order with replay. Malformed order ID returned invalid_input. Shared data, Cloudflare checks, and future availability can vary."
}
],
"working_directory": "examples/typescript/order-lookup-function"
}
],
"schema_version": 1
Expand Down
7 changes: 4 additions & 3 deletions docs/catalog.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,16 +7,16 @@ Every entry is source-inspected at minimum. Recipes with stronger install, offli
Search locally with `python3 scripts/catalog.py search "persistent login" --language python --limit 5`. Add `--json` for structured output.

- [Getting started](topics/getting-started.md) (10). Create your first cloud browser and choose a browser SDK.
- [Authentication and saved sessions](topics/authentication.md) (24). Reuse authenticated contexts, handle MFA, and connect login workflows.
- [Authentication and saved sessions](topics/authentication.md) (25). Reuse authenticated contexts, handle MFA, and connect login workflows.
- [Browser configuration](topics/browser-features.md) (32). Configure proxies, CAPTCHA handling, extensions, metadata, and caching.
- [Files and documents](topics/downloads-and-documents.md) (21). Upload files, retrieve downloads, capture PDFs, and parse documents.
- [Extraction and research](topics/extraction-and-research.md) (54). Find pages and extract structured information from them.
- [Forms and transactions](topics/forms-and-transactions.md) (28). Fill forms and prepare application, booking, and payment workflows.
- [Agents and human handoff](topics/agents-and-human-handoff.md) (27). Build browser agents and pause work for human input.
- [Integrations and orchestration](topics/integrations-and-orchestration.md) (32). Connect Browserbase to agent frameworks, services, and workflow engines.
- [Integrations and orchestration](topics/integrations-and-orchestration.md) (33). Connect Browserbase to agent frameworks, services, and workflow engines.
- [Testing and observability](topics/testing-and-observability.md) (7). Test sites and inspect browser behavior, reliability, and performance.
- [Commerce and travel](topics/commerce-and-travel.md) (14). Compare products, research travel, and inspect booking workflows.
- [Business operations](topics/business-operations.md) (11). Automate research and operations across business domains.
- [Business operations](topics/business-operations.md) (12). Automate research and operations across business domains.

## All recipes

Expand Down Expand Up @@ -94,6 +94,7 @@ Search locally with `python3 scripts/catalog.py search "persistent login" --lang
| [MFA handling (TypeScript)](recipes/examples-typescript-mfa-handling.md) | typescript | runnable example | current / public | examples |
| [Microsoft CUA (TypeScript)](recipes/examples-typescript-microsoft-cua.md) | typescript | runnable example | current / public | examples |
| [Nurse verification (TypeScript)](recipes/examples-typescript-nurse-verification.md) | typescript | runnable example | current / public | examples |
| [Order lookup for AI support with Functions and Secrets (TypeScript)](recipes/examples-typescript-order-lookup-function.md) | typescript | runnable example | current / public | examples |
| [Pickleball (TypeScript)](recipes/examples-typescript-pickleball.md) | typescript | runnable example | current / public | examples |
| [Basic CAPTCHA (TypeScript)](recipes/examples-typescript-playwright-basic-captcha.md) | typescript | runnable example | current / public | examples |
| [Playwright MFA handling (TypeScript)](recipes/examples-typescript-playwright-mfa-handling.md) | typescript | runnable example | current / public | examples |
Expand Down
84 changes: 84 additions & 0 deletions docs/recipes/examples-typescript-order-lookup-function.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
# Order lookup for AI support with Functions and Secrets (TypeScript)

Log into the nopCommerce admin demo, look up an order, and return structured fulfillment data and a session replay.

> [!CAUTION]
> Demo and reference code only. This recipe is not a vetted production implementation. Independently review it, obtain authorization, and validate security, privacy, compliance, cost, and site-term requirements before use. Use at your own risk.

**Status:** current · public · live workflow tested.

**Recipe type:** runnable example.
**LLM requirement:** required (derived from the inspected framework and configuration metadata).

## Code and prerequisites

- Working directory from the cookbook root: `examples/typescript/order-lookup-function`.
- Languages: typescript.
- Frameworks: Stagehand, Playwright, Browserbase Functions.
- [Upstream setup and behavior](../../examples/typescript/order-lookup-function/README.md).
- [Dependency manifest `examples/typescript/order-lookup-function/package.json`](../../examples/typescript/order-lookup-function/package.json).
- [Dependency manifest `examples/typescript/order-lookup-function/package-lock.json`](../../examples/typescript/order-lookup-function/package-lock.json).
- [Source `examples/typescript/order-lookup-function/index.ts`](../../examples/typescript/order-lookup-function/index.ts).
- Original use-case taxonomy: functions, secrets, stagehand-v4, order-lookup.

## Setup and run

Run from this directory. Commands come from the package manifest, upstream setup guide, or inspected entrypoint. Configure credentials before starting.

```sh
cd examples/typescript/order-lookup-function
npm ci --ignore-scripts
test -f .env || cp .env.example .env
```

Available launch commands are listed below. For applications with separate workers or servers, read the upstream guide for process order. A production `start` command may require a build first.

```sh
npm run dev
```

## Environment

[Environment template](../../examples/typescript/order-lookup-function/.env.example) lists example configuration. Fill in your own values locally.

### Required

| Variable | Provider and purpose | Safe example | Validation and default |
| --- | --- | --- | --- |
| `BROWSERBASE_API_KEY` | [Browserbase](https://www.browserbase.com/settings). Connects to the Function-managed session and the Browserbase Model Gateway. Secret. | `<set-locally>` | Non-empty; attach as a Function Secret for deployed runs or set locally in .env. No default. |
| `NOPCOMMERCE_EMAIL` | [nopCommerce](https://admin-demo.nopcommerce.com/login). Admin demo login email. Secret. | `<set-locally>` | Non-empty; attach as a Function Secret for deployed runs or set locally in .env. No default. |
| `NOPCOMMERCE_PASSWORD` | [nopCommerce](https://admin-demo.nopcommerce.com/login). Admin demo login password. Secret. | `<set-locally>` | Non-empty; attach as a Function Secret for deployed runs or set locally in .env. No default. |


## Dependencies

Declared runtime dependencies from [examples/typescript/order-lookup-function/package.json](../../examples/typescript/order-lookup-function/package.json). Alternate manifests may differ; use the documented setup path.

| Package | Declared version |
| --- | --- |
| `@browserbasehq/sdk-functions` | `1.0.3` |
| `@browserbasehq/stagehand` | `4.1.0` |
| `dotenv` | `^16.4.5` |
| `playwright-core` | `1.55.0` |
| `zod` | `4.4.3` |

## Caveats and verification

Source and setup metadata were inspected. A scoped live workflow check is recorded below; only its stated command, date, result, and limits are verified. Other websites, accounts, permissions, costs, and configurations remain unverified.

| Check | Date | Runtime | Command | Result and limits |
| --- | --- | --- | --- | --- |
| Typechecked | 2026-10-19 | `TypeScript 7.0.2; Stagehand 4.1.0; sdk-functions 1.0.3` | `npm --prefix examples/typescript/order-lookup-function run typecheck` | passed. Static validation only. |
| Live workflow tested | 2026-10-19 | `Browserbase Functions; Node.js 24.x; Stagehand 4.1.0; sdk-functions 1.0.3` | `browse functions invoke <function-id> --params '{"orderId":"1"}'` | passed. Published Function authenticated against the shared nopCommerce demo and returned the matching sample order with replay. Malformed order ID returned invalid_input. Shared data, Cloudflare checks, and future availability can vary. |

- Uses the shared nopCommerce admin demo, which resets hourly; sample orders and availability can change.
- Upload the matching Stagehand extension and attach API key, NOPCOMMERCE_EMAIL, and NOPCOMMERCE_PASSWORD Secrets.
- Recordings and model-visible page content can contain sample customer details; returned fields exclude contact data.
- Only read-only order lookup is supported; production callers must enforce customer/order authorization.
- Missing orders and site failures return unavailable; never infer nonexistence from an unavailable result.

## Provenance

Cookbook-authored example. Its reviewed source is included at the local paths above.

Related topics: [Authentication and saved sessions](../topics/authentication.md), [Business operations](../topics/business-operations.md), [Integrations and orchestration](../topics/integrations-and-orchestration.md).
1 change: 1 addition & 0 deletions docs/topics/authentication.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ Open a recipe guide for its working directory, commands, environment references,
| [Context (TypeScript)](../recipes/examples-typescript-context.md) | typescript | runnable example | current / public | examples |
| [Manual MFA with contexts (TypeScript)](../recipes/examples-typescript-manual-mfa-with-contexts.md) | typescript | runnable example | current / public | examples |
| [MFA handling (TypeScript)](../recipes/examples-typescript-mfa-handling.md) | typescript | runnable example | current / public | examples |
| [Order lookup for AI support with Functions and Secrets (TypeScript)](../recipes/examples-typescript-order-lookup-function.md) | typescript | runnable example | current / public | examples |
| [Playwright MFA handling (TypeScript)](../recipes/examples-typescript-playwright-mfa-handling.md) | typescript | runnable example | current / public | examples |
| [Box · agent](../recipes/integrations-examples-integrations-box-agent.md) | typescript | runnable example | current / public | integrations |
| [Create extension (TypeScript, Browserbase)](../recipes/playbook-guides-1password-node-createextension.md) | typescript | runnable example | current / public | playbook |
Expand Down
1 change: 1 addition & 0 deletions docs/topics/business-operations.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ Open a recipe guide for its working directory, commands, environment references,
| [Council events (TypeScript)](../recipes/examples-typescript-council-events.md) | typescript | runnable example | current / public | examples |
| [License verification (TypeScript)](../recipes/examples-typescript-license-verification.md) | typescript | runnable example | current / public | examples |
| [Nurse verification (TypeScript)](../recipes/examples-typescript-nurse-verification.md) | typescript | runnable example | current / public | examples |
| [Order lookup for AI support with Functions and Secrets (TypeScript)](../recipes/examples-typescript-order-lookup-function.md) | typescript | runnable example | current / public | examples |
| [City council search (TypeScript, Stagehand)](../recipes/playbook-node-stagehand-research-citycouncilsearch.md) | typescript | runnable example | current / public | playbook |
| [Validate nurses (TypeScript, Stagehand)](../recipes/playbook-node-stagehand-research-validatenurses.md) | typescript | runnable example | current / public | playbook |

Expand Down
Loading
Loading