AgentQL
AgentQL tools provides web interaction and structured data extraction from any web page using an AgentQL query or a Natural Language prompt. AgentQL can be used across multiple languages and web pages without breaking over time and change.
Overview​
AgentQL provides the following three tools:
ExtractWebDataTool
extracts structured data as JSON from a web page given a URL using either an AgentQL query or a Natural Language description of the data.
The following two tools are also bundled as AgentQLBrowserToolkit
and must be used with a Playwright
browser or a remote browser instance via Chrome DevTools Protocal (CDP):
-
ExtractWebDataBrowserTool
extracts structured data as JSON from the active web page in a browser using either an AgentQL query or a Natural Language description. -
GetWebElementBrowserTool
finds a web element on the active web page in a browser using a Natural Language description and returns its CSS selector for further interaction.
Integration details​
Class | Package | Serializable | JS support | Package latest |
---|---|---|---|---|
AgentQL | langchain-agentql | ❌ | ❌ | 1.0.0 |
Tool features​
Tool | Web Data Extraction | Web Element Extraction | Use With Local Browser |
---|---|---|---|
ExtractWebDataTool | ✅ | ❌ | ❌ |
ExtractWebDataBrowserTool | ✅ | ❌ | ✅ |
GetWebElementBrowserTool | ❌ | ✅ | ✅ |
Setup​
%pip install --quiet -U langchain_agentql
To run this notebook, install Playwright
browser and configure Jupyter Notebook's asyncio
loop.
!playwright install
# This import is required only for jupyter notebooks, since they have their own eventloop
import nest_asyncio
nest_asyncio.apply()
Credentials​
To use the AgentQL tools, you will need to get your own API key from the AgentQL Dev Portal and set the AgentQL environment variable.
import os
os.environ["AGENTQL_API_KEY"] = "YOUR_AGENTQL_API_KEY"