指南
- 策略
- 代理
- 团队
- 流程
- 高级
工具
- AI 心智工具
- Apify Actors
- Bedrock 调用代理工具
- Bedrock 知识库检索器
- Brave 搜索
- Browserbase 网页加载器
- 代码文档 RAG 搜索
- 代码解释器
- Composio 工具
- CSV RAG 搜索
- DALL-E 工具
- 目录 RAG 搜索
- 目录读取
- DOCX RAG 搜索
- EXA 搜索网页加载器
- 文件读取
- 文件写入
- Firecrawl 网站抓取
- Firecrawl 网站 scraping
- Firecrawl 搜索
- Github 搜索
- Hyperbrowser 加载工具
- Linkup 搜索工具
- LlamaIndex 工具
- LangChain 工具
- Google Serper 搜索
- S3 读取工具
- S3 写入工具
- Scrapegraph scraping 工具
- 从网站 scraping 元素工具
- JSON RAG 搜索
- MDX RAG 搜索
- MySQL RAG 搜索
- MultiOn 工具
- NL2SQL 工具
- Patronus 评估工具
- PDF RAG 搜索
- PG RAG 搜索
- Qdrant 向量搜索工具
- RAG 工具
- scraping 网站
- Scrapfly scraping 网站工具
- Selenium 爬虫
- Snowflake 搜索工具
- Spider 爬虫
- Stagehand 工具
- TXT RAG 搜索
- 视觉工具
- Weaviate 向量搜索
- 网站 RAG 搜索
- XML RAG 搜索
- YouTube 频道 RAG 搜索
- YouTube 视频 RAG 搜索
代理监控与可观测性
学习
遥测
学习
执行过程中的人工输入
在复杂的决策过程中,将 CrewAI 与执行期间的人工输入相结合,并充分利用代理的属性和工具的全部能力。
代理执行中的人工输入
在多种代理执行场景中,人工输入至关重要,允许代理在必要时请求额外信息或澄清。此功能在复杂的决策过程中或代理需要更多详细信息才能有效完成任务时特别有用。
在 CrewAI 中使用人工输入
要将人工输入集成到代理执行中,请在任务定义中设置 human_input
标志。启用后,代理会在给出最终答案之前提示用户输入。此输入可以提供额外的上下文、澄清模糊之处或验证代理的输出。
示例
pip install crewai
代码
import os
from crewai import Agent, Task, Crew
from crewai_tools import SerperDevTool
os.environ["SERPER_API_KEY"] = "Your Key" # serper.dev API key
os.environ["OPENAI_API_KEY"] = "Your Key"
# Loading Tools
search_tool = SerperDevTool()
# Define your agents with roles, goals, tools, and additional attributes
researcher = Agent(
role='Senior Research Analyst',
goal='Uncover cutting-edge developments in AI and data science',
backstory=(
"You are a Senior Research Analyst at a leading tech think tank. "
"Your expertise lies in identifying emerging trends and technologies in AI and data science. "
"You have a knack for dissecting complex data and presenting actionable insights."
),
verbose=True,
allow_delegation=False,
tools=[search_tool]
)
writer = Agent(
role='Tech Content Strategist',
goal='Craft compelling content on tech advancements',
backstory=(
"You are a renowned Tech Content Strategist, known for your insightful and engaging articles on technology and innovation. "
"With a deep understanding of the tech industry, you transform complex concepts into compelling narratives."
),
verbose=True,
allow_delegation=True,
tools=[search_tool],
cache=False, # Disable cache for this agent
)
# Create tasks for your agents
task1 = Task(
description=(
"Conduct a comprehensive analysis of the latest advancements in AI in 2025. "
"Identify key trends, breakthrough technologies, and potential industry impacts. "
"Compile your findings in a detailed report. "
"Make sure to check with a human if the draft is good before finalizing your answer."
),
expected_output='A comprehensive full report on the latest AI advancements in 2025, leave nothing out',
agent=researcher,
human_input=True
)
task2 = Task(
description=(
"Using the insights from the researcher\'s report, develop an engaging blog post that highlights the most significant AI advancements. "
"Your post should be informative yet accessible, catering to a tech-savvy audience. "
"Aim for a narrative that captures the essence of these breakthroughs and their implications for the future."
),
expected_output='A compelling 3 paragraphs blog post formatted as markdown about the latest AI advancements in 2025',
agent=writer,
human_input=True
)
# Instantiate your crew with a sequential process
crew = Crew(
agents=[researcher, writer],
tasks=[task1, task2],
verbose=True,
memory=True,
planning=True # Enable planning feature for the crew
)
# Get your crew to work!
result = crew.kickoff()
print("######################")
print(result)