AgentQL의 document loader는 AgentQL query를 사용하여 모든 웹 페이지에서 구조화된 데이터 추출을 제공합니다. AgentQL은 시간이 지나고 변경되어도 깨지지 않고 여러 언어와 웹 페이지에서 사용할 수 있습니다.

Overview

AgentQLLoader는 다음 두 가지 매개변수가 필요합니다: 다음 매개변수 설정은 선택 사항입니다:
  • api_key: dev.agentql.com에서 발급받은 AgentQL API key입니다. 선택 사항.
  • timeout: 타임아웃 전에 요청을 기다리는 시간(초)입니다. 기본값은 900입니다.
  • is_stealth_mode_enabled: 실험적인 봇 회피 전략을 활성화할지 여부입니다. 이 기능은 모든 웹사이트에서 항상 작동하지 않을 수 있습니다. 이 모드가 활성화되면 데이터 추출이 더 오래 걸릴 수 있습니다. 기본값은 False입니다.
  • wait_for: 데이터를 추출하기 전에 페이지가 로드될 때까지 기다리는 시간(초)입니다. 기본값은 0입니다.
  • is_scroll_to_bottom_enabled: 데이터를 추출하기 전에 페이지 하단까지 스크롤할지 여부입니다. 기본값은 False입니다.
  • mode: "standard"는 심층 데이터 분석을 사용하고, "fast"는 일부 분석 깊이를 속도와 교환하며 대부분의 사용 사례에 적합합니다. 이 가이드에서 모드에 대해 자세히 알아보세요. 기본값은 "fast"입니다.
  • is_screenshot_enabled: 데이터를 추출하기 전에 스크린샷을 찍을지 여부입니다. Base64 문자열로 ‘metadata’에 반환됩니다. 기본값은 False입니다.
AgentQLLoader는 AgentQL의 REST API로 구현되었습니다.

Integration details

ClassPackageLocalSerializableJS support
AgentQLLoaderlangchain-agentql

Loader features

SourceDocument Lazy LoadingNative Async Support
AgentQLLoader

Setup

AgentQL Document Loader를 사용하려면 AGENTQL_API_KEY 환경 변수를 구성하거나 api_key 매개변수를 사용해야 합니다. Dev Portal에서 API key를 발급받을 수 있습니다.

Installation

langchain-agentql을 설치합니다.
pip install -qU langchain-agentql

Set Credentials

import os

os.environ["AGENTQL_API_KEY"] = "YOUR_AGENTQL_API_KEY"

Initialization

다음으로 model 객체를 인스턴스화합니다:
from langchain_agentql.document_loaders import AgentQLLoader

loader = AgentQLLoader(
    url="https://www.agentql.com/blog",
    query="""
    {
        posts[] {
            title
            url
            date
            author
        }
    }
    """,
    is_scroll_to_bottom_enabled=True,
)

Load

docs = loader.load()
docs[0]
Document(metadata={'request_id': 'bdb9dbe7-8a7f-427f-bc16-839ccc02cae6', 'generated_query': None, 'screenshot': None}, page_content="{'posts': [{'title': 'Launch Week Recap—make the web AI-ready', 'url': 'https://www.agentql.com/blog/2024-launch-week-recap', 'date': 'Nov 18, 2024', 'author': 'Rachel-Lee Nabors'}, {'title': 'Accurate data extraction from PDFs and images with AgentQL', 'url': 'https://www.agentql.com/blog/accurate-data-extraction-pdfs-images', 'date': 'Feb 1, 2025', 'author': 'Rachel-Lee Nabors'}, {'title': 'Introducing Scheduled Scraping Workflows', 'url': 'https://www.agentql.com/blog/scheduling', 'date': 'Dec 2, 2024', 'author': 'Rachel-Lee Nabors'}, {'title': 'Updates to Our Pricing Model', 'url': 'https://www.agentql.com/blog/2024-pricing-update', 'date': 'Nov 19, 2024', 'author': 'Rachel-Lee Nabors'}, {'title': 'Get data from any page: AgentQL’s REST API Endpoint—Launch week day 5', 'url': 'https://www.agentql.com/blog/data-rest-api', 'date': 'Nov 15, 2024', 'author': 'Rachel-Lee Nabors'}]}")
print(docs[0].metadata)
{'request_id': 'bdb9dbe7-8a7f-427f-bc16-839ccc02cae6', 'generated_query': None, 'screenshot': None}

Lazy Load

AgentQLLoader는 현재 한 번에 하나의 Document만 로드합니다. 따라서 load()lazy_load()는 동일하게 동작합니다:
pages = [doc for doc in loader.lazy_load()]
pages
[Document(metadata={'request_id': '06273abd-b2ef-4e15-b0ec-901cba7b4825', 'generated_query': None, 'screenshot': None}, page_content="{'posts': [{'title': 'Launch Week Recap—make the web AI-ready', 'url': 'https://www.agentql.com/blog/2024-launch-week-recap', 'date': 'Nov 18, 2024', 'author': 'Rachel-Lee Nabors'}, {'title': 'Accurate data extraction from PDFs and images with AgentQL', 'url': 'https://www.agentql.com/blog/accurate-data-extraction-pdfs-images', 'date': 'Feb 1, 2025', 'author': 'Rachel-Lee Nabors'}, {'title': 'Introducing Scheduled Scraping Workflows', 'url': 'https://www.agentql.com/blog/scheduling', 'date': 'Dec 2, 2024', 'author': 'Rachel-Lee Nabors'}, {'title': 'Updates to Our Pricing Model', 'url': 'https://www.agentql.com/blog/2024-pricing-update', 'date': 'Nov 19, 2024', 'author': 'Rachel-Lee Nabors'}, {'title': 'Get data from any page: AgentQL’s REST API Endpoint—Launch week day 5', 'url': 'https://www.agentql.com/blog/data-rest-api', 'date': 'Nov 15, 2024', 'author': 'Rachel-Lee Nabors'}]}")]

API reference

이 integration을 사용하는 방법에 대한 자세한 내용은 git repo 또는 langchain integration documentation을 참조하세요.
Connect these docs programmatically to Claude, VSCode, and more via MCP for real-time answers.
I