Multi-Agent Recursive Engineering Framework
Project description
MAREF — Agent Governance OS
Multi-Agent Recursive Engineering Framework
全球唯一以"Agent 治理"为核心产品定位的框架。 在治理深度上碾压所有竞品(10/10 vs 0-3),将 Agent 治理作为独立的价值主张而非安全 feature。
MAREF 是 Agent 世界的操作系统内核 — 管理 Agent 集群的生命周期、安全边界、状态健康和进化方向。
趋势
核心能力
治理层 (世界领先)
- 三种 Loop 元模式 — 收敛型/探索型/交互型 模板库 🚧 (v0.36.0-rc)
- 10 态 Gray Code 治理状态机 — 数学可证明收敛性 (6bit, 汉明距离=1)
- TLA+ 形式化验证 — 5 定理证明 (Lyapunov收敛 + Sperner完备性)
- CircuitBreaker — 3连败自动锁 + HALT 吸收态 + 30s 冷却
- 四级安全决策树 — Rule→Mode→SafetyGate→User, 97% 自动化率
- LoRA/本体双重漂移检测 — KL/JS/Hellinger 三重散度 + 人工仲裁
- Verifier 交叉验证 — VerifierRegistry + VerifierConsensus (加权多数/一致通过)
- MAREFLoop 适配器 — 5 行代码为任意 Loop 接入 MAREF 治理
操作层
- 桌面 Agent 操控 — 截图→解析→键鼠→验证 完整闭环 (macOS/Linux/Windows)
- 多 Agent 任务编排 — TaskDAG 分解 + 5维 Agent 分发 + Saga 补偿事务
- SubAgent 上下文隔离 — Git Worktree 式, 96% Token 节省
- 移动→桌面任务桥接 — mDNS 发现 + 幂等任务队列 + SSE 推送
- 浏览器安全操控 — Playwright + 安全域名白名单 + 认证会话管理
进化层
- 递归自演进引擎 — C1(观测)→C2(优化)→C3(收敛) 三循环
- 红蓝对抗 — 200 轮 5 阶段, 攻击强度 2.47→18.98 (7.7×)
- 混沌工程 — 5 类 LLM 故障注入 (延迟/错误/截断/幻觉/超时)
- 记忆三温框架 — Hot/Warm/Cold 三层记忆架构
- Trust Engine v2 — 5 因子加权 + Goodhart 抗策略操纵检测
生态层
- A2A/MCP 双协议 — A2A v0.3 + MCP 6 种传输
- 跨框架适配器 — AutoGen/CrewAI/LangGraph/Dify/Coze 生产级
- OpenTelemetry — Prometheus + Grafana + OTLP 全链路可观测
- Serverless 运行时 — Lambda / Cloud Run 适配
- TypeScript SDK —
@maref/sdknpm 包
快速开始
5 分钟上手指南
# 1. 安装 MAREF
pip install maref
# 2. 运行环境诊断 (15项检查)
python scripts/check_desktop_env.py
# 3. 启动桌面 Agent 演示 (安全 dry-run 模式)
maref desktop demo
# 4. 启动 Sidecar 服务
maref serve --port 8000
# 5. 访问 GUI
open http://localhost:8000
快速启动示例
方式一:命令行模式
# 一键安装
pip install maref
# 治理状态查询
maref status
# 桌面 Agent 演示
maref desktop demo
# 启动服务
maref serve --port 8000 --gui
方式二:Python API
from maref_lite.governance import GovernanceOverlay
from maref_lite.state_machine import GovernanceState
overlay = GovernanceOverlay()
overlay._state_machine.transition(GovernanceState.OBSERVE)
overlay._state_machine.transition(GovernanceState.ANALYZE)
print(overlay.get_status())
# --- Loop Engineering (v0.36.0-rc) ---
from maref.loop.convergent import ConvergentLoop
from maref.loop.exploratory import ExploratoryLoop
from maref.loop.interactive import InteractiveLoop
from maref.loop.bridge import LoopGovernanceBridge
async def example():
loop = ConvergentLoop(
solve_fn=lambda x: {"score": 0.95, "output": x},
max_rounds=10,
)
bridge = LoopGovernanceBridge()
result = await bridge.run_governed(loop, "example input")
print(result.stop_reason, result.rounds_completed)
方式三:完整项目示例
# 克隆仓库
git clone https://github.com/maref-org/maref.git
cd maref
# 使用 uv 创建虚拟环境 (推荐)
uv venv
source .venv/bin/activate
# 安装依赖
uv pip install -e ".[all]"
# 运行测试
pytest tests/ -v --tb=short
# 启动完整演示
python examples/simple_integration_demo.py
常见问题
| 问题 | 解决方案 |
|---|---|
| 安装失败 | pip install --upgrade pip 后重试 |
| 桌面操控权限问题 | 在系统设置中授予辅助功能权限 |
| 端口被占用 | 使用 --port 指定其他端口 |
| 依赖冲突 | 使用 uv venv 创建隔离环境 |
架构
MAREF: Agent 治理操作系统
┌─────────────────────────────────────────────────────────┐
│ 应用层 ─── LangGraph / CrewAI / AutoGen / Anthropic │
│ (编排/操控/开发框架) │
│ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ │
│ 治理层 ─── MAREF (本框架) │
│ · 状态机 · 熔断器 · 四级决策树 │
│ · 身份/信任 · 漂移检测 · 形式化验证 │
│ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ │
│ 通信层 ─── A2A / MCP (Google/Anthropic 标准) │
└─────────────────────────────────────────────────────────┘
竞品对比
| 维度 | MAREF | Anthropic | OpenAI | LangGraph | CrewAI | AutoGen |
|---|---|---|---|---|---|---|
| 治理/安全 | 10 | 4 | 3 | 2 | 1 | 1 |
| Loop 集成 (Verifier×Governance) | 10 | 6 | 0 | 0 | 0 | 0 |
| Loop 元模式模板 (收/探/交) | ✅ v36 | 0 | 0 | 0 | 0 | 0 |
| 形式化验证 | 10 | 0 | 0 | 0 | 0 | 0 |
| 漂移检测 | 9 | 0 | 0 | 0 | 0 | 0 |
| 桌面操控 | 8 | 9 | 7 | 0 | 0 | 0 |
| 编排 | 7 | 8 | 8 | 9 | 8 | 8 |
| 身份/信任 | 7 | 0 | 0 | 0 | 0 | 0 |
| 社区/生态 | 3 | 8 | 9 | 8 | 9 | 8 |
贡献者
最新 Release
健康度
| 指标 | 状态 |
|---|---|
| CI | |
| Tests | 4,300+ — |
| Coverage | 82% — |
| CodeQL | |
| Security | |
| SonarCloud | |
| Python | |
| License | |
| Version |
路线图
- v0.1.0-v0.20.0: 工程基础设施 + 形式化验证 + Sidecar + 漂移 + 混沌 + A2A + Identity + 编排 + Desktop Agent → GA
- Phase Ω (R101-R150): 50 轮自主递归演进全量补强 → v0.21.0 Final
- v0.30.0-GA: 人机协同层 + 记忆层 + 技能市场层 + 国密 SM2/SM3/SM4-GCM + 技术白皮书
- v0.35.0-rc: Loop Engineering 叙事层 + 三种元模式架构设计 + Verifier 交叉验证 + 覆盖率 60%+ 模块达标
- v0.36.0-rc:
maref.loop模块实现 — ConvergentLoop / ExploratoryLoop / InteractiveLoop + LoopGovernanceBridge + TrustBoundary 集成 - v1.0: 递归进化全栈 + Agent 信用评级 + 四象治理模型
- v2.0: 元 Agent 闭包 + 碳硅共生 + 八卦治理
许可证
Apache License 2.0 — LICENSE
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
maref-0.36.0rc0.tar.gz
(3.5 MB
view details)
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file maref-0.36.0rc0.tar.gz.
File metadata
- Download URL: maref-0.36.0rc0.tar.gz
- Upload date:
- Size: 3.5 MB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
3b1bc0dcc584947a41211910918b82f66abe7e2dc607a0ca15669f72eb481a50
|
|
| MD5 |
69dcc41e35a849721e7cf326c94a9444
|
|
| BLAKE2b-256 |
7122388f45ab6864f80a960b6b5ae128b9a01c9b4159d5e8a46866ca38576f8d
|
File details
Details for the file maref-0.36.0rc0-py3-none-any.whl.
File metadata
- Download URL: maref-0.36.0rc0-py3-none-any.whl
- Upload date:
- Size: 1.4 MB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
954329f394052ca784402cffcceb2bcd0ab45fe1da5ecae0e1574763b0033f86
|
|
| MD5 |
891fb623e0ac06516400aef886d66799
|
|
| BLAKE2b-256 |
bbfba06a6f90948f24a771ab27cacfb93f3dc0579d1ac5315d6783036d1897dd
|