Skip to content
fastbrowsefastbrowse

docs

Use it from JavaScript

Install the TypeScript SDK, run a task, and keep secrets, authorization and output validation in your process.

Raw Markdown·Source at the pinned commit

npm install fastbrowse gives a Node.js 20+ program the same agent with no Python on the machine. The SDK has no dependencies; npm also installs a native binary for your platform (@fastbrowse/darwin-arm64, darwin-x64, linux-arm64, linux-x64 or win32-x64). No install script runs and nothing downloads on first use. It reads the same keys from your environment, and finds local Chrome, starts a cloud browser or drives one already running, as the CLI does.

npm install fastbrowse zod
export OPENROUTER_API_KEY=...
import { Fastbrowse } from 'fastbrowse';
import { z } from 'zod';

const Release = z.object({ package: z.string(), version: z.string() });

const fb = await Fastbrowse.start({ local: true });
try {
  const result = await fb.run('Find the httpx package and report its name and latest released version.', {
    start: 'https://pypi.org/',
    output: Release,
    limits: { maxDollars: 0.1 },
    onEvent: event => {
      if (event.type === 'step') console.error(event.step.operation, event.step.target);
    },
    signal: AbortSignal.timeout(120_000),
  });
  console.log(result.status, result.answer);
  if (result.status === 'complete') console.log(result.output.package, result.output.version);
  for (const evidence of result.evidence) console.log(`  "${evidence.quote}" from ${evidence.url}`);
} finally {
  await fb.close();
}
  • One instance runs one task at a time; start more instances to run side by side. The process exits with yours.
  • run resolves with the result whatever the status. It rejects when no run finished (RpcError for a refused request, AbortError when signal stopped it, ProcessExitedError when the process is gone), and with OutputValidationError when the data fails your schema.
  • The result is Python's RunResult, with Python field names. output is data validated by your Zod (4.2+), ArkType or Valibot schema, or a plain JSON Schema; data the schema refuses rejects with OutputValidationError. A run fills a flat object of required string, number, integer and boolean fields.

Secrets and the final check stay in your code:

await fb.run('Log in as standard_user with the saved password and add the backpack to the cart.', {
  start: 'https://www.saucedemo.com/',
  authorization: { irreversibleActions: true },
  secrets: {
    refs: [{ name: 'password', origins: ['https://www.saucedemo.com'] }],
    resolve: name => vault.get(name),
  },
  until: url => url.endsWith('/cart.html'),
});

resolve is called each time a value is typed, only on an origin its ref covers. until gets the final address, and anything but true keeps the run from complete. The other options are run_task's in camelCase; the SDK README lists them with the error model.

There is no binary for musl systems such as Alpine; point binaryPath or FASTBROWSE_BINARY at your own. The macOS binaries are ad-hoc signed, not notarized, and the Windows binary is unsigned. Bun and Deno are untested.

hosted

Run fastbrowse over an API

The same agent behind an API. Keys, secrets, run history and spend limits live in the console. Free to start.

create an account·plans and pricing