多代理推理服务

一个支持分布式推理和多代理协作的工具,适用于工具编排、结构化生成和短链推理场景。

  • by jmaycon
  • Java
  • 本地部署
  • 1 星标
  • 更新于
在 GitHub 查看 jmaycon/playground-a2a-missing-artifact-case

使用说明

“playground-a2a-missing-artifact-case” 可以翻译为:“操场A2A缺失工件案例” 或者更自然一点的表达:“A2A操场工件缺失情况”。这里,“playground”指的是“操场”,“a2a”可能是一个特定项目、区域或系统的标识,“missing-artifact”指的是“缺失的工件”或“缺失的部件”,“case”则指的是“情况”或“案例”

展示了具有分布式推理能力的多智能体系统

开始

代理,MCP网关,Otel(开放遥测技术)

docker compose up -d

Ollama(注:Ollama是一个用于本地运行大型语言模型的工具或框架的名称,直接翻译可能无具体含义,此处保留原英文以指代其特定用途或品牌)

下载并安装olama

安装推理模型

支持推理,但最好将其视为一种平衡的方式 遵循指令的模型——在工具协调方面表现出色, 结构化生成,以及简短的推理链

ollama pull llama3.1:8b-instruct-q4_K_M

使用curl进行测试

curl -X POST http://localhost:11434/api/chat \
  -H "Content-Type: application/json" \
  -d '{
    "model": "llama3.1:8b-instruct-q4_K_M",
    "prompt": "Say hello in one sentence."
  }'
 curl -v POST http://localhost:11434/api/generate \
    -H "Content-Type: application/json" \
    -d '{"model":"llama3.1:8b-instruct-q4_K_M","prompt":"Say hi"}'

调试MCP(多控制器协议/模块等,具体含义根据上下文确定)

此命令启动一个调试用户界面,使您能够验证可用的工具和资源。
您可以使用它直接与MCP服务器提供的工具进行交互,并验证其行为。

npx @modelcontextprotocol/inspector --transport sse http://localhost:30010/mcp/message

与Claude Desktop配合使用

使用您的服务时 Claude Desktop(可译为“Claude桌面版”),安装 mcp-proxy 软件包。
代理程序通过Claude Desktop运行,并使其能够调用您的服务。

安装后,在(相应位置)配置代理 claude_desktop_config.json 文件。
你可以从(某处)找到文件的位置 Claude 桌面版 → 设置 → 高级 → 配置文件路径。

如需更多详情,请参阅 npm 上的 mcp-remote 文档。

{
  "mcpServers": {
    "detective_sherlock": {
      "command": "npx",
      "args": [
        "-y",
        "mcp-remote",
        "http://localhost:30010/sse",
        "--allow-http"
      ]
    },
    "investigator_watson": {
      "command": "npx",
      "args": [
        "-y",
        "mcp-remote",
        "http://localhost:30011/sse",
        "--allow-http"
      ]
    },
    "museum_staff": {
      "command": "npx",
      "args": [
        "-y",
        "mcp-remote",
        "http://localhost:30012/sse",
        "--allow-http"
      ]
    },
    "security": {
      "command": "npx",
      "args": [
        "-y",
        "mcp-remote",
        "http://localhost:30013/sse",
        "--allow-http"
      ]
    }
  }
}

呼叫检查查看

http://localhost:8081/,密码=test

对于网关

访问 http://localhost:4444/

Claude桌面版的安装要求

python -m pip install --upgrade pip setuptools wheel
python -m pip install --force-reinstall --upgrade mcp-contextforge-gateway

“See”已被弃用,see(此处为误写,应忽略)Streamable HTTP 尚未实现

  • 请参阅 https://github.com/spring-projects/spring-ai/issues/3145
  • 另请参阅位于 https://gist.github.com/nagavijays/7439c331ffb6140ddc619b6b334c7564 的 gist(代码片段)