跳转到内容

概览

集成工具让你的 agents 能把工作交给其他自动化平台和托管 AI 服务。当前一个工作流需要调用已有的 CrewAI 部署,或把专门任务委派给 Amazon Bedrock 等提供商时,它们就派上用场。

  • 串联自动化:在一个 crew 或 flow 内启动已有的 CrewAI 部署
  • 企业交接:将任务路由给已经封装公司逻辑和 guardrails 的 Bedrock Agents
  • 混合工作流:把 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
# 外部自动化
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",
)
# Bedrock 上的托管 agent
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 keys 和 bearer tokens 存在环境变量或 secrets manager 中
  • 考虑延迟:外部自动化可能耗时更久,设置合适的轮询间隔和超时
  • 复用会话:Bedrock Agents 支持 session IDs,可在多次工具调用之间保留上下文
  • 验证响应:在把远程输出传给下游任务前,先标准化它们(JSON、文本、状态码)
  • 监控使用情况:跟踪 CrewAI Platform 或 AWS CloudWatch 中的审计日志,及时发现配额限制和故障