本页还没有译文
本页 20 段还没译成한국어,下面显示的是英文原文。Apify Actors
还没翻译译自英文(docs.crewai.com)本页 20 段都还没译
ApifyActorsTool
Integrate Apify Actors into your CrewAI workflows.
Description
The ApifyActorsTool connects Apify Actors, cloud-based programs for web scraping and automation, to your CrewAI workflows.
Use any of the 4,000+ Actors on Apify Store for use cases such as extracting data from social media, search engines, online maps, e-commerce sites, travel portals, or general websites.
For details, see the Apify CrewAI integration in Apify documentation.
Steps to get started
-
Install dependencies
Install
crewai[tools]andlangchain-apifyusing pip:pip install 'crewai[tools]' langchain-apify. -
Obtain an Apify API token
Sign up to Apify Console and get your Apify API token..
-
Configure environment
Set your Apify API token as the
APIFY_API_TOKENenvironment variable to enable the tool's functionality.
Usage example
Use the ApifyActorsTool manually to run the RAG Web Browser Actor to perform a web search:
from crewai_tools import ApifyActorsTool
# Initialize the tool with an Apify Actor
tool = ApifyActorsTool(actor_name="apify/rag-web-browser")
# Run the tool with input parameters
results = tool.run(run_input={"query": "What is CrewAI?", "maxResults": 5})
# Process the results
for result in results:
print(f"URL: {result['metadata']['url']}")
print(f"Content: {result.get('markdown', 'N/A')[:100]}...")Expected output
Here is the output from running the code above:
URL: https://www.example.com/crewai-intro
Content: CrewAI is a framework for building AI-powered workflows...
URL: https://docs.crewai.com/
Content: Official documentation for CrewAI...The ApifyActorsTool automatically fetches the Actor definition and input schema from Apify using the provided actor_name and then constructs the tool description and argument schema. This means you need to specify only a valid actor_name, and the tool handles the rest when used with agents—no need to specify the run_input. Here's how it works:
from crewai import Agent
from crewai_tools import ApifyActorsTool
rag_browser = ApifyActorsTool(actor_name="apify/rag-web-browser")
agent = Agent(
role="Research Analyst",
goal="Find and summarize information about specific topics",
backstory="You are an experienced researcher with attention to detail",
tools=[rag_browser],
)You can run other Actors from Apify Store simply by changing the actor_name and, when using it manually, adjusting the run_input based on the Actor input schema.
For an example of usage with agents, see the CrewAI Actor template.
Configuration
The ApifyActorsTool requires these inputs to work:
actor_nameThe ID of the Apify Actor to run, e.g.,"apify/rag-web-browser". Browse all Actors on Apify Store.run_inputA dictionary of input parameters for the Actor when running the tool manually.- For example, for the
apify/rag-web-browserActor:{"query": "search term", "maxResults": 5} - See the Actor's input schema for the list of input parameters.
- For example, for the
Resources
- Apify: Explore the Apify platform.
- How to build an AI agent on Apify - A complete step-by-step guide to creating, publishing, and monetizing AI agents on the Apify platform.
- RAG Web Browser Actor: A popular Actor for web search for LLMs.
- CrewAI Integration Guide: Follow the official guide for integrating Apify and CrewAI.