CrewAI

Web Data

21 CrewAI tools that let your agents read web pages through the Geonode Scraper API: extract a page as Markdown or HTML, run batches and crawls, map a site's URLs, search the web and check usage. Package: geonode-scraper-crewai on PyPI.

Before you start

  • Python 3.10 or newer.
  • A Geonode API key. Sign in to the Geonode dashboard, open API Keys, and create a key or copy an existing one.
  • A language model for your agents. CrewAI reads the provider's key from the environment, for example ANTHROPIC_API_KEY.

Install

pip install geonode-scraper-crewai

This installs CrewAI and the shared geonode-scraper-tools-core. CrewAI needs an extra for some model providers; for the Anthropic model in the example below, also run pip install "crewai[anthropic]".

Configure

import os

from geonode_scraper_crewai import build_crewai_tools
from geonode_scraper_tools_core import ScraperToolSettings

settings = ScraperToolSettings(
    host="https://scraper.geonode.io",
    api_key=os.environ["GEONODE_SCRAPER_API_KEY"],
)
tools = build_crewai_tools(settings=settings)

host and api_key are required. The other settings have defaults:

SettingDefaultWhat it does
request_timeoutnoneSeconds to wait for each HTTP response.
max_retries0Extra attempts after a failed request.
retry_backoff_seconds1.0Pause before the first retry.
poll_interval_seconds3.0How often the wait_for_* tools check a job.
poll_timeout_seconds60.0How long the wait_for_* tools wait before giving up.
verify_sslTrueCheck TLS certificates.

Give the tools to an agent

from crewai import Agent, Crew, Task

researcher = Agent(
    role="Web researcher",
    goal="Read web pages and report what they say",
    backstory="You read sources carefully and quote them accurately.",
    tools=tools,
    llm="anthropic/claude-sonnet-5-5",
)
task = Task(
    description="Read https://example.com and say in one sentence what the page is for.",
    expected_output="One sentence.",
    agent=researcher,
)
print(Crew(agents=[researcher], tasks=[task]).kickoff())

Any model CrewAI supports works in place of llm. The agent picks the tools itself: here it calls scraper_extract_content and reads the Markdown.

Call a tool directly

Every tool is a regular CrewAI tool, so you can call it without an agent, for example in a test:

extract = next(t for t in tools if t.name == "scraper_extract_content")
outcome = extract.run(url="https://example.com", formats=["markdown"])
if outcome["ok"]:
    print(outcome["result"]["data"]["markdown"])
else:
    print(outcome["error"]["status"], outcome["error"]["message"])

What a tool returns

Tools don't raise on API errors. They return a dict, so the agent can read what went wrong and decide what to do:

  • On success: {"ok": true, "operation": "...", "attempts": 1, "result": {...}}.
  • On failure: {"ok": false, "operation": "...", "attempts": 1, "error": {"status": 429, "code": "...", "message": "...", "retryable": true, ...}}.

status is the API's HTTP status; the Python SDK page lists what each one means. retryable says whether trying again can help.

Pick only the tools you need

Fewer tools make it easier for a model to choose. Pass the operation names you want:

tools = build_crewai_tools(settings=settings, operations=["extract", "map_urls", "search"])
OperationToolWhat it does
extractscraper_extract_contentExtract one URL as Markdown or HTML, now or as a background job.
get_job_resultscraper_get_job_resultGet the state or result of a background extraction.
wait_for_jobscraper_wait_for_jobWait until a background extraction finishes.
list_jobsscraper_list_jobsList earlier extractions.
create_batchscraper_create_batchStart one job for many URLs.
get_batch_statusscraper_get_batch_statusGet a batch's progress and results so far.
wait_for_batchscraper_wait_for_batchWait until a batch finishes.
list_batch_jobsscraper_list_batch_jobsList earlier batches.
create_crawlscraper_create_crawlStart a crawl from one URL.
get_crawl_statusscraper_get_crawl_statusGet a crawl's progress and pages so far.
wait_for_crawlscraper_wait_for_crawlWait until a crawl finishes.
list_crawl_jobsscraper_list_crawl_jobsList earlier crawls.
map_urlsscraper_map_urlsFind the URLs under a site from its sitemap and links.
list_map_jobsscraper_list_map_jobsList earlier map runs.
get_map_jobscraper_get_map_jobGet one map run with its URLs.
searchscraper_searchSearch the web and return ranked results.
list_search_jobsscraper_list_search_jobsList earlier searches.
get_search_jobscraper_get_search_jobGet one search with its results.
get_statisticsscraper_get_statisticsUsage statistics for a period.
get_concurrency_usagescraper_get_concurrency_usageConcurrent requests in use against the plan limit.
health_checkscraper_check_healthCheck that the API is up.

Versions and support

  • The latest version is on PyPI. The same tools are available for LangChain.
  • Requests send User-Agent: geonode-crewai/<version>, which helps support see which version you use.
  • Questions or problems: contact Geonode.

Was this page helpful?

On this page