Merge pull request #522 from floating21/fix/deep-agent-tavily-optional

fix: 将 DeepAgent 的断言改为警告,使其在没有 Tavily Key 时也能加载出智能体选项并正常使用
This commit is contained in:
Wenjie Zhang 2026-02-28 16:31:00 +08:00 committed by GitHub
commit ee5066625d
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -15,6 +15,8 @@ from src.agents.common.tools import get_tavily_search
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 _create_fs_backend(rt):
@ -81,11 +83,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):