Hotdry.
ai-systems

用 Devstral2 与 Vibe CLI 5 分钟搭出可迭代的多 Agent 流式调试链路

从 curl 一键安装到 MCP 多节点异步编排,给出本地最小闭环与生产级参数,让 Mistral 新开源的代码模型真正跑起来。

1. 一句话卖点

Mistral 昨夜开源的 Devstral2 把 72.2% SWE-bench Verified 的代码能力塞进 123B,同时放出 Vibe CLI—— 一个 Apache 2.0 的终端智能体。只要一条 curl 命令,你就能在本地 5 分钟搭出「grep → 读 → 改 → 测」的可迭代多 Agent 流式调试链路,而且 Small 版 24B 能在单张 RTX 4090 上跑,完全零云成本。

2. 安装与最小配置

# Python ≥3.12 已预装
curl -LsSf https://mistral.ai/vibe/install.sh | bash
# 装完 which vibe 能看到路径即可

首次运行自动生成 ~/.vibe/config.toml,把下面三行粘进去就能连本地模型:

[model]
provider = "mistral"              # 也支持 openai、openrouter
name = "devstral-small-2"        # 123B 用 devstral-2,需要 4×H100
api_key = "${MISTRAL_API_KEY}"   # 优先读环境变量

想本地跑 24B,可以用 vLLM 起 OpenAI-compatible 端点:

vllm serve mistralai/Devstral-Small-2 --dtype half --max-model-len 32768

然后把 provider = "openai"base_url = "http://127.0.0.1:8000/v1" 写进配置即可。

3. 单 Agent 快速验证

进入项目根目录,直接对话:

vibe
> 找到所有 TODO,给出优先级并修复最简单的那个

Vibe 会自动:

  1. grep -R "TODO" . → 拿到列表
  2. read_file 拉取上下文
  3. search_replace 生成块级 diff
  4. bash 跑单测验证
  5. todo 工具把任务标为 DONE

整个过程流式输出,每步可人工确认,也可 --auto-approve 一键通过。历史默认落盘 ~/.vibe/logs/,支持回滚到任意步骤,相当于把 Git 版本细化到「AI 操作」粒度。

4. 多 Agent 流式编排

Vibe 内置 MCP(Model Context Protocol)客户端,可把多个 vibe 进程作为 streamable-http 节点串成异步图。示例场景:

  • Agent-A 只读,做静态审计(disabled_tools = ["write_file", "bash"]
  • Agent-B 负责写代码,拥有全部工具
  • Agent-C 专门跑测试,只保留 bashtodo

配置片段:

[[mcp_servers]]
name = "auditor"
transport = "streamable-http"
url = "http://localhost:9001/mcp"

[[mcp_servers]]
name = "coder"
transport = "streamable-http"
url = "http://localhost:9002/mcp"

[[mcp_servers]]
name = "tester"
transport = "streamable-http"
url = "http://localhost:9003/mcp"

启动命令:

# 窗口 1:只读审计节点
VIBE_HOME=~/.vibe-auditor vibe --agent auditor --port 9001

# 窗口 2:编码节点
VIBE_HOME=~/.vibe-coder vibe --agent coder --port 9002

# 窗口 3:测试节点
VIBE_HOME=~/.vibe-tester vibe --agent tester --port 9003

主节点里可直接 @auditor:grep(pattern="assert.*==")@coder:search_replace(...),实现异步并行 + 工具级权限隔离,比单进程跑全权限更安全。

5. 可落地参数与监控

场景 推荐参数
本地 24B 轻量试用 --max-model-len 32768 --gpu-memory-utilization 0.9
长代码库 256K ctx 分段 read_file 每次 ≤64 k,避免 OOM
CI 脚本化 vibe --prompt "..." --auto-approve 配合白名单 enabled_tools = ["grep", "read_file", "bash"]
企业合规 关闭 bash 权限,disabled_tools = ["bash"];所有写操作强制人工确认
日志审计 默认 ~/.vibe/logs/ 按天滚动,可 export VIBE_LOG_LEVEL=debug 输出 token 用量

6. 小结与下一步

  • 5 分钟拿到一个「grep → 读 → 改 → 测」的本地闭环,Small 版 24B 就能跑;123B 留给有 4×H100 的土豪。
  • 用 MCP 把多个 vibe 节点串成异步图,轻松实现只读审计 / 写代码 / 跑测试的三权分立。
  • 修改版 MIT 许可证对月收入 2000 万美元以上企业生效,微调衍生品同样受限;小公司可放心白嫖。

下一步可以:

  1. 把 Vibe 节点封装成容器,通过 docker-compose 一键扩缩容;
  2. Prometheus + Grafana 采集 vibe_logs 里的 token 用量、工具调用次数,做实时成本面板;
  3. 把审计节点的 mcp_* 工具输出接到 LangFuse 做追踪,形成完整 LLMOps 闭环。

参考资料

查看归档