跳转到主要内容

ZapierActionsAdapter

描述

使用 Zapier 适配器来列出并调用 Zapier 操作作为 CrewAI 工具。这使得代理能够触发数千个应用中的自动化流程。

安装

此适配器已包含在 crewai-tools 中,无需额外安装。

环境变量

  • ZAPIER_API_KEY (必需): Zapier API 密钥。您可以从 Zapier Actions 仪表盘 https://actions.zapier.com/ 获取 (创建一个账户,然后生成一个 API 密钥)。您也可以在构建适配器时直接传递 zapier_api_key

示例

代码
from crewai import Agent, Task, Crew
from crewai_tools.adapters.zapier_adapter import ZapierActionsAdapter

adapter = ZapierActionsAdapter(api_key="your_zapier_api_key")
tools = adapter.tools()

agent = Agent(
    role="Automator",
    goal="Execute Zapier actions",
    backstory="Automation specialist",
    tools=tools,
    verbose=True,
)

task = Task(
    description="Create a new Google Sheet and add a row using Zapier actions",
    expected_output="Confirmation with created resource IDs",
    agent=agent,
)

crew = Crew(agents=[agent], tasks=[task])
result = crew.kickoff()

注意事项与限制

  • 该适配器会列出您密钥可用的操作,并动态创建 BaseTool 包装器。
  • 在您的任务指令或工具调用中处理特定操作所需的字段。
  • 速率限制取决于您的 Zapier 计划;请参阅 Zapier Actions 文档。

注意

  • 适配器会获取可用的操作并动态生成 BaseTool 包装器。