From ff537c90edc0dcc24760248e9c5919d9b860d8ca Mon Sep 17 00:00:00 2001 From: Vasiliy Radostev Date: Thu, 12 Feb 2026 23:02:53 -0800 Subject: [PATCH 1/3] Added AG2 community integration example and Quickstart pointer --- docs/md_v2/core/examples.md | 47 +++++++++++++++++++++++++++++++++++ docs/md_v2/core/quickstart.md | 3 ++- 2 files changed, 49 insertions(+), 1 deletion(-) diff --git a/docs/md_v2/core/examples.md b/docs/md_v2/core/examples.md index d5d58e025..49e5b0e93 100644 --- a/docs/md_v2/core/examples.md +++ b/docs/md_v2/core/examples.md @@ -100,6 +100,53 @@ This page provides a comprehensive list of example scripts that demonstrate vari | Chainlit Integration | Shows how to integrate Crawl4AI with Chainlit. | [View Guide](https://github.com/unclecode/crawl4ai/blob/main/docs/examples/chainlit.md) | | Crawl4AI vs FireCrawl | Compares Crawl4AI with the FireCrawl library. | [View Code](https://github.com/unclecode/crawl4ai/blob/main/docs/examples/crawlai_vs_firecrawl.py) | +## Community Integrations + +Crawl4AI works well with AG2 (AutoGen 2) for agentic browsing. The example below uses `Crawl4AITool` with a Pydantic schema to return structured data. + +```python +import os +from autogen import AssistantAgent, UserProxyAgent, LLMConfig +from autogen.tools.experimental import Crawl4AITool +from pydantic import BaseModel, Field + + +class NewsArticle(BaseModel): + title: str = Field(description="The headline of the article") + summary: str = Field(description="A brief summary of the content") + + +llm_config = LLMConfig(config_list=[ + { + "api_type": "openai", + "model": "gpt-4o", + "api_key": os.environ["OPENAI_API_KEY"], + } +]) + +researcher = AssistantAgent( + name="WebResearcher", + system_message="You are a precise web researcher. Use the crawl tool to get data.", + llm_config=llm_config, +) + +user_proxy = UserProxyAgent( + name="Admin", + human_input_mode="NEVER", + max_consecutive_auto_reply=2, +) + +crawl_tool = Crawl4AITool(llm_config=llm_config, extraction_model=NewsArticle) +crawl_tool.register_for_execution(user_proxy) +crawl_tool.register_for_llm(researcher) + +user_proxy.initiate_chat( + recipient=researcher, + message="Extract the top 3 headlines and summaries from https://techcrunch.com using the news schema.", + max_turns=2, +) +``` + ## Content Generation & Markdown | Example | Description | Link | diff --git a/docs/md_v2/core/quickstart.md b/docs/md_v2/core/quickstart.md index 83cb6cef8..a321da563 100644 --- a/docs/md_v2/core/quickstart.md +++ b/docs/md_v2/core/quickstart.md @@ -461,5 +461,6 @@ If you’re ready for more, check out: - **Hooks & Auth**: Learn how to run custom JavaScript or handle logins with cookies, local storage, etc. - **Deployment**: Explore ephemeral testing in Docker or plan for the upcoming stable Docker release. - **Browser Management**: Delve into user simulation, stealth modes, and concurrency best practices. +- **Code Examples**: Browse practical examples, including a community AG2 (AutoGen 2) integration snippet. -Crawl4AI is a powerful, flexible tool. Enjoy building out your scrapers, data pipelines, or AI-driven extraction flows. Happy crawling! \ No newline at end of file +Crawl4AI is a powerful, flexible tool. Enjoy building out your scrapers, data pipelines, or AI-driven extraction flows. Happy crawling! From fb07ef17a84ff2295ee0b7df61bbdccec0ebebd1 Mon Sep 17 00:00:00 2001 From: Vasiliy Radostev Date: Thu, 12 Feb 2026 23:14:32 -0800 Subject: [PATCH 2/3] Updated --- docs/md_v2/core/examples.md | 2 +- docs/md_v2/core/quickstart.md | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/md_v2/core/examples.md b/docs/md_v2/core/examples.md index 49e5b0e93..9475f0efa 100644 --- a/docs/md_v2/core/examples.md +++ b/docs/md_v2/core/examples.md @@ -102,7 +102,7 @@ This page provides a comprehensive list of example scripts that demonstrate vari ## Community Integrations -Crawl4AI works well with AG2 (AutoGen 2) for agentic browsing. The example below uses `Crawl4AITool` with a Pydantic schema to return structured data. +Crawl4AI works well with AG2 (formerly AutoGen) for agentic browsing. The example below uses `Crawl4AITool` with a Pydantic schema to return structured data. ```python import os diff --git a/docs/md_v2/core/quickstart.md b/docs/md_v2/core/quickstart.md index a321da563..64339883d 100644 --- a/docs/md_v2/core/quickstart.md +++ b/docs/md_v2/core/quickstart.md @@ -461,6 +461,6 @@ If you’re ready for more, check out: - **Hooks & Auth**: Learn how to run custom JavaScript or handle logins with cookies, local storage, etc. - **Deployment**: Explore ephemeral testing in Docker or plan for the upcoming stable Docker release. - **Browser Management**: Delve into user simulation, stealth modes, and concurrency best practices. -- **Code Examples**: Browse practical examples, including a community AG2 (AutoGen 2) integration snippet. +- **Code Examples**: Browse practical examples, including a community AG2 (formerly AutoGen) integration snippet. Crawl4AI is a powerful, flexible tool. Enjoy building out your scrapers, data pipelines, or AI-driven extraction flows. Happy crawling! From b86145193eb62a53ba738e9b5543c427993694f1 Mon Sep 17 00:00:00 2001 From: Vasiliy Radostev Date: Fri, 13 Feb 2026 11:46:19 -0800 Subject: [PATCH 3/3] Updated to match the latest LLMConfig --- docs/md_v2/core/examples.md | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/docs/md_v2/core/examples.md b/docs/md_v2/core/examples.md index 9475f0efa..d6385c91c 100644 --- a/docs/md_v2/core/examples.md +++ b/docs/md_v2/core/examples.md @@ -105,6 +105,8 @@ This page provides a comprehensive list of example scripts that demonstrate vari Crawl4AI works well with AG2 (formerly AutoGen) for agentic browsing. The example below uses `Crawl4AITool` with a Pydantic schema to return structured data. ```python +# Install: `pip install "ag2[openai,crawl4ai]"` + import os from autogen import AssistantAgent, UserProxyAgent, LLMConfig from autogen.tools.experimental import Crawl4AITool @@ -116,13 +118,12 @@ class NewsArticle(BaseModel): summary: str = Field(description="A brief summary of the content") -llm_config = LLMConfig(config_list=[ - { +llm_config = LLMConfig({ "api_type": "openai", "model": "gpt-4o", "api_key": os.environ["OPENAI_API_KEY"], } -]) +) researcher = AssistantAgent( name="WebResearcher", @@ -140,11 +141,11 @@ crawl_tool = Crawl4AITool(llm_config=llm_config, extraction_model=NewsArticle) crawl_tool.register_for_execution(user_proxy) crawl_tool.register_for_llm(researcher) -user_proxy.initiate_chat( +user_proxy.run( recipient=researcher, message="Extract the top 3 headlines and summaries from https://techcrunch.com using the news schema.", max_turns=2, -) +).process() ``` ## Content Generation & Markdown