Files
Agents/agents/root_agent/agent.py
nelson f5e8de559e refactor: 精简agent代码,移除冗余的main入口,添加API文档和note_agent
- root_agent/note_agent: 移除main()函数及不再需要的import(asyncio/Runner/SessionService/types)
- root_agent: 更新agent名称为huiyu_agent,优化instruction
- agents/__init__.py: 添加root_agent导出,供adk web/api_server注册
- 新增 API_DOC.md: 完整的API接口文档,供外部项目集成参考
- 新增 note_agent: 多模态笔记助手agent
2026-04-07 22:15:14 +08:00

31 lines
1.2 KiB
Python
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
import os
from base.agent import HuiYuBaseAgent
from google.adk.models.lite_llm import LiteLlm
# ============================================================
# MiniMax 模型配置(从 .env 文件读取)
# ============================================================
MINIMAX_API_KEY = os.getenv("MINIMAX_API_KEY")
MINIMAX_API_BASE = os.getenv("MINIMAX_API_BASE")
MINIMAX_MODEL = os.getenv("MINIMAX_MODEL")
# ============================================================
# 创建 LiteLlm 模型适配器
# ============================================================
model = LiteLlm(
model=MINIMAX_MODEL,
api_base=MINIMAX_API_BASE,
api_key=MINIMAX_API_KEY,
)
# ============================================================
# 定义 Agent继承 HuiYuBaseAgent自动获得防注入 + 日志能力)
# ============================================================
root_agent = HuiYuBaseAgent(
name="huiyu_agent",
model=model,
description="一个智能助手,能够回答用户的各种问题。",
instruction="你是一个乐于助人的中文 AI 助手,你的名字叫小慧,请用中文回答用户的问题,回答要准确、简洁、友好。",
)