教程 9.1:顺序代理——商业实施计划生成器 您将学到的内容 顺序代理的组合:如何按顺序协调多个专业代理 代理工具集成:将代理封装为工具以增强功能 网络搜索集成:通过搜索代理获取实时市场情报 商业分析流程:从市场研究到实施规划 Streamlit Web 界面:用于商业规划的用户友好型应用 核心概念:具备搜索能力的顺序代理 根据ADK 工作流代理文档的描述,顺序代理会依次执行多个子代理。本教程展示了一个结合了网络搜索功能与顺序分析的商业实施计划生成器: 关键创新:市场研究代理使用了一个专门的搜索代理(封装为代理工具),以访问实时网络搜索功能,获取当前的市场情报。
根据ADK 工作流代理文档的描述,顺序代理会依次执行多个子代理。本教程展示了一个结合了网络搜索功能与顺序分析的商业实施计划生成器:
Business Topic → SequentialAgent → 4 Sub-agents (Sequential Execution) ↓ [Market Research + Web Search] → [SWOT Analysis] → [Strategy] → [Implementation] ↓ Complete Business Implementation Plan
关键创新:市场研究代理使用了一个专门的搜索代理(封装为代理工具),以访问实时网络搜索功能,获取当前的市场情报。
9_1_sequential_agent/ ├── agent.py # Business implementation plan generator with search capabilities ├── app.py # Streamlit web interface for business planning ├── requirements.txt # Python dependencies └── README.md # This documentation
cd 9_1_sequential_agent pip install -r requirements.txt
创建一个 .env 文件,并在其中填写您的 Google API 密钥:
echo "GOOGLE_API_KEY=your_ai_studio_key_here" > .env
重要提示:请从 Google AI Studio 获取您的 API 密钥
streamlit run app.py
这将启动商业实施计划生成器代理的 Web 界面!
该代理通过一套复杂的四步顺序工作流处理商业机会:
关键创新:市场分析代理可访问一个专门的搜索代理(封装为代理工具),该代理能够使用 google_search tool. This provides current market intelligence that feeds into the sequential analysis pipeline.
The SequentialAgent ensures each step builds upon the previous step's output, creating a comprehensive business implementation plan ready for execution.
Result: A complete business implementation plan with market research, strategic analysis, and execution roadmap.
The core workflow orchestrator that executes sub-agents in sequence, ensuring each step builds upon the previous step's output.
Advanced pattern where one agent (Search Agent) is wrapped as a tool and used by another agent (Market Researcher) to enhance capabilities.
Real-time market intelligence through integrated search functionality, providing current data rather than relying on training data.
Each sub-agent specializes in a specific business analysis phase, creating a modular and maintainable system.
Maintains conversation state across the entire analysis pipeline, ensuring context flows between agents.
Processes the complete business implementation workflow with proper error handling and response management.
The sequential agent will provide:
SequentialAgent orchestrates sub-agentsCommon Issues:
GOOGLE_API_KEY is set in .envPro Tips:
LlmAgent 实例或复杂工具驱动的代理进行实时网络搜索。免责声明:
本文档采用基于机器的 AI 翻译服务进行翻译。尽管我们力求准确,但请注意,自动翻译可能存在错误或不准确之处。应以原文语言版本的文档作为权威依据。如需获取关键信息,建议使用专业的人工翻译。对于因使用本翻译而产生的任何误解或误读,我们概不负责。