# AgentQL Demo (`mnmkng/agentql-demo`) Actor

This Actor wraps the AgentQL API to showcase its monetization on Apify.

- **URL**: https://apify.com/mnmkng/agentql-demo.md
- **Developed by:** [Ondra Urban](https://apify.com/mnmkng) (community)
- **Categories:** AI, Open source
- **Stats:** 10 total users, 0 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

Pay per usage

This Actor is paid per platform usage. The Actor is free to use, and you only pay for the Apify platform usage, which gets cheaper the higher subscription plan you have.

Learn more: https://docs.apify.com/actors/running/actors-in-store.md#pay-per-usage

## What's an Apify Actor?

Actors are web data automations that power AI and operations. They run on the Apify platform to scrape websites, process data, connect APIs, and automate workflows.
In Batch mode, an Actor accepts a well-defined JSON input, performs an action which can take anything from a few seconds to a few hours,
and optionally produces a well-defined JSON output, datasets with results, or files in key-value store.
In Standby mode, an Actor provides a web server which can be used as a website, API, or an MCP server.
Actors are written with capital "A".

## How to integrate an Actor?

If asked about integration, you help developers integrate Actors into their projects.
You adapt to their stack and deliver integrations that are safe, well-documented, and production-ready.
The best way to integrate Actors is as follows.

- **AI agents and MCP clients** — the [Apify MCP server](https://docs.apify.com/integrations/mcp.md) at `https://mcp.apify.com` (remote, streamable HTTP, OAuth on first use).
- **Agentic workflows and local Actor development** — [Agent Skills](https://apify.com/.well-known/agent-skills/index.json) with the [Apify CLI](https://docs.apify.com/cli/docs.md): `npm install -g apify-cli`, then `apify login`.
- **JavaScript/TypeScript projects** — the official [JS/TS client](https://docs.apify.com/api/client/js/docs.md): `npm install apify-client`.
- **Python projects** — the official [Python client](https://docs.apify.com/api/client/python/docs.md): `pip install apify-client`.
- **Any other language** — the [REST API](https://docs.apify.com/api/v2.md).

For usage examples, see the [API](#api) section below.

For more details, see Apify documentation as [Markdown index](https://docs.apify.com/llms.txt) and [Markdown full-text](https://docs.apify.com/llms-full.txt).

# README

<div align="center">

<h1 align="center">
    <a href="https://agentql.com/">
        <picture>
          <source media="(prefers-color-scheme: dark)" srcset="https://apify.com/service/https://apify.com/service/https://github.com/user-attachments/assets/972700ef-b4e6-49e9-a282-40994d9cb823 ">
          <img alt="AgentQL" src="https://github.com/user-attachments/assets/893d8117-258c-4cf9-8fd8-5c850586e8d4" width="500">
        </picture>
    </a>
</h1>

<h2>AgentQL connects LLMs and AI agents to the entire web</h2>

<p align="center">
  <a href="https://twitter.com/agentql"><img src="https://img.shields.io/badge/Follow%20on%20X-000000?style=for-the-badge&logo=x&logoColor=white" alt="Follow on X" /></a>
  <a href="https://www.linkedin.com/company/tinyfish-ai"><img src="https://img.shields.io/badge/Follow%20on%20LinkedIn-0077B5?style=for-the-badge&logo=linkedin&logoColor=white" alt="Follow on LinkedIn" /></a>
  <a href="https://discord.gg/agentql"><img src="https://img.shields.io/badge/Join%20our%20Discord-5865F2?style=for-the-badge&logo=discord&logoColor=white" alt="Join our Discord" /></a>
</p>

<p align="center">
  <a href="https://pypi.org/project/agentql"><img src="https://img.shields.io/pypi/v/agentql" alt="Python version" /></a>
  <a href="#repository-details-container"><img src="https://img.shields.io/github/stars/tinyfish-io/agentql" alt="GitHub Repo stars" /></a>
  <a href="#repository-details-container"><img src="https://img.shields.io/github/watchers/tinyfish-io/agentql" alt="GitHub watchers" /></a>
</p>

</div>

### What is AgentQL?

AgentQL is a suite of tools for extracting data and automating workflows on live web sites featuring an AI-powered query language, Python and JavaScript SDKs, a browser-based debugger, and a REST API endpoint. It uses natural language queries to pinpoint data and elements on any web page, including authenticated and dynamically generated content. Users can define structured data output and apply transforms within queries. AgentQL's natural language selectors find elements intuitively based on the content of the web page and work across similar web sites, self-healing as UI changes over time.

[Get started in 5 minutes with our quick start!](https://docs.agentql.com/quick-start)

#### Features

- **Playwright** [AgentQL's Python SDK](https://docs.agentql.com/python-sdk/installation) and [JavaScript SDK](https://docs.agentql.com/javascript-sdk/installation) seamlessly integrates with Playwright for advanced automation and testing.
- **Cross-site compatibility** lets you use the same query across different sites with similar content.
- **Structured output** defined by the shape of your query.
- **Natural language selectors** find elements and data anywhere on a site using intuitive queries.
- **Transforms *and* extracts** data in your queries.
- **Works on any page,** public or private, any site, any URL, even behind authentication.
- **Resiliance to UI changes** means queries work regardless of how a page's structure changes over time.

#### Tools

- **[Python SDK](https://docs.agentql.com/python-sdk/installation)** for running automation and scraping scripts with AgentQL queries in Python.
- **[JavaScript SDK](https://docs.agentql.com/javascript-sdk/installation)** for running automation and scraping scripts with AgentQL queries in JavaScript.
- **[REST API](https://docs.agentql.com/rest-api/api-reference)** for executing queries without an SDK.
- **[Debugger Browser Extension](https://chromewebstore.google.com/detail/agentql-debugger/idnejmodeepdobpinkkgpkeabkabhhej)** lets you debug and finesse queries in real-time on live sites.
- **[AgentQL Query Language](https://docs.agentql.com/agentql-query/query-intro)** lets you define queries with natural language.
- **[Playground](https://playground.agentql.com/)** for playing with AgentQL lets you export python scripts and optimize queries with prompts.

### Examples

| Example Name                            | Python                                                                                                                                                                                                                                        | JavaScript                                                                                                        |
| --------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------- |
| Getting Started                         | [Script](https://github.com/tinyfish-io/agentql/tree/main/examples/python/first_steps)                                                                                                                                                        | [Script](https://github.com/tinyfish-io/agentql/tree/main/examples/js/first-steps)                                |
| Close Cookie Dialog                     | [Script](https://github.com/tinyfish-io/agentql/tree/main/examples/python/close_cookie_dialog) / [Colab](https://github.com/tinyfish-io/agentql/tree/main/examples/googlecolab/close_cookie_dialog)                                           | [Script](https://github.com/tinyfish-io/agentql/tree/main/examples/js/close-cookie-dialog)                        |
| Close Popup Windows                     | [Script](https://github.com/tinyfish-io/agentql/tree/main/examples/python/close_popup) / [Colab](https://github.com/tinyfish-io/agentql/tree/main/examples/googlecolab/close_popup)                                                           | [Script](https://github.com/tinyfish-io/agentql/tree/main/examples/js/close-popup)                                |
| Compare Product Prices                  | [Script](https://github.com/tinyfish-io/agentql/tree/main/examples/python/compare_product_prices) / [Colab](https://github.com/tinyfish-io/agentql/tree/main/examples/googlecolab/compare_product_prices)                                     | [Script](https://github.com/tinyfish-io/agentql/tree/main/examples/js/compare-product-prices)                     |
| Get Element by Prompt                   | [Script](https://github.com/tinyfish-io/agentql/tree/main/examples/python/get_by_prompt)                                                                                                                                                      | [Script](https://github.com/tinyfish-io/agentql/tree/main/examples/js/get-by-prompt)                              |
| Infinite Scroll                         | [Script](https://github.com/tinyfish-io/agentql/tree/main/examples/python/infinite_scroll) / [Colab](https://github.com/tinyfish-io/agentql/tree/main/examples/googlecolab/infinite_scroll)                                                   | [Script](https://github.com/tinyfish-io/agentql/tree/main/examples/js/infinite-scroll)                            |
| External Browser Integration            | [Script](https://github.com/tinyfish-io/agentql/tree/main/examples/python/interact_with_external_or_existing_browser)                                                                                                                         | [Script](https://github.com/tinyfish-io/agentql/tree/main/examples/js/interact-with-external-or-existing-browser) |
| Query List Items                        | [Script](https://github.com/tinyfish-io/agentql/tree/main/examples/python/list_query_usage)                                                                                                                                                   | [Script](https://github.com/tinyfish-io/agentql/tree/main/examples/js/list-query-usage)                           |
| Site Login                              | [Script](https://github.com/tinyfish-io/agentql/tree/main/examples/python/log_into_sites) / [Colab](https://github.com/tinyfish-io/agentql/tree/main/examples/googlecolab/log_into_sites)                                                     | [Script](https://github.com/tinyfish-io/agentql/tree/main/examples/js/log-into-sites)                             |
| Headless Browser                        | [Script](https://github.com/tinyfish-io/agentql/tree/main/examples/python/run_script_in_headless_browser) / [Colab](https://github.com/tinyfish-io/agentql/tree/main/examples/googlecolab/run_script_in_headless_browser)                     | [Script](https://github.com/tinyfish-io/agentql/tree/main/examples/js/run-script-in-headless-browser)             |
| Save/Load Auth Session                  | [Script](https://github.com/tinyfish-io/agentql/tree/main/examples/python/save_and_load_authenticated_session)                                                                                                                                | [Script](https://github.com/tinyfish-io/agentql/tree/main/examples/js/save-and-load-authenticated-session)        |
| Stealth Mode                            | [Script](https://github.com/tinyfish-io/agentql/tree/main/examples/python/stealth_mode)                                                                                                                                                       | [Script](https://github.com/tinyfish-io/agentql/tree/main/examples/js/stealth-mode)                               |
| Wait for Page Load                      | [Script](https://github.com/tinyfish-io/agentql/tree/main/examples/python/wait_for_entire_page_load) / [Colab](https://github.com/tinyfish-io/agentql/tree/main/examples/googlecolab/wait_for_entire_page_load)                               | [Script](https://github.com/tinyfish-io/agentql/tree/main/examples/js/wait-for-entire-page-load)                  |
| E-commerce Pricing Data                 | [Script](https://github.com/tinyfish-io/agentql/tree/main/examples/python/collect_ecommerce_pricing_data)                                                                                                                                     | [Script](https://github.com/tinyfish-io/agentql/tree/main/examples/js/collect-pricing-data)                       |
| Sentiment Analysis                      | [Script](https://github.com/tinyfish-io/agentql/tree/main/examples/python/perform_sentiment_analysis) / [Colab](https://github.com/tinyfish-io/agentql/tree/main/examples/googlecolab/perform_sentiment_analysis)                             | [Script](https://github.com/tinyfish-io/agentql/tree/main/examples/js/perform-sentiment-analysis)                 |
| Get XPath                               | [Script](https://github.com/tinyfish-io/agentql/tree/main/examples/python/xpath)                                                                                                                                                              | [Script](https://github.com/tinyfish-io/agentql/tree/main/examples/js/xpath)                                      |
| Submit Form                             | [Script](https://github.com/tinyfish-io/agentql/tree/main/examples/python/submit_form)                                                                                                                                                        | [Script](https://github.com/tinyfish-io/agentql/tree/main/examples/js/submit-form)                                |
| Collect YouTube Comments                | N/A                                                                                                                                                                                                                                           | [Script](https://github.com/tinyfish-io/agentql/tree/main/examples/js/collect-youtube-comments)                   |
| Use Humanlike Behavior to Avoid Antibot | [Script](https://github.com/tinyfish-io/agentql/tree/main/examples/python/humanlike-antibot)                                                                                                                                                  | [Script](https://github.com/tinyfish-io/agentql/tree/main/examples/js/humanlike-antibot)                          |
| Run in Google Colab                     | [Script](https://github.com/tinyfish-io/agentql/tree/main/examples/python/run_script_online_in_google_colab)                                                                                                                                  | N/A                                                                                                               |
| Collect Ecommerce Paginated Data        | [Script](https://github.com/tinyfish-io/agentql/tree/main/examples/python/collect_paginated_ecommerce_listing_data) / [Colab](https://github.com/tinyfish-io/agentql/tree/main/examples/googlecolab/collect_paginated_ecommerce_listing_data) | [Script](https://github.com/tinyfish-io/agentql/tree/main/examples/js/collect-paginated-ecommerce-data)           |
| Collect Paginated Data From HackerNews  | [Script](https://github.com/tinyfish-io/agentql/tree/main/examples/python/collect_paginated_news_headlines) / [Colab](https://github.com/tinyfish-io/agentql/tree/main/examples/googlecolab/collect_paginated_news_headlines)                 | [Script](https://github.com/tinyfish-io/agentql/tree/main/examples/js/collect-paginated-news-headlines)           |
| Scrape Google Maps and save as a CSV    | [Script](https://github.com/tinyfish-io/agentql/tree/main/examples/python/maps_scraper)                                                                                                                                                       | [Script](https://github.com/tinyfish-io/agentql/tree/main/examples/js/maps_scraper)                               |
| News Aggregator                         | [Script](https://github.com/tinyfish-io/agentql/tree/main/examples/python/news-aggregator)                                                                                                                                                    | [Script](https://github.com/tinyfish-io/agentql/tree/main/examples/js/news-aggregator)                            |

For comprehensive guides and API references, check out our [official documentation](https://docs.agentql.com).

### Show Your Support 🌟

If you find AgentQL helpful, please consider giving us a star on GitHub! It helps us reach more developers and continue improving the project.

<div align="center">
  <a href="#repository-details-container"><img src="https://img.shields.io/github/stars/tinyfish-io/agentql" alt="GitHub Repo stars" /></a>
</div>

### Get in touch

For questions, feedback, or support, join our [Discord community](https://discord.gg/agentql). You can follow us on [GitHub](https://github.com/tinyfish-io/), [Twitter](https://x.com/AgentQL), and [LinkedIn](https://www.linkedin.com/company/95728009)!

# Actor input Schema

## `url` (type: `string`):

The URL of website you want to get the data from.

## Actor input object example

```json
{
  "url": "https://news.ycombinator.com/"
}
```

# API

You can run this Actor programmatically using our API. Below are code examples in JavaScript, Python, and CLI, as well as the OpenAPI specification and MCP server setup.

## JavaScript example

```javascript
import { ApifyClient } from 'apify-client';

// Initialize the ApifyClient with your Apify API token
// Replace the '<YOUR_API_TOKEN>' with your token
const client = new ApifyClient({
    token: '<YOUR_API_TOKEN>',
});

// Prepare Actor input
const input = {
    "url": "https://news.ycombinator.com/"
};

// Run the Actor and wait for it to finish
const run = await client.actor("mnmkng/agentql-demo").call(input);

// Fetch and print Actor results from the run's dataset (if any)
console.log('Results from dataset');
console.log(`💾 Check your data here: https://console.apify.com/storage/datasets/${run.defaultDatasetId}`);
const { items } = await client.dataset(run.defaultDatasetId).listItems();
items.forEach((item) => {
    console.dir(item);
});

// 📚 Want to learn more 📖? Go to → https://docs.apify.com/api/client/js/docs

```

## Python example

```python
from apify_client import ApifyClient

# Initialize the ApifyClient with your Apify API token
# Replace '<YOUR_API_TOKEN>' with your token.
client = ApifyClient("<YOUR_API_TOKEN>")

# Prepare the Actor input
run_input = { "url": "https://news.ycombinator.com/" }

# Run the Actor and wait for it to finish
run = client.actor("mnmkng/agentql-demo").call(run_input=run_input)

# Fetch and print Actor results from the run's dataset (if there are any)
print(f"💾 Check your data here: https://console.apify.com/storage/datasets/{run.default_dataset_id}")
for item in client.dataset(run.default_dataset_id).iterate_items():
    print(item)

# 📚 Want to learn more 📖? Go to → https://docs.apify.com/api/client/python/docs/quick-start

```

## CLI example

```bash
echo '{
  "url": "https://news.ycombinator.com/"
}' |
apify call mnmkng/agentql-demo --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,mnmkng/agentql-demo"
        }
    }
}

```

The hosted server signs you in with OAuth on first connect, so no API token belongs in this config. Clients without OAuth support can send an `Authorization: Bearer <APIFY_API_TOKEN>` header instead, using a token from API & Integrations in Apify Console (https://console.apify.com/settings/integrations).

## OpenAPI specification

Download the OpenAPI definition: https://api.apify.com/v2/actors/6IfszjUNcOHG1Emds/builds/nAGcutyiIsethcayd/openapi.json
