Skip to content

[Bug]: arun() and arun_many() type hinting needs fixing #1898

@luzede

Description

@luzede

crawl4ai version

0.8.6

Expected Behavior

Something like this

Image And the docstring comments also say that it returns CrawlResult Image

Current Behavior

Image

Is this reproducible?

Yes

Inputs Causing the Bug

RunManyReturn = Union[
    CrawlResultContainer[CrawlResultT],
    AsyncGenerator[CrawlResultT, None]
]

`arun()` is not an async generator, maybe you guys give it generator properties through CrawlResultContainer but the typing needs fixing.

Steps to Reproduce

I am using Pylance, I tried Pyrefly from meta too.

Code snippets

import asyncio
from crawl4ai import *

async def main():
    async with AsyncWebCrawler() as crawler:
        result = await crawler.arun(
            url="https://www.nbcnews.com/business",
        )
        print(result.markdown)

if __name__ == "__main__":
    asyncio.run(main())

OS

Windows

Python version

3.13.11

Browser

No response

Browser version

No response

Error logs & Screenshots (if applicable)

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    🐞 BugSomething isn't working🩺 Needs TriageNeeds attention of maintainers

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions