Skip to content

Commit bd52e0b

Browse files
ok Merge branch 'main' of github.com:modelscope/ms-agent into release/1.1
2 parents d1a71f7 + 04ece4d commit bd52e0b

6 files changed

Lines changed: 38 additions & 21 deletions

File tree

README.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,11 @@ MS-Agent is a lightweight framework designed to empower agents with autonomous e
9595
### Install from PyPI
9696

9797
```shell
98+
# For the basic functionalities
9899
pip install ms-agent
100+
101+
# For the deep research functionalities
102+
pip install 'ms-agent[research]'
99103
```
100104

101105

ms_agent/app/doc_research.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2393,9 +2393,9 @@ def periodic_status_update(request: gr.Request):
23932393
'https://arxiv.org/abs/2505.09388\nhttps://arxiv.org/abs/2412.15115'
23942394
],
23952395
[
2396-
'Analyze and summarize the following documents in English',
2396+
'Analyze and summarize the following documents. You must use English to answer.',
23972397
None,
2398-
'https://arxiv.org/abs/2505.09388'
2398+
'https://arxiv.org/abs/1706.03762'
23992399
]
24002400
],
24012401
inputs=[user_prompt, uploaded_files, urls_text],

ms_agent/tools/mcp_client.py

Lines changed: 21 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -66,12 +66,12 @@ async def call_tool(self, server_name: str, tool_name: str,
6666
if response.isError:
6767
sep = '\n\n'
6868
if all(isinstance(item, str) for item in response.content):
69-
return f'execute error: {sep.join(response.content)}'
69+
return f'execute tool call error: [{server_name}]{tool_name}, {sep.join(response.content)}'
7070
else:
7171
item_list = []
7272
for item in response.content:
7373
item_list.append(item.text)
74-
return f'execute error: {sep.join(item_list)}'
74+
return f'execute tool call error: [{server_name}]{tool_name}, {sep.join(item_list)}'
7575
for content in response.content:
7676
if content.type == 'text':
7777
texts.append(content.text)
@@ -205,16 +205,26 @@ async def connect(self):
205205
assert self.mcp_config, 'MCP config is required'
206206
envs = Env.load_env()
207207
mcp_config = self.mcp_config['mcpServers']
208+
error = dict()
208209
for name, server in mcp_config.items():
209-
env_dict = server.pop('env', {})
210-
env_dict = {
211-
key: value if value else envs.get(key, '')
212-
for key, value in env_dict.items()
213-
}
214-
if 'exclude' in server:
215-
self._exclude_functions[name] = server.pop('exclude')
216-
await self.connect_to_server(
217-
server_name=name, env=env_dict, **server)
210+
try:
211+
env_dict = server.pop('env', {})
212+
env_dict = {
213+
key: value if value else envs.get(key, '')
214+
for key, value in env_dict.items()
215+
}
216+
if 'exclude' in server:
217+
self._exclude_functions[name] = server.pop('exclude')
218+
await self.connect_to_server(
219+
server_name=name, env=env_dict, **server)
220+
except BaseException as exc:
221+
error[name] = str(exc)
222+
if error:
223+
error_messages = '; '.join(f'`{srv}`: {msg}'
224+
for srv, msg in error.items())
225+
raise ConnectionError(
226+
f'MCP connections failed for: {error_messages}. Please check mcp configurations and retry.'
227+
)
218228

219229
async def cleanup(self):
220230
"""Clean up resources"""

projects/deep_research/README.md

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,11 +47,14 @@ So, how are external electric fields typically simulated in theoretical calculat
4747

4848
To set up the Agentic Insight framework, follow these steps:
4949

50-
* Install from source code
50+
* Installation
5151
```bash
52+
# From source code
5253
git clone https://github.com/modelscope/ms-agent.git
53-
5454
pip install -r requirements/research.txt
55+
56+
# From PyPI (>=v1.1.0)
57+
pip install 'ms-agent[research]'
5558
```
5659

5760
### 🚀 Quickstart

projects/doc_research/README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525
- 📝 **Multiple Input Types** - Support multi-file uploads and URL inputs
2626
- 📊 **Multimodal Reports** - Support text and image reports in Markdown format
2727
- 🚀 **High Efficiency** - Leverage powerful LLMs for fast and accurate research, leveraging key information extraction techniques to further optimize token usage
28-
- ⚙️ **Flexible Deployment** - Support local run and [ModelScope Studio](https://modelscope.cn/studios)
28+
- ⚙️ **Flexible Deployment** - Support local run and [ModelScope Studio](https://modelscope.cn/studios) on both CPU and GPU environments.
2929
- 💰 **Free Model Inference** - Free LLM API inference calls for ModelScope users, refer to [ModelScope API-Inference](https://modelscope.cn/docs/model-service/API-Inference/intro)
3030

3131

@@ -56,7 +56,7 @@ conda create -n doc_research python=3.11
5656
conda activate doc_research
5757

5858
# Version requirement: ms-agent>=1.1.0
59-
pip install ms-agent[research]
59+
pip install 'ms-agent[research]'
6060
```
6161

6262
### 2. Configure Environment Variables
@@ -99,7 +99,7 @@ ms-agent app --doc_research \
9999
> `share`: (store_true action), whether to share the app publicly. <br>
100100
101101
* Notes
102-
> When running locally, the default address is http://0.0.0.0:7860/. You need to disable your VPN to access it.
102+
> When running locally, the default address is http://0.0.0.0:7860/. If the page can't be accessed, try disabling proxy.
103103
104104

105105
<br>

projects/doc_research/README_zh.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525
- 📝 **多种输入类型** - 支持多文件上传和URLs输入
2626
- 📊 **多模态报告** - 支持Markdown格式的图文报告输出
2727
- 🚀 **精准高效** - 利用强大的LLM进行快速准确的研究,采用关键信息抽取技术进一步优化了token使用
28-
- ⚙️ **灵活部署** - 支持本地运行和魔搭创空间运行模式
28+
- ⚙️ **灵活部署** - 支持本地运行和魔搭创空间运行模式,兼容CPU和GPU环境
2929
- 💰 **免费模型推理** - 魔搭ModelScope用户可免费调用LLM API推理,参考 [ModelScope API-Inference](https://modelscope.cn/docs/model-service/API-Inference/intro)
3030

3131

@@ -56,7 +56,7 @@ conda create -n doc_research python=3.11
5656
conda activate doc_research
5757

5858
# 版本要求:ms-agent>=1.1.0
59-
pip install ms-agent[research]
59+
pip install 'ms-agent[research]'
6060
```
6161

6262
### 2. 配置环境变量
@@ -101,7 +101,7 @@ ms-agent app --doc_research \
101101
> `share`: (store_true action), 是否对外分享,默认关闭. <br>
102102
103103
* 备注:
104-
> 本地运行时,默认访问地址为 `http://0.0.0.0:7860/`需关闭VPN才能访问 <br>
104+
> 本地运行时,默认访问地址为 `http://0.0.0.0:7860/`如无法访问,可尝试关闭VPN <br>
105105
106106

107107
<br>

0 commit comments

Comments
 (0)