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 chromium
export 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

ParameterTypeDefaultDescription
api_keystrNoneAPI key for AgentQL
agentql_querystr""Custom AgentQL query
enable_scrape_websiteboolTrueEnable the scrape_website functionality.
enable_custom_scrape_websiteboolFalseEnable the custom_scrape_website functionality. Auto-enabled when agentql_query is set.
allboolFalseEnable standard scraping; custom scraping still requires a nonempty agentql_query.

Toolkit Functions

FunctionDescription
scrape_websiteUsed to scrape all text from a web page
custom_scrape_websiteRuns the custom query, but currently discards extracted values (see limitation above).

Developer Resources