什么是 Apify?
Apify 是一个提供以下服务的平台:- 为 AI Agent 提供数据收集服务,专注于从社交媒体、搜索引擎、在线地图、电子商务网站、旅游门户或常规网站提取数据
- 一个包含各种数据任务的现成 Actor(专用工具)的市场
- 运行和变现我们自己 AI Agent 的基础设施
Documentation Index
Fetch the complete documentation index at: /llms.txt
Use this file to discover all available pages before exploring further.
pip install agno apify-client
from agno.agent import Agent
from agno.tools.apify import ApifyTools
# 创建一个包含 ApifyTools 的 Agent
agent = Agent(
tools=[
ApifyTools(
actors=["apify/rag-web-browser"], # 指定要使用的 Apify Actor,如果需要,可使用多个
apify_api_token="your_apify_api_key" # 或者设置 APIFY_API_TOKEN 环境变量
)
],
show_tool_calls=True,
markdown=True
)
# 使用 Agent 获取网站内容
agent.print_response("What information can you find on https://docs.agno.com/introduction ?", markdown=True)
from agno.agent import Agent
from agno.tools.apify import ApifyTools
agent = Agent(
tools=[
ApifyTools(actors=["apify/rag-web-browser"])
],
show_tool_calls=True,
markdown=True
)
# 搜索信息并处理结果
agent.print_response("What are the latest developments in large language models?", markdown=True)
from agno.agent import Agent
from agno.tools.apify import ApifyTools
agent = Agent(
tools=[
ApifyTools(actors=["apify/website-content-crawler"])
],
markdown=True
)
# 让 Agent 处理网页内容
agent.print_response("Summarize the content from https://docs.agno.com/introduction", markdown=True)
from agno.agent import Agent
from agno.tools.apify import ApifyTools
agent = Agent(
tools=[
ApifyTools(actors=["compass/crawler-google-places"])
],
show_tool_calls=True
)
# 查找特定位置的企业信息
agent.print_response("What are the top-rated restaurants in San Francisco?", markdown=True)
agent.print_response("Find coffee shops in Prague", markdown=True)
from agno.agent import Agent
from agno.tools.apify import ApifyTools
agent = Agent(
tools=[
ApifyTools(actors=[
"apify/rag-web-browser",
"compass/crawler-google-places"
])
],
show_tool_calls=True
)
# 获取一般信息和本地商家信息
agent.print_response(
"""
我下个月要去东京旅行。
1. 研究最佳旅行时间和主要景点
2. 在新宿附近找一家评价好的寿司餐厅
根据这些信息整理一份全面的旅行指南。
""",
markdown=True
)
| 参数 | 类型 | 默认值 | 描述 |
|---|---|---|---|
apify_api_token | str | None | Apify API 令牌(或通过 APIFY_API_TOKEN 环境变量设置) |
actors | str 或 List[str] | None | 单个 Actor ID 或要注册的 Actor ID 列表 |