教程 8:简单多智能体研究员(与 ADK 一起运行) 您将学到的内容 使用协调器智能体与专业子智能体进行多智能体编排 顺序工作流,其中智能体相互依赖、层层递进 集成网络搜索,实现实时研究功能 通过 ADK Web 运行,以交互方式测试多智能体系统 核心概念:多智能体研究流水线 一个协调器 在顺序工作流中编排三个专业智能体:研究 → 总结 → 评论。每个智能体都为构建一份全面的研究报告贡献力量。 项目结构 开始使用 安装依赖项 进入 文件夹,并安装所需的库: 设置环境 创建一个 file in the 文件夹: 重要提示:请将 with your actual Google AI Studio API key from https://aistudio.google.
一个协调器 LlmAgent 在顺序工作流中编排三个专业智能体:研究 → 总结 → 评论。每个智能体都为构建一份全面的研究报告贡献力量。
User Query → Coordinator Agent │ ├──▶ Research Agent (web search + analysis) │ │ │ └──▶ Research Findings │ ├──▶ Summarizer Agent (synthesis) │ │ │ └──▶ Key Insights │ └──▶ Critic Agent (quality analysis) │ └──▶ Final Report with Recommendations
8_simple_multi_agent/ ├── README.md # This file ├── requirements.txt # Dependencies ├── multi_agent_researcher/ # Main implementation │ ├── agent.py # Multi-agent system (exports root_agent) └── .env # Environment variables (create this)
进入 8_simple_multi_agent 文件夹,并安装所需的库:
cd 8_simple_multi_agent pip install -r requirements.txt
创建一个 .env file in the 8_simple_multi_agent 文件夹:
# Create .env file echo "GOOGLE_API_KEY=your_ai_studio_key_here" > .env
重要提示:请将 your_ai_studio_key_here with your actual Google AI Studio API key from https://aistudio.google.com/
From the 8_simple_multi_agent 文件夹替换为:
adk web
ADK Web 设置:
ai_agent_framework_crash_course.google_adk_crash_course.8_simple_multi_agent.multi_agent_researcher
root_agent 对象Research the future of renewable energy integration in smart cities, including current technologies, implementation challenges, economic feasibility, and policy requirements. Provide a critique and suggestions.
"Research the current state of AI regulation in the European Union and its impact on business innovation"
"Investigate the latest developments in CRISPR gene editing technology and its potential applications in medicine"
"Research the effectiveness of personalized learning platforms in K-12 education, including current implementations and learning outcomes"
掌握本教程后,您可以探索:
.env file is in the correct location and contains a valid GOOGLE_API_KEYroot_agent 正确从模块中导出免责声明:
本文档采用基于机器的 AI 翻译服务进行翻译。尽管我们力求准确,但请注意,自动翻译可能存在错误或不准确之处。应以原文语言版本的文档作为权威依据。如需获取关键信息,建议使用专业的人工翻译。对于因使用本翻译而产生的任何误解或误读,我们概不负责。