Skip to content

Usage

Overview

All automation runs as a task submitted to the Browserable server. You create a task with a plain-language instruction, then poll (or await) for the result. The BROWSER_AGENT agent handles general-purpose web automation.


Minimal example (TypeScript / Node.js)

typescript
import { Browserable } from 'browserable-js';

const browserable = new Browserable({
  apiKey: 'your-api-key'   // from http://localhost:2001/dash/@admin/settings
});

async function example() {
  // Create a task with a plain-language instruction
  const task = await browserable.createTask({
    task: 'Find the top trending GitHub repos of the day.',
    agent: 'BROWSER_AGENT'
  });

  if (!task.success) {
    console.error('Task creation failed:', task.error);
    return;
  }

  // Wait for the task to complete (polls internally)
  const result = await browserable.waitForRun(task.data.taskId);
  console.log('Results:', result.data);
}

example().catch(console.error);

What happens:

  1. createTask dispatches the instruction to the Browserable server.
  2. The server spins up a remote browser session (via Hyperbrowser or Steel) and an LLM agent.
  3. waitForRun polls until the task finishes, then returns the extracted data.
  4. result.data contains the structured output from the page.

Key SDK methods

MethodPurpose
new Browserable({ apiKey })Initialize the client pointing at your local server
browserable.createTask({ task, agent })Submit a plain-language browser task
browserable.waitForRun(taskId)Await task completion and return results

REST API alternative

Every SDK method maps to a REST endpoint on http://localhost:2003. See docs.browserable.ai/rest-api/introductions for the full reference.


Notes

  • The server must be running (npx browserable or Docker Compose) before any SDK call.
  • LLM and browser provider keys must be configured in the UI or the task will return an error immediately.
  • Task duration depends on the complexity of the web flow and LLM latency; simple tasks typically complete in 15-60 seconds.