Announcing AgentQL's JavaScript SDK

RL NaborsRL Nabors
5 min read

The Tinyfish team has deeply admired the JavaScript community’s devtools, and today, we’re proud to join them with a new powerful tool: AgentQL JavaScript SDK! This SDK allows developers to add powerful HTML parsing and automation to their JavaScript projects and Node.js environments. From scraping data to testing builds to automating workflows, AgentQL makes it easy to build seamless data flows in your Jamstack with the accuracy and efficiency that only AgentQL's developer tools can provide.

TLDR

What’s AgentQL?

AgentQL is a suite of extraction tools for parsing HTML. AgentQL is an AI-powered query language and parser that automates interactions with browsers and extracts data from web pages with precision and at scale. Getting started takes five minutes, or you can try out our convenient playground.

AgentQL is able to find what you’re looking for on any page using natural language and AI, regardless of how the page’s structure might change over time. You can think of it as a “smart” alternative to CSS selectors or XPath—capable of pinpointing the exact data and elements you need from even the most complex DOM tree.

The significance of AgentQL in web development

Traditional parsing methods can fail to accurately identify elements in dynamic and ever-changing web pages. (A CSS selector is only good until the development team moves CSS into JS and starts dynamically generating classes.) But AgentQL finds the elements based on the description you give it and the relationship of the elements to the rest of the page. It is uniquely accurate and flexible—the same query will work across similar sites or on the same site even as its layout changes over time.

If you’re working in a Node.js environment, the JavaScript SDK allows you to integrate AgentQL into both frontend and backend workflows, enabling you to parse and extract data, automate testing, and streamline interaction handling—all from within your JS environment.

Ready to dive in? Get started with some code samples on GitHub.

Benefits for Fullstack Developers

Smart Parsing Capabilities for Data Extraction and Automation

AgentQL handles even the most chaotic HTML, homing in on the exact elements you need and filtering out the noise. From parsing structured tables to navigating dynamic content, AgentQL’s smart locator system ensures you get what you need with precision, and its built-in Playwright support removes the need for browser automation libraries.

One query can handle many pages, many changes

In the face of dynamic content and changing page structures, AgentQL still returns the same results. AgentQL’s queries are self-healing and work even when a page changes over time. You can use the same query across multiple similar pages, too, reducing the lines of code you need to write and maintain.

Returns results in the structured format you define

AgentQL took inspiration from GraphQL, letting developers define the shape and amount of data they are looking for. Additionally, AgentQL uses Natural Language Processing (NLP) and context queries to find the content on the page based on the terms you write. This query will return a list of posts:

{
  posts[] {
    post_title
    post_title_length(in words)
  }
}

The returned JSON will use the same shape to return information about each blog post:

{
  "posts": [
    {
      "post_title": "AgentQL Launch Week starts next week—Here's what's coming!",
      "post_title_length": 9
    },
    {
      "post_title": "Introducing Playwright Smart Locator",
      "post_title_length": 4
    }
  ]
}

Every web page an API endpoint

Not every web site has an API to integrate with, from the little dentist down the street to financial institutions to government agencies. AgentQL allows developers to access public data in real time without waiting for an engineering effort that may never come.

Dynamic Website Navigation

AgentQL can parse data from dynamically rendered pages that use client side JavaScript, handling scenarios with dynamic elements where HTML structures shift or load asynchronously. You can use Playwright to navigate these pages just like a user, letting you get to content easily and automate workflows.

AgentQL’s parser compliments your scraping process. It can be used with scraping tools like ZenRows’s Scraping Browser (check out this example) and any place where Playwright is supported in small and large-scale scraping projects. It's easy and efficient to add AgentQL to your existing scraping script or write a scraping script of your own using one of our code samples on GitHub.

AgentQL’s developer tools

Your stack’s new parser powered by Playwright

AgentQL fits into your stack anywhere you’d typically rely on Beautiful Soup, CSS selectors, or XPath. Both JavaScript and Python SDKs use Playwright to drive web page interaction, unlocking content hidden under clicks and logins. You can use the browser on your desktop or work in headless browser mode.

With the SDK, Playwright and AgentQL together to emulate user actions and user interactions with the page in an actual browser environment. You can pass credentials to the browser context to allow AgentQL to perform actions on your behalf, perfect for testing or scraping, even dynamic websites.

Debug queries in a real browser

Developer tools exist to increase velocity and reliability. Our debugging browser extension lets you optimize queries in real time on any web page before you put them in production.

Getting Started with AgentQL’s JavaScript SDK

Ready to add AgentQL to your stack? You can be up and running in minutes.

  • Give the query language a try in our playground.

  • Quickstart: Dive into our Quickstart Guide to get a feel for the basics and get up and running with complete code in just five minutes.

  • Code samples: Find source code and boilerplate code for common use cases in our Sample Code Repo.

Ready to Jump In?

AgentQL’s JavaScript SDK is here to make data extraction, automation, and testing easier and more accurate for Jamstack developers. Your feedback is what made this launch week possible, and we want more! Join our Discord or take our survey so we can keep making AgentQL serve your needs better!

With AgentQL, you can focus on building and testing the web, while we handle the HTML soup.

—The Tiny Fish Team Building AgentQL

0
Subscribe to my newsletter

Read articles from RL Nabors directly inside your inbox. Subscribe to the newsletter, and don't miss out.

Written by

RL Nabors
RL Nabors