Skip to content
CrewAI 文档版本 跟随上游 源快照 0598850f 更新于 2026-10-18

概述

将 CrewAI 智能体与外部自动化和托管 AI 服务连接起来

集成工具让智能体可以将工作交接给其他自动化平台和托管 AI 服务。当工作流需要调用现有的 CrewAI 部署或将专门任务委派给 Amazon Bedrock 等服务商时,可使用这些工具。

可用工具

常见用例

  • 串联自动化:从另一个团队或流程内部启动现有的 CrewAI 部署
  • 企业交接:将任务路由到已封装公司逻辑和护栏的 Bedrock Agents
  • 混合工作流:将 CrewAI 的推理与对外暴露自身智能体 API 的下游系统结合
  • 长时间运行的任务:轮询外部自动化,并将最终结果合并回当前运行

快速开始示例

python
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 密钥和 bearer token 存储在环境变量或密钥管理器中
  • 为延迟做好准备:外部自动化可能耗时更长——设置合适的轮询间隔和超时
  • 复用会话:Bedrock Agents 支持会话 ID,因此你可以在多次工具调用之间保持上下文
  • 校验响应:在将远程输出(JSON、文本、状态码)转发给下游任务之前先进行规范化
  • 监控用量:跟踪 CrewAI Platform 或 AWS CloudWatch 中的审计日志,提前应对配额限制和失败

BytesRouter 是社区翻译站点,所有译文仅供参考,一切以官方英文原文为准。