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:Setup requirements
Currently, you can set up the AgP JS SDK using the following methods:| Method | Description | Authentication requirements |
|---|---|---|
| Browser | Launch the SDK in your browser with a script tag. | JWT Token or API Key |
| Package manager | Install 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 anasync function.
Within the async function, the following steps and their corresponding functions must be included.
.png)
