指南
- 策略
- 代理
- 团队
- 流程
- 高级
工具
- AI Mind 工具
- Apify Actors
- Bedrock Invoke Agent 工具
- Bedrock 知识库检索器
- Brave 搜索
- Browserbase 网页加载器
- 代码文档 RAG 搜索
- 代码解释器
- Composio 工具
- CSV RAG 搜索
- DALL-E 工具
- 目录 RAG 搜索
- 目录读取
- DOCX RAG 搜索
- EXA 搜索网页加载器
- 文件读取
- 文件写入
- Firecrawl 抓取网站
- Firecrawl 爬取网站
- Firecrawl 搜索
- Github 搜索
- Hyperbrowser 加载工具
- Linkup 搜索工具
- LlamaIndex 工具
- LangChain 工具
- Google Serper 搜索
- S3 读取工具
- S3 写入工具
- Scrapegraph 爬取工具
- 从网站爬取元素工具
- JSON RAG 搜索
- MDX RAG 搜索
- MySQL RAG 搜索
- MultiOn 工具
- NL2SQL 工具
- Patronus 评估工具
- PDF RAG 搜索
- PG RAG 搜索
- Qdrant 向量搜索工具
- RAG 工具
- 爬取网站
- Scrapfly 爬取网站工具
- Selenium 爬取器
- Snowflake 搜索工具
- Spider 爬取器
- Stagehand 工具
- TXT RAG 搜索
- 视觉工具
- Weaviate 向量搜索
- 网站 RAG 搜索
- XML RAG 搜索
- YouTube 频道 RAG 搜索
- YouTube 视频 RAG 搜索
代理监控与可观测性
学习
遥测
学习
定制管理器代理
了解如何在 CrewAI 中设置定制代理作为管理器,从而更好地控制任务管理和协调。
在 CrewAI 中设置特定代理作为管理器
CrewAI 允许用户将特定代理设置为团队的管理器,从而更好地控制任务的管理和协调。此功能可以定制管理角色,使其更好地满足项目需求。
使用 manager_agent
属性
定制管理器代理
manager_agent
属性允许您定义一个定制代理来管理团队。该代理将监督整个过程,确保任务高效且达到最高标准地完成。
示例
代码
import os
from crewai import Agent, Task, Crew, Process
# Define your agents
researcher = Agent(
role="Researcher",
goal="Conduct thorough research and analysis on AI and AI agents",
backstory="You're an expert researcher, specialized in technology, software engineering, AI, and startups. You work as a freelancer and are currently researching for a new client.",
allow_delegation=False,
)
writer = Agent(
role="Senior Writer",
goal="Create compelling content about AI and AI agents",
backstory="You're a senior writer, specialized in technology, software engineering, AI, and startups. You work as a freelancer and are currently writing content for a new client.",
allow_delegation=False,
)
# Define your task
task = Task(
description="Generate a list of 5 interesting ideas for an article, then write one captivating paragraph for each idea that showcases the potential of a full article on this topic. Return the list of ideas with their paragraphs and your notes.",
expected_output="5 bullet points, each with a paragraph and accompanying notes.",
)
# Define the manager agent
manager = Agent(
role="Project Manager",
goal="Efficiently manage the crew and ensure high-quality task completion",
backstory="You're an experienced project manager, skilled in overseeing complex projects and guiding teams to success. Your role is to coordinate the efforts of the crew members, ensuring that each task is completed on time and to the highest standard.",
allow_delegation=True,
)
# Instantiate your crew with a custom manager
crew = Crew(
agents=[researcher, writer],
tasks=[task],
manager_agent=manager,
process=Process.hierarchical,
)
# Start the crew's work
result = crew.kickoff()
定制管理器代理的好处
- 增强的控制:根据项目的特定需求定制管理方法。
- 改进的协调:确保由经验丰富的代理高效协调和管理任务。
- 可定制的管理:定义与项目目标一致的管理角色和职责。
设置管理器 LLM
如果您正在使用分层流程且不想设置定制管理器代理,则可以为管理器指定语言模型
代码
from crewai import LLM
manager_llm = LLM(model="gpt-4o")
crew = Crew(
agents=[researcher, writer],
tasks=[task],
process=Process.hierarchical,
manager_llm=manager_llm
)
使用分层流程时,必须设置 `manager_agent` 或 `manager_llm`。