Skip to main content
Prerequisites
  • Python 3.10 or higher
  • PraisonAI Agents package installed
  • crawl4ai package installed and set up
The user shares a URL; the agent crawls the page and returns a concise summary. Crawl4AI provides powerful async web crawling with JavaScript rendering, content extraction, and LLM-based data extraction. PraisonAI includes built-in Crawl4AI tools for easy integration.

Quick Start

1

Install

2

Crawl a page

3

Use with agent

Installation

Setup

Built-in Crawl4AI Tool

PraisonAI provides built-in crawl4ai functions that you can use directly:

URL Safety

Every URL passed to crawl, crawl_many, extract_css, or extract_llm is validated by is_safe_http_url before any network request is made. Blocked categories:
  • Loopback (127.0.0.0/8, ::1)
  • Link-local (169.254.0.0/16, fe80::/10) — includes cloud metadata IPs
  • Private ranges (10.0.0.0/8, 172.16.0.0/12, 192.168.0.0/16)
  • IANA-reserved and unspecified addresses
Blocked URLs return a success: False payload and log Crawl4AI <method> blocked unsafe URL: <url>:
Inline HTML via raw:// is exempt — it needs no network access:
crawl_many preserves input order: a blocked URL appears as its blocked payload in the same index slot as the original request, never stripped or reordered.
The mentions handler (praisonaiagents.tools.mentions) validates every redirect hop, not just the first. A message URL that redirects to an unsafe target returns [Blocked: redirect target is not allowed: <final url>]. See Spider Tools — URL Validation.

Available Functions

Basic Usage

Simple Crawl

Crawl with Options

Crawl Multiple URLs

Extract with CSS Selectors

Extract with LLM

Using Crawl4AITools Class

For more control, use the Crawl4AITools class directly:

Synchronous Usage

For non-async code, use the sync versions:

Schema Reference

CSS Extraction Schema

Field Types

JavaScript Execution

Execute JavaScript before crawling:

Wait Conditions

Video Tutorial

Key Points

  • Async by default: Use await for all crawl functions
  • JavaScript rendering: Full browser support for dynamic content
  • CSS extraction: Fast, no-LLM structured data extraction
  • LLM extraction: AI-powered extraction for complex content
  • Multi-URL: Efficient concurrent crawling

Best Practices

CSS selectors are faster and more reliable than LLM extraction for well-structured pages.
Use wait_for='css:.loaded' for pages that load content via JavaScript to avoid missing data.
crawl4ai_many crawls concurrently and is much faster than sequential calls for multiple URLs.
Prefer crawl4ai_sync for non-async scripts to avoid managing the event loop manually.

Custom Tools

Build your own agent tools

Tools Overview

Browse PraisonAI tool documentation