Skip to content

Commit a93c156

Browse files
author
alcholiclg
committed
Merge branch 'main' of https://github.com/modelscope/ms-agent into feat/capabilities
2 parents 6af4bb9 + f491aaa commit a93c156

10 files changed

Lines changed: 569 additions & 8 deletions

File tree

README.md

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -47,13 +47,15 @@ MS-Agent is a lightweight framework designed to empower agents with autonomous e
4747

4848
> [WARNING] For historical archive versions, please refer to: https://github.com/modelscope/ms-agent/tree/0.8.0
4949
50-
| WeChat Group
51-
|:-------------------------:
52-
| <img src="asset/ms-agent.jpg" width="200" height="200">
50+
[Discord Group](https://discord.gg/qmTFPY9byM) | WeChat Group
51+
:-------------------------:|:-------------------------:
52+
<img src="asset/discord_qr.jpg" width="200" height="200"> | <img src="asset/ms-agent.jpg" width="200" height="200">
5353

5454

5555
## 🎉 News
5656

57+
* 🏆 Apr 09, 2026: Agentic Insight v2 is now **#2 Open-Source** (#5 Overall) on [DeepResearch Bench](https://github.com/Ayanami0730/deep_research_bench) — scoring **55.31** with the submitted version (Qwen3.5-Plus + GPT 5.2). [Leaderboard](https://huggingface.co/spaces/muset-ai/DeepResearch-Bench-Leaderboard) | [Agentic Insight v2](projects/deep_research/v2/README.md).
58+
5759
* 🚀 Mar 23, 2026: Release MS-Agent v1.6.0, which includes the following updates:
5860
- **Context Compression**: Added context compression mechanism with token usage monitoring, overflow detection, and automatic context compaction via pruning historical tool outputs and LLM-based summarization.
5961
- **Agentic Insight v2 Enhancements**: Major architecture and performance improvements to the deep research system; achieves **55.43** on DeepResearch Bench with GPT5 and Qwen3.5-plus/flash. See [Agentic Insight v2](https://github.com/modelscope/ms-agent/tree/main/projects/deep_research/v2).
@@ -330,7 +332,7 @@ This project provides a framework for **Deep Research**, enabling agents to auto
330332
331333
#### 🚀 Agentic Insight v2 (Recommended)
332334
333-
- **Performance**: Multi-model orchestration (a low-cost combo across qwen3-max/plus/flash) achieves **49.94** on DeepResearch Bench.
335+
- **Performance**: **#2 Open-Source** (#5 Overall) on [DeepResearch Bench](https://github.com/Ayanami0730/deep_research_bench) — **55.31** with the submitted version (Qwen3.5-Plus + GPT 5.2).
334336
- **Deep Agents architecture**: "Researcher + tool-augmented sub-agents (Searcher/Reporter)" for flexible task allocation and efficient concurrency.
335337
- **File system as context**: Structured artifacts persisted to disk for low-loss context handoff and stable long-horizon runs (resume-friendly).
336338
- **Evidence-driven writing**: Reports are grounded in an indexed evidence base, improving trustworthiness and traceability.

README_ZH.md

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -45,12 +45,14 @@ MS-Agent是一个轻量级框架,旨在为智能体提供自主探索能力。
4545

4646
> 历史存档版本,请参考:https://github.com/modelscope/ms-agent/tree/0.8.0
4747
48-
| 微信群
49-
|:-------------------------:
50-
| <img src="asset/ms-agent.jpg" width="200" height="200">
48+
[Discord Group](https://discord.gg/qmTFPY9byM) | 微信群
49+
:-------------------------:|:-------------------------:
50+
<img src="asset/discord_qr.jpg" width="200" height="200"> | <img src="asset/ms-agent.jpg" width="200" height="200">
5151

5252
## 🎉 新闻
5353

54+
- 🏆 **2026年4月9日**:Agentic Insight v2 在 [DeepResearch Bench](https://github.com/Ayanami0730/deep_research_bench) 上位列**开源方案 #2**(总榜 #5)——提交版本得分 **55.31**(Qwen3.5-Plus + GPT 5.2)。[排行榜](https://huggingface.co/spaces/muset-ai/DeepResearch-Bench-Leaderboard) | [Agentic Insight v2](projects/deep_research/v2/README.md)
55+
5456
- 🚀 **2026年3月23日:发布 MS-Agent v1.6.0,主要更新内容如下:**
5557
- **上下文压缩**:新增上下文压缩机制,支持 Token 用量监控与溢出检测,通过裁剪历史工具输出和 LLM 摘要自动压缩对话上下文。
5658
- **Agentic Insight v2 增强**:深度研究系统架构与性能大幅优化,基于 GPT5、Qwen3.5-plus/flash 模型组合在 DeepResearch Bench 上的评分达到 **55.43** 分。详情请参考 [Agentic Insight v2](https://github.com/modelscope/ms-agent/tree/main/projects/deep_research/v2)
@@ -333,7 +335,7 @@ asyncio.run(main())
333335

334336
#### 🚀 Agentic Insight v2(推荐)
335337

336-
- **性能表现** - 基于 qwen3-max/plus/flash 多模型协同(低成本组合),在 DeepResearch Bench 上取得 **49.94** 分,性能位于同类框架一线水平
338+
- **性能表现** - [DeepResearch Bench](https://github.com/Ayanami0730/deep_research_bench) **开源 #2**(总榜 #5),提交版本得分 **55.31**(Qwen3.5-Plus + GPT 5.2)
337339
- **Deep Agents 架构** - "Researcher + 工具化子 Agent(Searcher/Reporter)"模式,支持任务灵活分配与高效并发
338340
- **文件系统即上下文** - 中间产物结构化存储到文件系统,实现低损耗上下文传递和长链路任务稳定运行
339341
- **证据驱动写作** - 自主建立带索引的证据库,报告以证据为唯一事实基础,实现报告高可信度与来源可追溯

asset/discord_qr.jpg

6.16 KB
Loading

asset/ms-agent.jpg

-79.9 KB
Loading
Lines changed: 235 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,235 @@
1+
# ms-agent × nanobot Integration
2+
3+
This directory contains everything needed to use ms-agent's 14 MCP capabilities
4+
from within nanobot.
5+
6+
## Prerequisites
7+
8+
1. **ms-agent** installed (or available on `PYTHONPATH`)
9+
2. **nanobot** installed (`pip install nanobot` or dev install)
10+
3. **mcp** package installed (`pip install mcp`)
11+
4. API keys configured in a `.env` file (see [Environment & API Keys](#environment--api-keys))
12+
13+
## Quick Start
14+
15+
### Step 1: Verify ms-agent capabilities
16+
17+
```bash
18+
cd /path/to/ms-agent
19+
python3 -m ms_agent.capabilities.mcp_server --check
20+
```
21+
22+
Expected output: JSON listing all 14 capabilities.
23+
24+
### Step 2: Install the ms-agent skill into nanobot's workspace
25+
26+
```bash
27+
./install_skill.sh
28+
```
29+
30+
This copies the `ms-agent-skills/` directory into nanobot's workspace skills
31+
directory so that nanobot's context builder can load it.
32+
33+
### Step 3: Configure nanobot
34+
35+
```bash
36+
# Option A: Use this demo config directly
37+
nanobot agent -c examples/nanobot_integration/config.json
38+
39+
# Option B: Merge into your existing ~/.nanobot/config.json
40+
# Add the mcpServers block from config.json
41+
```
42+
43+
### Step 4: Test it
44+
45+
```bash
46+
# Interactive mode
47+
nanobot agent -c examples/nanobot_integration/config.json
48+
49+
# Or automated MCP test (no nanobot needed)
50+
python3 test_mcp_tools.py
51+
python3 test_mcp_tools.py --list # List tools only
52+
python3 test_mcp_tools.py --test ws # Test web search only
53+
```
54+
55+
## How It Works
56+
57+
```
58+
┌──────────────────────────────────────────────────────────┐
59+
│ nanobot │
60+
│ ┌──────────────────┐ ┌─────────────────────────────┐ │
61+
│ │ AgentLoop │ │ ToolRegistry │ │
62+
│ │ (ReAct pattern) │───▶│ ├── read_file, exec, ... │ │
63+
│ │ │ │ └── mcp_ms-agent_* ◄──┐ │ │
64+
│ └──────────────────┘ └─────────────────────┼───┘ │
65+
│ │ │
66+
│ ┌──────────────────┐ │ │
67+
│ │ ContextBuilder │ │ │
68+
│ │ ├── SOUL.md │ stdio │ │
69+
│ │ ├── Skills ◄─────┼── ms-agent SKILL.md │ │
70+
│ │ └── Memory │ │ │
71+
│ └──────────────────┘ │ │
72+
└─────────────────────────────────────────────────┼──────┘
73+
74+
75+
┌──────────────────────────────────────────────────────────┐
76+
│ ms-agent MCP Server (python -m ms_agent.capabilities. │
77+
│ mcp_server) │
78+
│ ┌────────────────────────────────────────────────────┐ │
79+
│ │ CapabilityRegistry (14 tools) │ │
80+
│ │ ├── web_search (arxiv/exa/serpapi) │ │
81+
│ │ ├── delegate_task (sync agent) │ │
82+
│ │ ├── submit_agent_task (async agent) │ │
83+
│ │ ├── check/get/cancel_agent_task │ │
84+
│ │ ├── submit_research_task (async research) │ │
85+
│ │ ├── check/get_research_progress/report │ │
86+
│ │ ├── lsp_check_directory (code validation) │ │
87+
│ │ ├── lsp_update_and_check │ │
88+
│ │ ├── replace_file_contents (concurrent-safe edit) │ │
89+
│ │ └── replace_file_lines │ │
90+
│ └────────────────────────────────────────────────────┘ │
91+
└──────────────────────────────────────────────────────────┘
92+
```
93+
94+
### Two Integration Layers
95+
96+
1. **MCP Tools** — nanobot connects to ms-agent's MCP server via stdio.
97+
All 14 capabilities appear as tools (prefixed `mcp_ms-agent_<name>`).
98+
The agent can call them directly during the ReAct loop.
99+
100+
2. **Skill Context** — the `ms-agent-skills/SKILL.md` is installed into
101+
nanobot's workspace. It teaches the agent *when* and *how* to use each
102+
MCP tool. The skill includes a decision guide and links to detailed
103+
reference docs for each capability.
104+
105+
## Test Prompts
106+
107+
### Web Search (instant)
108+
109+
> Search arxiv for recent papers on LLM agent frameworks.
110+
111+
### File Editing (instant)
112+
113+
> Create a file called test_demo.py with a hello world function, then use
114+
> replace_file_contents to rename the function from hello to greet.
115+
116+
### LSP Validation (1-5 min)
117+
118+
> Check the code in /path/to/project for TypeScript errors using LSP.
119+
120+
### Agent Delegation (sync, minutes)
121+
122+
> Use delegate_task to research and compare the top 3 Python async frameworks.
123+
124+
### Deep Research (async, 20-60 min)
125+
126+
> Research "the current state of AI agent frameworks in 2026" — submit it
127+
> as a background task and let me know when it's done.
128+
129+
### Agent Delegation (async)
130+
131+
> Submit an agent task to analyze the architecture of this project and suggest
132+
> improvements. Check on it periodically and show me the results when done.
133+
134+
## Environment & API Keys
135+
136+
The MCP server automatically loads a `.env` file on startup, so all
137+
capabilities (web search, deep research, agent delegation, etc.) and their
138+
subprocesses can access API keys without any extra configuration.
139+
140+
**Setup:** Create a `.env` file in the ms-agent project root:
141+
142+
```bash
143+
# LLM provider
144+
OPENAI_API_KEY=sk-xxx
145+
OPENAI_BASE_URL=https://dashscope.aliyuncs.com/compatible-mode/v1
146+
147+
# Search engines (optional, only needed if you use exa/serpapi)
148+
EXA_API_KEY=xxx
149+
SERPAPI_API_KEY=xxx
150+
```
151+
152+
**How it works:** The server uses `find_dotenv()` to walk up from the current
153+
directory and find the nearest `.env`. Variables already set in the process
154+
environment (e.g. via the MCP client `env` block or `export`) are **never**
155+
overwritten, so you can always override `.env` values per-session.
156+
157+
**Priority** (highest → lowest):
158+
159+
1. MCP client `env` block (in `config.json`)
160+
2. Shell `export` / system environment
161+
3. `.env` file
162+
163+
**Explicit path:** If your `.env` is not in an ancestor directory, pass it
164+
explicitly:
165+
166+
```json
167+
{
168+
"args": ["-m", "ms_agent.capabilities.mcp_server", "--env-file", "/path/to/.env"]
169+
}
170+
```
171+
172+
| Variable | Required by | Notes |
173+
|----------|-------------|-------|
174+
| `OPENAI_API_KEY` | deep_research, delegate_task | Any OpenAI-compatible provider |
175+
| `OPENAI_BASE_URL` | deep_research, delegate_task | Defaults to DashScope if unset in YAML |
176+
| `EXA_API_KEY` | web_search (exa engine) | Only needed for `engine_type='exa'` |
177+
| `SERPAPI_API_KEY` | web_search (serpapi engine) | Only needed for `engine_type='serpapi'` |
178+
179+
## MCP Configuration
180+
181+
The key block in `config.json`:
182+
183+
```json
184+
{
185+
"tools": {
186+
"mcpServers": {
187+
"ms-agent": {
188+
"command": "python3",
189+
"args": ["-m", "ms_agent.capabilities.mcp_server"],
190+
"env": {
191+
"PYTHONPATH": "/path/to/ms-agent",
192+
"MS_AGENT_OUTPUT_DIR": "/path/to/workspace"
193+
},
194+
"toolTimeout": 120,
195+
"enabledTools": ["*"]
196+
}
197+
}
198+
}
199+
}
200+
```
201+
202+
**Key settings:**
203+
204+
| Field | Description |
205+
|-------|-------------|
206+
| `command` + `args` | Launches the MCP server via stdio |
207+
| `env.PYTHONPATH` | Ensures ms-agent is importable |
208+
| `env.MS_AGENT_OUTPUT_DIR` | Workspace root for file operations |
209+
| `toolTimeout` | Seconds before tool call times out (120s recommended for delegate_task) |
210+
| `enabledTools` | `["*"]` for all tools, or list specific ones |
211+
212+
### Selective Tool Enablement
213+
214+
If you only need specific capabilities:
215+
216+
```json
217+
{
218+
"enabledTools": [
219+
"web_search",
220+
"replace_file_contents",
221+
"replace_file_lines",
222+
"submit_research_task",
223+
"check_research_progress",
224+
"get_research_report"
225+
]
226+
}
227+
```
228+
229+
## Files
230+
231+
| File | Purpose |
232+
|------|---------|
233+
| `config.json` | nanobot config with ms-agent MCP server |
234+
| `install_skill.sh` | Copies ms-agent skill to nanobot workspace |
235+
| `test_mcp_tools.py` | Standalone test that exercises MCP tools directly |
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
{
2+
"agents": {
3+
"defaults": {
4+
"model": "anthropic/claude-sonnet-4-20250514",
5+
"workspace": "~/.nanobot/workspace",
6+
"maxToolIterations": 40
7+
}
8+
},
9+
"providers": {
10+
"openrouter": {
11+
"apiKey": ""
12+
}
13+
},
14+
"tools": {
15+
"mcpServers": {
16+
"ms-agent": {
17+
"command": "python3",
18+
"args": ["-m", "ms_agent.capabilities.mcp_server"],
19+
"env": {
20+
"PYTHONPATH": "../../"
21+
},
22+
"toolTimeout": 300,
23+
"enabledTools": ["*"]
24+
}
25+
}
26+
}
27+
}
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
#!/usr/bin/env bash
2+
# Install ms-agent skill into nanobot's workspace skills directory.
3+
4+
set -euo pipefail
5+
6+
SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)"
7+
MS_AGENT_ROOT="$(cd "$SCRIPT_DIR/../.." && pwd)"
8+
SKILL_SRC="$MS_AGENT_ROOT/ms-agent-skills"
9+
10+
NANOBOT_WORKSPACE="${NANOBOT_WORKSPACE:-$HOME/.nanobot/workspace}"
11+
SKILL_DST="$NANOBOT_WORKSPACE/skills/ms-agent"
12+
13+
if [ ! -d "$SKILL_SRC" ]; then
14+
echo "ERROR: ms-agent-skills not found at $SKILL_SRC"
15+
exit 1
16+
fi
17+
18+
mkdir -p "$SKILL_DST"
19+
20+
cp -r "$SKILL_SRC/SKILL.md" "$SKILL_DST/"
21+
cp -r "$SKILL_SRC/references" "$SKILL_DST/" 2>/dev/null || true
22+
cp -r "$SKILL_SRC/scripts" "$SKILL_DST/" 2>/dev/null || true
23+
24+
echo "Installed ms-agent skill to: $SKILL_DST"
25+
echo ""
26+
echo "Contents:"
27+
find "$SKILL_DST" -type f | sort | while read -r f; do
28+
echo " $f"
29+
done
30+
echo ""
31+
echo "nanobot will now discover this skill automatically on next startup."

0 commit comments

Comments
 (0)