跳转到主要内容
集成工具可让您的 Agent 将工作移交给其他自动化平台和托管 AI 服务。当工作流需要调用现有的 CrewAI 部署或将专门任务委托给 Amazon Bedrock 等提供商时,请使用这些工具。

可用工具

常见用例

  • 链式自动化:从另一个 Crew 或流程中启动现有的 CrewAI 部署
  • 企业级移交:将任务路由到已封装公司逻辑和护栏的 Bedrock Agent
  • 混合工作流:将 CrewAI 的推理能力与公开自身 Agent API 的下游系统相结合
  • 长时间运行的任务:轮询外部自动化并将最终结果合并回当前运行

快速入门示例

from crewai import Agent, Task, Crew
from crewai_tools import InvokeCrewAIAutomationTool
from crewai_tools.aws.bedrock.agents.invoke_agent_tool import BedrockInvokeAgentTool

# External automation
analysis_automation = InvokeCrewAIAutomationTool(
    crew_api_url="https://analysis-crew.acme.crewai.com",
    crew_bearer_token="YOUR_BEARER_TOKEN",
    crew_name="Analysis Automation",
    crew_description="Runs the production-grade analysis pipeline",
)

# Managed agent on Bedrock
knowledge_router = BedrockInvokeAgentTool(
    agent_id="bedrock-agent-id",
    agent_alias_id="prod",
)

automation_strategist = Agent(
    role="Automation Strategist",
    goal="Orchestrate external automations and summarise their output",
    backstory="You coordinate enterprise workflows and know when to delegate tasks to specialised services.",
    tools=[analysis_automation, knowledge_router],
    verbose=True,
)

execute_playbook = Task(
    description="Run the analysis automation and ask the Bedrock agent for executive talking points.",
    agent=automation_strategist,
)

Crew(agents=[automation_strategist], tasks=[execute_playbook]).kickoff()

最佳实践

  • 安全凭证:将 API 密钥和持有者令牌存储在环境变量或密钥管理器中
  • 为延迟做准备:外部自动化可能需要更长时间——设置适当的轮询间隔和超时
  • 重用会话:Bedrock Agent 支持会话 ID,因此您可以在多个工具调用之间保持上下文
  • 验证响应:在将远程输出(JSON、文本、状态码)转发到下游任务之前对其进行规范化
  • 监控使用情况:在 CrewAI 平台或 AWS CloudWatch 中跟踪审计日志,以避免超出配额限制和发生故障