🚀 Socket Launch Week Day 5:Introducing Repository Access Permissions and Custom Roles.Learn more
Sign In

@hanzi-browse/sdk

Package Overview
Dependencies
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@hanzi-browse/sdk

SDK for the Hanzi browser automation platform. Control a real Chrome browser programmatically.

latest
Source
npmnpm
Version
0.1.0
Version published
Maintainers
1
Created
Source

@hanzi-browse/sdk

SDK for the Hanzi browser automation platform. Control a real Chrome browser programmatically — navigate, click, read pages, fill forms — powered by AI.

Install

npm install @hanzi-browse/sdk

Quick Start

import { HanziClient } from '@hanzi-browse/sdk';

const client = new HanziClient({
  apiKey: 'hic_live_xxx',
});

// Run a task (blocks until complete)
const result = await client.runTask({
  browserSessionId: 'your-session-id',
  task: 'Go to linkedin.com and check unread messages',
});

console.log(result.answer);
// "You have 3 unread messages from: Alice, Bob, Carol"

Setup

1. Get an API key

Sign in to open your developer console, then create an API key.

2. Connect a browser

The browser you want to control needs the Hanzi Chrome extension installed and paired to your workspace.

// Your backend creates a pairing token
const { pairingToken } = await client.createPairingToken();

// Send the user a pairing link — they click it and their browser auto-pairs:
// https://api.hanzilla.co/pair/{pairingToken}
//
// Or embed the hanzi-pair.js snippet in your app for one-click pairing.

3. Run tasks

// Find connected browser sessions
const sessions = await client.listSessions();
const connected = sessions.find(s => s.status === 'connected');

// Run a task against that browser
const result = await client.runTask({
  browserSessionId: connected.id,
  task: 'Read the patient chart on the current page',
  context: 'Extract: name, medications, allergies, problems',
});

console.log(result.answer);
console.log(result.usage); // { inputTokens, outputTokens, apiCalls }

API Reference

new HanziClient(options)

OptionTypeRequiredDefault
apiKeystringYes
baseUrlstringNohttps://api.hanzilla.co

client.runTask(params, options?)

Run a task and wait for completion. This is the main method.

Params:

FieldTypeRequiredDescription
browserSessionIdstringYesConnected browser session
taskstringYesWhat to do
urlstringNoStarting URL
contextstringNoExtra context (form data, preferences)

Options:

FieldTypeDefaultDescription
pollIntervalMsnumber2000How often to check status
timeoutMsnumber300000Max wait time (5 min)

Returns: TaskRun with status, answer, steps, usage.

client.createTask(params)

Start a task without waiting. Returns immediately.

client.getTask(taskId)

Check status of a running task.

client.cancelTask(taskId)

Cancel a running task.

client.createPairingToken()

Create a pairing token for connecting a browser.

client.listSessions()

List browser sessions in your workspace.

client.getUsage()

Get usage summary (tokens, costs, task count).

client.health()

Check if the API is reachable. No auth required.

Keywords

browser-automation

FAQs

Package last updated on 13 Apr 2026

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts