AgentQL
Scrape web page text using AgentQLTools and a local browser.
AgentQLTools enable an Agent to browse and scrape websites using the AgentQL API.
Prerequisites
The following example requires the agentql library and an API token which can be obtained from AgentQL.
uv pip install -U agno agentql openai
playwright install chromiumexport AGENTQL_API_KEY=***Example
The following agent will open a web browser and scrape all the text from the page.
from agno.agent import Agent
from agno.models.openai import OpenAIResponses
from agno.tools.agentql import AgentQLTools
agent = Agent(
model=OpenAIResponses(id="gpt-5.2"), tools=[AgentQLTools()]
)
agent.print_response("https://docs.agno.com/introduction", markdown=True)AgentQL opens a visible Chromium browser. Run this example on a machine with a display and keep the browser open while scraping.
Set AGENTQL_API_KEY as shown above. The toolkit stores its api_key argument but does not forward it to the AgentQL SDK, so the argument alone is insufficient.
The current custom_scrape_website implementation iterates dictionary keys instead of returning the extracted values. For example, a products query returns the word products rather than its records. Use the default page-text tool, or call the AgentQL SDK directly for structured extraction until that adapter method is corrected.
Toolkit Params
| Parameter | Type | Default | Description |
|---|---|---|---|
api_key | str | None | API key for AgentQL |
agentql_query | str | "" | Custom AgentQL query |
enable_scrape_website | bool | True | Enable the scrape_website functionality. |
enable_custom_scrape_website | bool | False | Enable the custom_scrape_website functionality. Auto-enabled when agentql_query is set. |
all | bool | False | Enable standard scraping; custom scraping still requires a nonempty agentql_query. |
Toolkit Functions
| Function | Description |
|---|---|
scrape_website | Used to scrape all text from a web page |
custom_scrape_website | Runs the custom query, but currently discards extracted values (see limitation above). |