Implementation:CrewAIInc CrewAI Apify Actors Tool
| Knowledge Sources | |
|---|---|
| Domains | Tools, Web_Scraping, Apify |
| Last Updated | 2026-02-11 00:00 GMT |
Overview
Concrete tool for running Apify Actors (cloud-based web scraping and automation programs) provided by CrewAI.
Description
The ApifyActorsTool class extends BaseTool to wrap the langchain_apify.ApifyActorsTool. During initialization, it validates the APIFY_API_TOKEN environment variable, dynamically imports the LangChain Apify tool for the specified actor name, and delegates execution to the underlying actor tool. The tool's name, description, and args_schema are dynamically set from the wrapped Apify actor. The _run method accepts a run_input dictionary and returns a list of dictionaries containing structured results from the actor execution. Error handling wraps exceptions with context-specific messages referencing Apify account run logs.
Usage
Use this tool when CrewAI agents need to execute pre-built Apify Actors for web scraping, data extraction, or browser automation tasks without implementing scraping logic directly.
Code Reference
Source Location
- Repository: CrewAI
- File: lib/crewai-tools/src/crewai_tools/tools/apify_actors_tool/apify_actors_tool.py
- Lines: 1-102
Signature
class ApifyActorsTool(BaseTool):
actor_tool: _ApifyActorsTool = Field(description="Apify Actor Tool")
package_dependencies: list[str] = Field(default_factory=lambda: ["langchain-apify"])
def __init__(self, actor_name: str, *args: Any, **kwargs: Any) -> None: ...
def _run(self, run_input: dict[str, Any]) -> list[dict[str, Any]]: ...
Import
from crewai_tools import ApifyActorsTool
I/O Contract
Inputs
| Name | Type | Required | Description |
|---|---|---|---|
| actor_name | str | Yes | Name of the Apify Actor to run (constructor parameter) |
| run_input | dict[str, Any] | Yes | Dictionary of parameters to pass to the Actor (runtime _run parameter) |
Outputs
| Name | Type | Description |
|---|---|---|
| _run() returns | list[dict[str, Any]] | List of result dictionaries from the Actor execution |
Usage Examples
Basic Usage
from crewai_tools import ApifyActorsTool
tool = ApifyActorsTool(actor_name="apify/rag-web-browser")
results = tool.run(run_input={"query": "What is CrewAI?", "maxResults": 5})
for result in results:
print(f"URL: {result['metadata']['url']}")