Skip to main content
The Agent Platform JavaScript SDK (AgP JS SDK) is a powerful yet lightweight toolkit for building and running AI-powered automation. Agents are redefining how people work, think, and create — automating research, decision-making, and everyday digital tasks. H Company’s AgP JS SDK takes this further by letting you integrate AI agents directly into your app or browser, so you can build and execute automation scripts with just a few lines of code. Whether you’re completing research projects in minutes or submitting dozens of forms automatically, the AgP JS SDK gives you the ability to run agents that handle complex workflows quickly, reliably, and with minimal setup. More than just a workflow tool, the AgP JS SDK also offers a window into how H’s AI agents think, act, and reason, revealing their decision-making process step by step as they work.

How it works

The AgP JS SDK connects directly to the Agent Platform, giving you programmatic access to H’s AI agents through simple Javascript methods. Once authenticated, you can create, run, and monitor agent-driven tasks directly from your app or browser. Each task execution also streams live updates, allowing you to observe how agents make decisions, interact with environments, and complete objectives step by step. Here’s a glimpse at what’s included in the SDK:
  • Quickstart and installation: Get started in minutes with a few quick and simple steps.
  • Basic usage: Learn how to configure your agent and engineer prompts and task execution.
  • Advanced features: Discover advanced capabilities like trajectory management.
  • Real-time updates: Monitor events and control real-time execution manually.
  • Error handling: Learn how to handle and recover from common errors.
  • Examples: Explore ready-to-use code snippets for a number of workflows.
  • API Reference: Find detailed documentation for all available methods and options.

What you can do

Here are some workflows that can easily be defined and executed using the AgP JS SDK:

Use case

Description

Example tasks
Common code orchestration (Node.js)




Extract data or information



Prompt the agent in natural language to scan the web and extract data or information. The agent solves a task or provides a response based on your query.

”Find the best noise-cancelling headphones"

"Give me the latest news about H Company"

"Recommend 10 places to visit in New York City”

Import the SDK

Wrapped in Async function:

Initialize the SDK

Define the task

Attach a listener

Wait for completion






FIlling in forms






Instruct the agent to fill forms using code by providing the forms and details with which to fill them.



Newsletter signup

Job application forms

Feedback forms

Support tickets

Product demos

Import the SDK

Wrapped in Async function:

Initialize the SDK

Define the forms to fill (URL and fields)

Loop through each form and run

Track status

Wait for completion

Code orchestration

Here are some fully-formed code samples that you can run for Node.js, based on the above:

import { WebAgent } from "agp-js-sdk";

(async () => {
  const agent = WebAgent.fromApiKey('Your API Key', {
    debug: true,
  });

  const task = await agent.run(
    'Suggest a list of developer portal providers and create a comparison table for them',
    { startUrl: 'https://google.com' }
  );

  task.onUpdate((event) => {
    console.log(event.type, event.data);
  });

  await task.waitForCompletion();
  console.log("Task completed!");
})();

Setup requirements

Currently, you can set up the AgP JS SDK using the following methods:
MethodDescriptionAuthentication requirements
BrowserLaunch the SDK in your browser with a script tag.JWT Token or API Key
Package managerInstall the SDK in your Node.js or frontend project using npm or Yarn, then import it into your code.API Key

Using the AgP JS SDK

Tasks or workflows using the AgP JS SDK must be run asynchronously in Node.js or your browser by wrapping the commands inside an async function. Within the async function, the following steps and their corresponding functions must be included.
1

Authenticate and initialize

import { WebAgent } from 'agp-js-sdk';

const agent = WebAgent.fromApiKey('Your API Key');
Good to know: The example above shows you how to authenticate the AgP JS SDK for Node.js with an API key. API keys are generated and retrieved using Portal-H.
2

Define the task

  const task = await agent.run('Search for best noise-cancelling headphones', {
    startUrl: 'https://google.com'
});
3

Attach a listener

task.onUpdate((event) => {
  console.log(event.type, event.data);
});
4

Wait for completion

await task.waitForCompletion();