Token导航 LogoToken导航TokenDH.com
oxide (Yayoboy) logo
AI代理stdio官方级别未说明来源级核验

oxide (Yayoboy)

MCP Server

Oxide是一个用于管理和编排多个大型语言模型(LLM)服务的综合平台,通过智能路由任务到最合适的LLM,提供Web仪表板进行监控和管理,并支持与Claude Code的无缝集成。

工具数

3

提示词数

0

GitHub Stars

0

资源数

0
PythonClaudeAI代理Claude

安装说明

本站只整理中文说明和来源信息,不托管安装包,也不代用户安装。

作者 / 组织

yayoboy

提供方

yayoboy

最后核验

2026/5/17 20:21

运行时

Python

快速接入

先看主来源和安装命令,再打开仓库或文档;下面只保留这个条目的关键接入事实。

命令预览

uv run oxide-mcp --help

详细介绍

🔬 Oxide-智能LLM编排器

![CI](https://github.com/yayoboy/oxide/actions/workflows/ci.yml) ![Security](https://github.com/yayoboy/oxide/actions/workflows/security.yml) ![Deploy](https://github.com/yayoboy/oxide/actions/workflows/deploy.yml) ![Documentation](https://github.com/yayoboy/oxide/actions/workflows/docs.yml) ![License](LICENSE) ![Python](https://www.python.org/)

分布式人工智能资源的智能路由和编排

Oxide是一个用于管理和编排多个大型语言模型(LLM)服务的综合平台。它根据任务特征智能地将任务路由到最合适的LLM,提供用于监控和管理的web仪表板,并通过模型上下文协议(MCP)与Claude Code无缝集成。

✨ 特性

🎯 智能任务路由

  • 自动服务选择:分析任务类型、复杂性和文件数量,以选择最佳的LLM
  • 自定义路由规则:通过Web UI配置永久任务到服务分配
  • 后备支援:如果主服务不可用,则自动故障转移到替代服务
  • 并行执行:跨多个LLM分发大型代码库分析
  • 手动覆盖:为单个任务选择特定服务

🚀 本地法学硕士管理(新!)

  • 自动启动Olama:如果未运行,则自动启动Ollama(macOS、Linux、Windows)
  • 自动检测模型:无需手动配置即可发现可用型号
  • 智能模型选择:根据偏好和可用性选择最佳模型
  • 自动恢复:在临时故障时重新启动服务进行重试
  • 零配置LM工作室:适用于LM Studio,无需配置型号名称

🌐 网络仪表盘

  • 实时监控:CPU、内存、任务执行和服务运行状况的实时指标
  • 任务执行者:通过服务选择直接从浏览器执行任务
  • 任务分配管理器:配置哪些LLM处理特定的任务类型
  • 任务历史记录:所有已执行任务的完整历史记录,包括结果和指标
  • WebSocket支持:任务进度和系统事件的实时更新
  • 服务管理:监视和测试所有配置的LLM服务

🔌 MCP集成

  • Claude代码集成:直接在Claude Code中使用Oxide
  • 三个MCP工具:

- route_task -使用智能路由执行任务 - analyze_parallel -并行代码库分析 - list_services -检查服务运行状况和可用性

  • 持久任务存储:所有任务保存到 ~/.oxide/tasks.json
  • 自动启动Web UI:MCP服务器可选择自动启动Web UI

🛡️ 进程管理

  • 自动清理:退出时清理所有生成的进程(Web UI、Gemini、Qwen等)
  • 信号处理器:SIGTERM/SIGINT上的优雅关机
  • 进程注册表:跟踪所有子进程以确保清理
  • 无孤立进程:即使在强制终止的情况下,也能确保干净的系统状态

📊 支持的LLM服务

  • 谷歌双子座 (CLI)-2M+令牌上下文窗口,非常适合大型代码库
  • 通义 (CLI)-针对代码生成和审查进行了优化
  • 奥拉玛 (HTTP)-本地和远程实例
  • 可扩展:易于添加新的LLM适配器

🚀 快速开始

先决条件

  • Python 3.11+
  • uv包管理器
  • Node.js 18+(用于Web UI)
  • Gemini CLI(可选)
  • Qwen命令行界面(可选)
  • Ollama(可选)

安装

# Clone the repository
cd /Users/yayoboy/Documents/GitHub/oxide

# Install dependencies
uv sync

# Build the Web UI
cd src/oxide/web/frontend
npm install
npm run build
cd ../../..

# Verify installation
uv run oxide-mcp --help

配置

编辑 config/default.yaml:

services:
  gemini:
    enabled: true
    type: cli
    executable: gemini

  qwen:
    enabled: true
    type: cli
    executable: qwen

  ollama_local:
    enabled: true
    type: http
    base_url: http://localhost:11434
    model: qwen2.5-coder:7b
    default_model: qwen2.5-coder:7b

  ollama_remote:
    enabled: false
    type: http
    base_url: http://192.168.1.46:11434
    model: qwen2.5-coder:7b

routing_rules:
  prefer_local: true
  fallback_enabled: true

execution:
  timeout_seconds: 120
  max_retries: 2
  retry_on_failure: true
  max_parallel_workers: 3

logging:
  level: INFO
  console: true
  file: oxide.log

📖 用法

选项1:带克劳德代码的MCP

  1. 配置Claude代码

添加到 ~/.claude/settings.json:

{
  "mcpServers": {
    "oxide": {
      "command": "uv",
      "args": ["--directory", "/Users/yayoboy/Documents/GitHub/oxide", "run", "oxide-mcp"],
      "env": {
        "OXIDE_AUTO_START_WEB": "true"
      }
    }
  }
}

设置 OXIDE_AUTO_START_WEB=true 在以下位置自动启动Web UIhttp://localhost:8000

  1. 在克劳德代码中使用

Claude将自动使用Oxide MCP工具:

You: "Analyze this codebase for architecture patterns"
Claude: Uses Oxide to route to Gemini (large context)

You: "Review this function for bugs"
Claude: Uses Oxide to route to Qwen (code specialist)

You: "What is 2+2?"
Claude: Uses Oxide to route to Ollama Local (quick query)

选项2:Web仪表板

  1. 启动Web UI
# Option A: Use the startup script
./scripts/start_web_ui.sh

# Option B: Manual start
python -m uvicorn oxide.web.backend.main:app --host 0.0.0.0 --port 8000

# Option C: Auto-start with MCP (set OXIDE_AUTO_START_WEB=true)
uv run oxide-mcp
  1. 访问仪表板

打开http://localhost:8000在浏览器中

选项3:Python API

from oxide.core.orchestrator import Orchestrator
from oxide.config.loader import load_config

# Initialize
config = load_config()
orchestrator = Orchestrator(config)

# Execute a task with intelligent routing
async for chunk in orchestrator.execute_task(
    prompt="Explain quantum computing",
    files=None,
    preferences=None  # Let Oxide choose
):
    print(chunk, end="")

# Execute with manual service selection
async for chunk in orchestrator.execute_task(
    prompt="Review this code",
    files=["src/main.py"],
    preferences={"preferred_service": "qwen"}
):
    print(chunk, end="")

🏗️ 建筑

系统概述

┌──────────────────────────────────────────────────────────────┐
│                    Oxide Orchestrator                        │
├──────────────────────────────────────────────────────────────┤
│                                                              │
│  ┌──────────────┐   ┌──────────────┐   ┌──────────────┐   │
│  │  Classifier  │──▶│    Router    │──▶│   Adapters   │   │
│  └──────────────┘   └──────────────┘   └──────────────┘   │
│         │                   │                    │         │
│         │                   │                    │         │
│    Task Analysis      Route Decision       LLM Execution  │
│                                                              │
│  ┌──────────────────────────────────────────────────────┐  │
│  │  Process Manager - Lifecycle Management              │  │
│  └──────────────────────────────────────────────────────┘  │
│                                                              │
│  ┌──────────────────────────────────────────────────────┐  │
│  │  Task Storage - Persistent History                   │  │
│  └──────────────────────────────────────────────────────┘  │
│                                                              │
│  ┌──────────────────────────────────────────────────────┐  │
│  │  Routing Rules - Custom Assignments                  │  │
│  └──────────────────────────────────────────────────────┘  │
│                                                              │
└──────────────────────────────────────────────────────────────┘
           │                  │                   │
           ▼                  ▼                   ▼
    ┌───────────┐      ┌───────────┐      ┌──────────┐
    │  MCP      │      │  Web UI   │      │ Python   │
    │  Server   │      │  Backend  │      │ API      │
    └───────────┘      └───────────┘      └──────────┘

关键组件

1. 任务分类器 (src/oxide/core/classifier.py)

分析任务以确定:

  • 任务类型(编码、审查、代码库分析等)
  • 基于关键字和模式的复杂性评分
  • 文件数量和总大小
  • 并行执行是否有益

任务类型:

  • coding -代码生成
  • code_review -代码审查
  • bug_search -Bug分析
  • refactoring -代码重构
  • documentation -编写文档
  • codebase_analysis -大型代码库分析
  • quick_query -简单问题
  • general -一般用途

2. 任务路由器 (src/oxide/core/router.py)

根据以下内容路由任务:

  • 任务分类结果
  • 自定义路由规则(用户定义的永久分配)
  • 服务运行状况和可用性
  • 回退首选项和重试逻辑

3. 适配器 (src/oxide/adapters/)

不同LLM类型的统一接口:

  • CLI适配器 (cli_adapter.py):

- 双子座(gemini.py)-子流程执行,2M+上下文 - Qwen(qwen.py)-代码专家 - 自动进程跟踪和清理

  • HTTP适配器 (ollama_http.py):

- Ollama本地/远程-REST API通信 - 流媒体支持 - 健康检查

所有适配器都实现:

  • execute() -流式任务执行
  • health_check() -服务可用性检查
  • get_service_info() -服务元数据

4. 任务存储器 (src/oxide/utils/task_storage.py)

持久任务历史管理:

  • 存储: ~/.oxide/tasks.json
  • 线程安全:并发读/写支持
  • 跟踪数据:

- 任务ID、状态、时间戳 - 提示、文件、首选项 - 使用的服务,任务类型 - 结果、错误、持续时间

  • 特性:

- 按状态列出/筛选任务 - 获取统计数据(按服务、按类型、按状态) - 清除任务(全部或按状态)

5. 进程管理器 (src/oxide/utils/process_manager.py)

所有衍生流程的生命周期管理:

  • 轨迹:Web UI服务器、CLI进程(Gemini、Qwen)
  • 信号处理程序:符号、符号、符号
  • 清理:退出时自动(优雅→ 强制杀伤)
  • 安全:防止孤立进程
  • 铝矾土挂钩:最终清理保证

6. 路由规则管理器 (src/oxide/utils/routing_rules.py)

用户定义的任务到服务分配:

  • 存储: ~/.oxide/routing_rules.json
  • 格式: {"task_type": "service_name"}
  • 示例:
  {
    "coding": "qwen",
    "code_review": "gemini",
    "bug_search": "qwen",
    "quick_query": "ollama_local"
  }
  • 优先级:自定义规则覆盖智能路由

🎨 Web UI功能

仪表板部分

1. 系统指标 (实时)

  • 服务:总计、已启用、健康、不健康
  • 任务:正在运行、已完成、失败、排队
  • 系统:CPU百分比、内存百分比和使用率
  • 双向通信:活动连接
  • 每2秒自动刷新一次

2. 任务执行者 🚀

直接从浏览器执行任务:

  • 提示输入:多行文本区域
  • 服务选择:

- 🤖 自动 (智能路由)-让Oxide选择 - 手册 -选择特定服务(gemini、qwen、ollama等)

  • 实时流媒体:查看结果
  • 错误处理:清除错误消息
  • 整合:任务立即出现在历史记录中

3. LLM服务

服务卡显示:

  • 状态: ✅ 健康/⚠️ 不可用/❌ 残疾的
  • 类型:CLI或HTTP
  • 描述:服务能力
  • 详情:基本URL(HTTP),可执行文件(CLI)
  • 上下文:最大代币数(双子座:2M+)

4. 任务分配管理器 ⚙️ ⭐ 新

配置永久任务到服务分配:

接口:

  • 添加规则表单:

- 下拉菜单:选择任务类型(编码、审核等) - 下拉菜单:选择服务(qwen、gemini、ollama) - 按钮:添加规则

  • 活动规则表:

- 任务类型|分配的服务|描述|操作 - 删除单个规则 - 清除所有规则

可用任务类型:

  • 编程 → 代码生成→ 推荐:qwen,双子座
  • 代码查看 → 代码审查→ 推荐:qwen,双子座
  • bug_search → Bug搜索→ 推荐:qwen,双子座
  • 重构 → 代码重构→ 推荐:qwen,双子座
  • 文档 → 文档→ 推荐:双子座,qwen
  • 代码库分析 → 大型代码库→ 推荐:双子座
  • 快速查询 → 简单问题→ 推荐:ollama_local
  • 通用 → 通用→ 推荐:ollama_local,qwen

配置示例:

coding → qwen           (All code generation to qwen)
code_review → gemini    (All reviews to gemini)
bug_search → qwen       (Bug analysis to qwen)
quick_query → ollama    (Fast queries to local ollama)

当任务与规则匹配时 总是 绕过智能路由,路由到指定的服务。

5. 任务历史记录 📝

所有已执行任务的完整历史记录:

  • 来自所有来源:MCP、Web UI、Python API
  • 自动刷新:每3秒
  • 显示:

- 状态徽章(已完成、正在运行、失败、排队) - 时间戳、持续时间 - 快速预览(前150个字符) - 使用的服务,任务类型 - 文件计数 - 错误消息(如果失败) - 结果预览(前200个字符)

  • 限制:默认情况下最近10个任务

6. 实时更新 🔔

WebSocket事件流:

  • 实时任务进度
  • 服务状态更改
  • 系统事件

📡 api参考

REST API

基本URL: http://localhost:8000/api

任务端点

执行任务

POST /api/tasks/execute
Content-Type: application/json

{
  "prompt": "Your query here",
  "files": ["path/to/file.py"],
  "preferences": {
    "preferred_service": "qwen"
  }
}

Response: {"task_id": "...", "status": "queued", "message": "..."}

列出任务

GET /api/tasks/?limit=10&status=completed

Response: {
  "tasks": [...],
  "total": 42,
  "filtered": 10
}

获取任务

GET /api/tasks/{task_id}

Response: {
  "id": "...",
  "status": "completed",
  "prompt": "...",
  "result": "...",
  "duration": 5.23,
  ...
}

删除任务

DELETE /api/tasks/{task_id}

清除任务

POST /api/tasks/clear?status=completed

服务端点

列表服务

GET /api/services/

Response: {
  "services": {
    "gemini": {"enabled": true, "healthy": true, ...},
    ...
  },
  "total": 4,
  "enabled": 3
}

获取服务

GET /api/services/{service_name}

健康检查

POST /api/services/{service_name}/health

测试服务

POST /api/services/{service_name}/test?test_prompt=Hello

路由规则端点⭐ 新

列出所有规则

GET /api/routing/rules

Response: {
  "rules": [
    {"task_type": "coding", "service": "qwen"},
    ...
  ],
  "stats": {
    "total_rules": 3,
    "rules_by_service": {"qwen": 2, "gemini": 1},
    "task_types": ["coding", "code_review", "bug_search"]
  }
}

获取规则

GET /api/routing/rules/{task_type}

创建/更新规则

POST /api/routing/rules
Content-Type: application/json

{
  "task_type": "coding",
  "service": "qwen"
}

Response: {
  "message": "Routing rule updated",
  "rule": {"task_type": "coding", "service": "qwen"}
}

更新规则

PUT /api/routing/rules/{task_type}
Content-Type: application/json

{
  "task_type": "coding",
  "service": "gemini"
}

删除规则

DELETE /api/routing/rules/{task_type}

清除所有规则

POST /api/routing/rules/clear

获取可用任务类型

GET /api/routing/task-types

Response: {
  "task_types": [
    {
      "name": "coding",
      "label": "Code Generation",
      "description": "Writing new code, implementing features",
      "recommended_services": ["qwen", "gemini"]
    },
    ...
  ]
}

监控端点

获取指标

GET /api/monitoring/metrics

Response: {
  "services": {"total": 4, "enabled": 3, "healthy": 2, ...},
  "tasks": {"total": 10, "running": 0, "completed": 8, ...},
  "system": {"cpu_percent": 25.3, "memory_percent": 45.7, ...},
  "websocket": {"connections": 1},
  "timestamp": 1234567890.123
}

获取统计信息

GET /api/monitoring/stats

Response: {
  "total_tasks": 42,
  "avg_duration": 5.67,
  "success_rate": 95.24,
  "tasks_by_status": {"completed": 40, "failed": 2}
}

健康检查

GET /api/monitoring/health

Response: {
  "status": "healthy",
  "healthy": true,
  "issues": [],
  "cpu_percent": 25.3,
  "memory_percent": 45.7
}

Websocket API

连接到 ws://localhost:8000/ws 实时更新。

消息类型:

  1. 任务启动
{
  "type": "task_start",
  "task_id": "...",
  "task_type": "coding",
  "service": "qwen"
}
  1. 任务进展 (流媒体)
{
  "type": "task_progress",
  "task_id": "...",
  "chunk": "Here is the code..."
}
  1. 任务完成
{
  "type": "task_complete",
  "task_id": "...",
  "success": true,
  "duration": 5.23
}

客户端使用情况:

const ws = new WebSocket('ws://localhost:8000/ws');

ws.onmessage = (event) => {
  const data = JSON.parse(event.data);
  if (data.type === 'task_progress') {
    console.log(data.chunk);
  }
};

// Keep-alive ping
setInterval(() => ws.send('ping'), 30000);

🔧 发展

项目结构

oxide/
├── config/
│   └── default.yaml                # Main configuration
├── src/oxide/
│   ├── core/
│   │   ├── classifier.py           # Task classification
│   │   ├── router.py               # Routing logic
│   │   └── orchestrator.py         # Main orchestrator
│   ├── adapters/
│   │   ├── base.py                 # Base adapter interface
│   │   ├── cli_adapter.py          # CLI adapter base
│   │   ├── gemini.py               # Gemini adapter
│   │   ├── qwen.py                 # Qwen adapter
│   │   └── ollama_http.py          # Ollama HTTP adapter
│   ├── execution/
│   │   └── parallel.py             # Parallel execution engine
│   ├── utils/
│   │   ├── task_storage.py         # Task persistence
│   │   ├── routing_rules.py        # Routing rules storage
│   │   ├── process_manager.py      # Process lifecycle
│   │   ├── logging.py              # Logging utilities
│   │   └── exceptions.py           # Custom exceptions
│   ├── mcp/
│   │   ├── server.py               # MCP server (FastMCP)
│   │   └── tools.py                # MCP tool definitions
│   └── web/
│       ├── backend/
│       │   ├── main.py             # FastAPI application
│       │   ├── websocket.py        # WebSocket manager
│       │   └── routes/
│       │       ├── tasks.py        # Task endpoints
│       │       ├── services.py     # Service endpoints
│       │       ├── routing.py      # Routing rules endpoints
│       │       └── monitoring.py   # Monitoring endpoints
│       └── frontend/               # React SPA
│           ├── src/
│           │   ├── components/
│           │   │   ├── TaskExecutor.jsx
│           │   │   ├── TaskAssignmentManager.jsx
│           │   │   ├── TaskHistory.jsx
│           │   │   ├── ServiceCard.jsx
│           │   │   └── MetricsDashboard.jsx
│           │   ├── hooks/
│           │   │   ├── useServices.js
│           │   │   ├── useMetrics.js
│           │   │   └── useWebSocket.js
│           │   ├── api/
│           │   │   └── client.js
│           │   └── App.jsx
│           ├── package.json
│           └── vite.config.js
├── tests/
│   ├── test_process_cleanup.py
│   └── test_task_history_integration.py
└── scripts/
    └── start_web_ui.sh

运行测试

# Process cleanup tests
python3 tests/test_process_cleanup.py

# Task history integration tests
python3 tests/test_task_history_integration.py

# All tests pass
# ✓ Sync process cleanup
# ✓ Async process cleanup
# ✓ Multiple process cleanup
# ✓ Signal handler cleanup
# ✓ Task storage integration

添加新的LLM适配器

  1. 创建适配器类
# src/oxide/adapters/my_llm.py
from .base import BaseAdapter
from typing import AsyncIterator, List, Optional

class MyLLMAdapter(BaseAdapter):
    def __init__(self, config: dict):
        super().__init__("my_llm", config)
        self.api_key = config.get("api_key")
        # Initialize your client...

    async def execute(
        self,
        prompt: str,
        files: Optional[List[str]] = None,
        timeout: Optional[int] = None,
        **kwargs
    ) -> AsyncIterator[str]:
        """Execute task and stream results."""
        # Your implementation
        yield "Response chunk"

    async def health_check(self) -> bool:
        """Check if service is available."""
        # Your health check logic
        return True

    def get_service_info(self) -> dict:
        """Return service metadata."""
        info = super().get_service_info()
        info.update({
            "description": "My LLM Service",
            "max_tokens": 100000
        })
        return info
  1. 在配置中注册
# config/default.yaml
services:
  my_llm:
    enabled: true
    type: http  # or 'cli'
    base_url: http://localhost:8080
    model: my-model
    api_key: ${MY_LLM_API_KEY}  # From environment
  1. 更新编排器
# src/oxide/core/orchestrator.py
def _create_adapter(self, service_name, config):
    service_type = config.get("type")

    if service_type == "cli":
        if "my_llm" in service_name:
            from ..adapters.my_llm import MyLLMAdapter
            return MyLLMAdapter(config)
        # ... other CLI adapters

    elif service_type == "http":
        if "my_llm" in service_name:
            from ..adapters.my_llm import MyLLMAdapter
            return MyLLMAdapter(config)
        # ... other HTTP adapters
  1. 测试适配器
import asyncio
from oxide.core.orchestrator import Orchestrator
from oxide.config.loader import load_config

async def test():
    config = load_config()
    orchestrator = Orchestrator(config)

    async for chunk in orchestrator.execute_task(
        prompt="Test query",
        preferences={"preferred_service": "my_llm"}
    ):
        print(chunk, end="")

asyncio.run(test())

📊 存储文件

Oxide在中创建以下文件 ~/.oxide/:

  • tasks.json -任务执行历史记录(来自所有来源的所有任务)
  • routing_rules.json -自定义路由规则(任务类型→ 服务)
  • 氧化测井 -应用程序日志(如果启用了文件日志记录)

示例 tasks.json:

{
  "task-uuid-1": {
    "id": "task-uuid-1",
    "status": "completed",
    "prompt": "What is quantum computing?",
    "files": [],
    "service": "ollama_local",
    "task_type": "quick_query",
    "result": "Quantum computing is...",
    "error": null,
    "created_at": 1234567890.123,
    "started_at": 1234567890.456,
    "completed_at": 1234567895.789,
    "duration": 5.333
  }
}

示例 routing_rules.json:

{
  "coding": "qwen",
  "code_review": "gemini",
  "bug_search": "qwen",
  "quick_query": "ollama_local"
}

🎯 本地法学硕士管理

自动启动Olama

如果Ollama没有运行,Oxide可以自动启动它:

# config/default.yaml
services:
  ollama_local:
    type: http
    base_url: "http://localhost:11434"
    api_type: ollama
    enabled: true
    auto_start: true              # 🔥 Auto-start if not running
    auto_detect_model: true       # 🔥 Auto-detect best model
    max_retries: 2                # Retry on failures
    retry_delay: 2                # Seconds between retries

发生了什么:

  1. 第一个任务执行检查Ollama是否正在运行
  2. 如果没有,则通过以下方式自动启动Ollama:

- macOS:打开Ollama.app或运行 ollama serve - Linux:使用systemd或运行 ollama serve - Windows:运行 ollama serve 作为分离过程

  1. 等待Ollama准备就绪的时间长达30秒
  2. 执行任务的收益

自动检测模型

无需手动配置模型名称:

lmstudio:
  type: http
  base_url: "http://192.168.1.33:1234/v1"
  api_type: openai_compatible
  enabled: true
  default_model: null           # 🔥 Will auto-detect
  auto_detect_model: true
  preferred_models:             # Priority order
    - "qwen"                    # Matches: qwen/qwen2.5-coder-14b
    - "coder"                   # Matches: mistralai/codestral-22b
    - "deepseek"                # Matches: deepseek/deepseek-r1

智能选择算法:

  1. 从服务中获取可用型号
  2. 尝试与首选型号完全匹配
  3. 尝试部分匹配(例如,“qwen”匹配“qwen2.5编码器:7b”)
  4. 退回到第一个可用的型号

服务健康监测

from oxide.utils.service_manager import get_service_manager

service_manager = get_service_manager()

# Comprehensive health check with auto-recovery
health = await service_manager.ensure_service_healthy(
    service_name="ollama_local",
    base_url="http://localhost:11434",
    api_type="ollama",
    auto_start=True,           # Try to start if down
    auto_detect_model=True     # Detect available models
)

print(f"Healthy: {health['healthy']}")
print(f"Models: {health['models']}")
print(f"Recommended: {health['recommended_model']}")

背景健康监测

# Start monitoring (checks every 60s, auto-recovers on failure)
await service_manager.start_health_monitoring(
    service_name="ollama_local",
    base_url="http://localhost:11434",
    interval=60,
    auto_recovery=True
)

🎯 使用示例

示例1:简单查询(启用自动启动)

# Ollama will auto-start if not running!
async for chunk in orchestrator.execute_task("What is 2+2?"):
    print(chunk, end="")

# What happens:
# 1. Checks if Ollama is running → not running
# 2. Auto-starts Ollama (takes ~5s)
# 3. Auto-detects model: qwen2.5-coder:7b
# 4. Executes task
# 5. Returns: "4"

示例2:手动选择的代码审查

async for chunk in orchestrator.execute_task(
    prompt="Review this code for bugs",
    files=["src/auth.py"],
    preferences={"preferred_service": "gemini"}
):
    print(chunk, end="")

# Forces routing to: gemini
# Gets large context window for thorough review

示例3:大型代码库分析

# Parallel analysis
from oxide.execution.parallel import ParallelExecutor

executor = ParallelExecutor(max_workers=3)

result = await executor.execute_parallel(
    prompt="Analyze architecture patterns",
    files=["src/**/*.py"],  # 50+ files
    services=["gemini", "qwen", "ollama_local"],
    strategy="split"
)

print(f"Completed in {result.total_duration_seconds}s")
print(result.aggregated_text)

示例4:使用路由规则

# Set up rules via API
import requests

requests.post("http://localhost:8000/api/routing/rules", json={
    "task_type": "coding",
    "service": "qwen"
})

# Now all coding tasks go to qwen automatically
async for chunk in orchestrator.execute_task("Write a Python function to sort a list"):
    print(chunk, end="")

# Routes to: qwen (custom rule)

🤝 贡献

欢迎投稿!拜托:

  1. 克隆该仓库
  2. 创建要素分支(git checkout -b feature/amazing-feature)
  3. 进行更改
  4. 如果适用,添加测试
  5. 更新文档
  6. 提交您的更改(git commit -m 'Add amazing feature')
  7. 推到分支(git push origin feature/amazing-feature)
  8. 打开拉取请求

开发设置

# Clone your fork
git clone https://github.com/yourusername/oxide.git
cd oxide

# Install dev dependencies
uv sync

# Install frontend dependencies
cd src/oxide/web/frontend
npm install
cd ../../..

# Run tests
python3 tests/test_process_cleanup.py
python3 tests/test_task_history_integration.py

# Start development servers
python -m uvicorn oxide.web.backend.main:app --reload &
cd src/oxide/web/frontend && npm run dev

📝 许可证

麻省理工学院许可证-版权所有(c)2025 yayoboy

有关详细信息,请参阅LICENSE文件。

👥 作者

  • 不可用 - *初步工作* -esoglobine@gmail.com

🙏 致谢

  • 建于 快速API -现代Python web框架
  • React仪表板使用 维特 -闪电般快速的前端工具
  • MCP集成通过 模型上下文协议
  • 受主管和系统模式启发的流程管理
  • 通过以下方式支持WebSocket FastAPI WebSockets
  • 受语义分析技术启发的任务分类

📧 支持

对于问题、疑问或建议:

  • GitHub 问题:
  • 电子邮件:esoglobine@gmail.com

🗺️ 路线图

v0.2.0(计划中)

  • \[\]用于任务存储的SQLite数据库
  • \[\]高级指标和分析
  • \[\]每项服务的成本跟踪
  • \[\]利率限制和配额
  • \[\]多用户支持
  • \[\]Docker部署

v0.3.0(未来)

  • \[\]自定义适配器的插件系统
  • \[\]工作流自动化(任务链)
  • \[\]A/B测试框架
  • \[\]性能基准测试套件
  • \[\]并行执行的自动缩放

📊 项目状态

版本: 0.1.0 状态: ✅ 生产准备就绪-MVP完成!

已完成的功能

  • \[x\] 项目结构和依赖关系
  • \[x\] 配置系统
  • \[x\] 任务分类器
  • \[x\] 带回退功能的任务路由器
  • \[x\] 适配器实现(Gemini、Qwen、Ollama)
  • \[x\] MCP服务器集成
  • \[x\] Web UI仪表板(React+FastAPI)
  • \[x\] 实时监控和WebSocket
  • \[x\] Web UI中的任务执行器
  • \[x\] 任务分配管理器(路由规则UI)
  • \[x\] 持久任务存储
  • \[x\] 流程生命周期管理
  • \[x\] 测试套件(流程清理、任务存储)
  • \[x\] 全面的文件

进行中

  • \[\]生产部署指南
  • \[\]Docker容器化
  • \[\]扩展测试覆盖范围

______________________________________________________________________

建于❤️ 用于智能LLM编排

最后更新:2025年12月

目录标签

目录标签

PythonClaudeAI代理LLM编排本地部署智能路由任务管理分布式AI模型集成

支持客户端

Claude

接入字段

传输方式(transport,传输协议)

stdio

鉴权方式(authType,认证方式)

none

运行时(runtime,运行环境)

Python

工具数量(toolCount,工具数)

3

资源数量(resourceCount,资源数)

0

提示词数量(promptCount,提示词数)

0

权限和风险

stdionone部署方式未说明

接入前请确认传输方式、认证方式和部署位置,并根据实际工具能力限制访问范围。

安装前确认

不要直接授予不必要的文件、网络或账号权限;先核对安装命令和配置内容。

来源信息

继续浏览同类 MCP