fix: 将 DeepAgent 的断言改为警告,使其在没有 Tavily Key 时也能加载出智能体选项并正常使用

This commit is contained in:
floating21 2026-02-25 22:35:33 +08:00
parent 5a376dd1b9
commit 28428a53d1

View File

@ -18,7 +18,7 @@ from src.services.mcp_service import get_tools_from_all_servers
from .context import DeepContext
from .prompts import DEEP_PROMPT
from src.utils import logger
def _get_research_sub_agent(search_tools: list) -> dict:
"""Get research sub-agent config with search tools."""
@ -85,11 +85,14 @@ class DeepAgent(BaseAgent):
if tavily_search:
tools.append(tavily_search)
# Assert that search tool is available for DeepAgent
assert tools, (
"DeepAgent requires at least one search tool. "
"Please configure TAVILY_API_KEY environment variable to enable web search."
)
# # Assert that search tool is available for DeepAgent
# assert tools, (
# "DeepAgent requires at least one search tool. "
# "Please configure TAVILY_API_KEY environment variable to enable web search."
# )
if not tools:
logger.warning("No search tools configured, DeepAgent will work without web search")
tools = []
return tools
async def get_graph(self, **kwargs):