-
-
Notifications
You must be signed in to change notification settings - Fork 1.9k
Closed
Labels
area:coreThe bug / feature is about astrbot's core, backendThe bug / feature is about astrbot's core, backendbugSomething isn't workingSomething isn't workingfeature:pluginThe bug / feature is about AstrBot plugin system.The bug / feature is about AstrBot plugin system.
Description
What happened / 发生了什么
我使用 https://github.com/u14app/deep-research 这个 MCP 服务器去进行深度搜索,将它提供的tool提供且仅提供给一个专用于SubAgent的人格并配置为SubAgent,然后发现该SubAgent执行过程中报下面的异常。
这个MCP服务器的文档要求将超时时间设置地很长,我将所有超时时间都设置地很长,但日志里的异常提示似乎mcp_client的超时时间仍旧是60秒?下面是我配置的各个超时时间:
// MCP 服务器定义
{
"transport": "streamable_http",
"url": "http://deep-research:3000/api/mcp",
"headers": {},
"timeout": 3600,
"sse_read_timeout": 3600
}
// Provider
"provider_sources": [
{
"provider": "deepseek",
"type": "openai_chat_completion",
"provider_type": "chat_completion",
"key": [
"XXXXX"
],
"api_base": "https://api.deepseek.com/beta",
"timeout": 120,
"proxy": "",
"custom_headers": {},
"id": "deepseek",
"enable": true
},
// 工具调用超时
"tool_call_timeout": 1500,
Reproduce / 如何复现?
- 部署该MCP服务器
- 在astrbot配置增加该MCP服务器,并仅让一个人格能使用它提供的工具
- 使用这个人格创建一个SubAgent
- 让主人格调用这个SubAgent进行信息汇聚任务
- 观察到日志中出现报错
AstrBot version, deployment method (e.g., Windows Docker Desktop deployment), provider used, and messaging platform used. / AstrBot 版本、部署方式(如 Windows Docker Desktop 部署)、使用的提供商、使用的消息平台适配器
4.20.1 Docker deepseek/deepseek-reasoner
OS
Linux
Logs / 报错日志
astrbot | [00:22:09.542] [Core] [INFO] [runners.tool_loop_agent_runner:657]: Agent 使用工具: ['generate-SERP-query']
astrbot | [00:22:09.542] [Core] [INFO] [runners.tool_loop_agent_runner:703]: 使用工具:generate-SERP-query,参数:{'plan': '国内主流大模型定价和多模态能力对比:阿里云、百度、字节跳动、腾讯、华为、智谱AI、月之暗面、零一万物等厂商的模型定价、多模态支持能力、上下文长度等信息', 'language': '中文'}
astrbot | [00:23:09.548] [Core] [WARN] [v4.20.1] [runners.tool_loop_agent_runner:858]: Traceback (most recent call last):
astrbot | File "/usr/local/lib/python3.12/site-packages/anyio/streams/memory.py", line 117, in receive
astrbot | return self.receive_nowait()
astrbot | ^^^^^^^^^^^^^^^^^^^^^
astrbot | File "/usr/local/lib/python3.12/site-packages/anyio/streams/memory.py", line 112, in receive_nowait
astrbot | raise WouldBlock
astrbot | anyio.WouldBlock
astrbot |
astrbot | During handling of the above exception, another exception occurred:
astrbot |
astrbot | Traceback (most recent call last):
astrbot | File "/usr/local/lib/python3.12/site-packages/anyio/_core/_tasks.py", line 124, in fail_after
astrbot | yield cancel_scope
astrbot | File "/usr/local/lib/python3.12/site-packages/mcp/shared/session.py", line 292, in send_request
astrbot | response_or_error = await response_stream_reader.receive()
astrbot | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
astrbot | File "/usr/local/lib/python3.12/site-packages/anyio/streams/memory.py", line 125, in receive
astrbot | await receive_event.wait()
astrbot | File "/usr/local/lib/python3.12/site-packages/anyio/_backends/_asyncio.py", line 1789, in wait
astrbot | await self._event.wait()
astrbot | File "/usr/local/lib/python3.12/asyncio/locks.py", line 212, in wait
astrbot | await fut
astrbot | asyncio.exceptions.CancelledError: Cancelled via cancel scope 762e84243440; reason: deadline exceeded
astrbot |
astrbot | During handling of the above exception, another exception occurred:
astrbot |
astrbot | Traceback (most recent call last):
astrbot | File "/usr/local/lib/python3.12/site-packages/mcp/shared/session.py", line 291, in send_request
astrbot | with anyio.fail_after(timeout):
astrbot | ^^^^^^^^^^^^^^^^^^^^^^^^^
astrbot | File "/usr/local/lib/python3.12/contextlib.py", line 158, in __exit__
astrbot | self.gen.throw(value)
astrbot | File "/usr/local/lib/python3.12/site-packages/anyio/_core/_tasks.py", line 127, in fail_after
astrbot | raise TimeoutError
astrbot | TimeoutError
astrbot |
astrbot | During handling of the above exception, another exception occurred:
astrbot |
astrbot | Traceback (most recent call last):
astrbot | File "/AstrBot/astrbot/core/agent/runners/tool_loop_agent_runner.py", line 757, in _handle_function_tools
astrbot | async for resp in executor: # type: ignore
astrbot | File "/AstrBot/astrbot/core/astr_agent_tool_exec.py", line 145, in execute
astrbot | async for r in cls._execute_mcp(tool, run_context, **tool_args):
astrbot | File "/AstrBot/astrbot/core/astr_agent_tool_exec.py", line 642, in _execute_mcp
astrbot | res = await tool.call(run_context, **tool_args)
astrbot | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
astrbot | File "/AstrBot/astrbot/core/agent/mcp_client.py", line 394, in call
astrbot | return await self.mcp_client.call_tool_with_reconnect(
astrbot | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
astrbot | File "/AstrBot/astrbot/core/agent/mcp_client.py", line 357, in call_tool_with_reconnect
astrbot | return await _call_with_retry()
astrbot | ^^^^^^^^^^^^^^^^^^^^^^^^
astrbot | File "/usr/local/lib/python3.12/site-packages/tenacity/asyncio/__init__.py", line 193, in async_wrapped
astrbot | return await copy(fn, *args, **kwargs)
astrbot | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
astrbot | File "/usr/local/lib/python3.12/site-packages/tenacity/asyncio/__init__.py", line 112, in __call__
astrbot | do = await self.iter(retry_state=retry_state)
astrbot | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
astrbot | File "/usr/local/lib/python3.12/site-packages/tenacity/asyncio/__init__.py", line 157, in iter
astrbot | result = await action(retry_state)
astrbot | ^^^^^^^^^^^^^^^^^^^^^^^^^
astrbot | File "/usr/local/lib/python3.12/site-packages/tenacity/_utils.py", line 111, in inner
astrbot | return call(*args, **kwargs)
astrbot | ^^^^^^^^^^^^^^^^^^^^^
astrbot | File "/usr/local/lib/python3.12/site-packages/tenacity/__init__.py", line 393, in <lambda>
astrbot | self._add_action_func(lambda rs: rs.outcome.result())
astrbot | ^^^^^^^^^^^^^^^^^^^
astrbot | File "/usr/local/lib/python3.12/concurrent/futures/_base.py", line 449, in result
astrbot | return self.__get_result()
astrbot | ^^^^^^^^^^^^^^^^^^^
astrbot | File "/usr/local/lib/python3.12/concurrent/futures/_base.py", line 401, in __get_result
astrbot | raise self._exception
astrbot | File "/usr/local/lib/python3.12/site-packages/tenacity/asyncio/__init__.py", line 116, in __call__
astrbot | result = await fn(*args, **kwargs)
astrbot | ^^^^^^^^^^^^^^^^^^^^^^^^^
astrbot | File "/AstrBot/astrbot/core/agent/mcp_client.py", line 343, in _call_with_retry
astrbot | return await self.session.call_tool(
astrbot | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
astrbot | File "/usr/local/lib/python3.12/site-packages/mcp/client/session.py", line 383, in call_tool
astrbot | result = await self.send_request(
astrbot | ^^^^^^^^^^^^^^^^^^^^^^^^
astrbot | File "/usr/local/lib/python3.12/site-packages/mcp/shared/session.py", line 294, in send_request
astrbot | raise McpError(
astrbot | mcp.shared.exceptions.McpError: Timed out while waiting for response to ClientRequest. Waited 60.0 seconds.
astrbot |
astrbot | [00:23:09.548] [Core] [INFO] [runners.tool_loop_agent_runner:881]: Tool `generate-SERP-query` Result: error: Timed out while waiting for response to ClientRequest. Waited 60.0 seconds.
Are you willing to submit a PR? / 你愿意提交 PR 吗?
- Yes!
Code of Conduct
- I have read and agree to abide by the project's Code of Conduct。
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
area:coreThe bug / feature is about astrbot's core, backendThe bug / feature is about astrbot's core, backendbugSomething isn't workingSomething isn't workingfeature:pluginThe bug / feature is about AstrBot plugin system.The bug / feature is about AstrBot plugin system.