Skip to main content
The source defines three Crawl4aiTools agents. It runs the default pruning agent and the explicit enable_crawl agent; the raw no-pruning agent is configured but not executed.
The source uses deprecated gpt-4o in all three agent configurations and defines agent_raw without executing it. Update the model IDs before running.
crawl4ai_tools.py

Run the Example

1

Set up your virtual environment

2

Install dependencies

3

Export your OpenAI API key

4

Set up Crawl4AI

Install the browser dependencies required by Crawl4AI:
5

Update the models

Replace all three OpenAIChat(id="gpt-4o") constructors with OpenAIChat(id="gpt-5.4-mini") in the saved file.
6

Run the example

Save the code above as crawl4ai_tools.py, then run:
Full source: cookbook/91_tools/crawl4ai_tools.py