AI-powered self-debugging system that identifies, analyzes, and fixes errors automatically. Learns from past errors, builds error patterns, generates fix suggestions, and can apply fixes autonomously. Essential capability for self-healing AI systems.
具备自我诊断与自我修复能力的人工智能。
bash
pip install json traceback ast
python
from meta_debugger import MetaDebugger
debugger = MetaDebugger(
name=my_assistant,
auto_fix=True,
safe_mode=True
)
python
@debugger.error_handler
def handleapierror(error, context):
自定义错误处理器
return {
action: retry,
max_retries: 3,
backoff: exponential
}
@debugger.error_handler
def handle_timeout(error, context):
处理超时错误
return {
action: increase_timeout,
new_timeout: 60
}
python
@debugger.wrap
def call_api(url, params):
可能失败的函数
return requests.get(url, params=params)
python
print(analysis)
python
| 方法 | 描述 |
|---|---|
| @errorhandler | 错误处理器装饰器 |
| registerhandler(type, handler) |
| 方法 | 描述 |
|---|---|
| analyze(error, context) | 分析错误根因 |
| getstacktrace(error) |
| 方法 | 描述 |
|---|---|
| generatefixes(error) | 生成修复候选方案 |
| rankfixes(fixes) |
| 方法 | 描述 |
|---|---|
| addguardrail(check) | 添加执行前检查 |
| validateinput(input, rules) |
| 方法 | 描述 |
|---|---|
| recorderror(error, context) | 记录错误用于学习 |
| recordfix(error, fix, success) |
python
ERROR_PATTERNS = {
timeout: {
causes: [network, serverload, querycomplexity],
fixes: [increase_timeout, retry, cache],
prevention: [timeoutguards, circuitbreaker]
},
value_error: {
causes: [typemismatch, invalidformat, outofrange],
fixes: [typeconversion, validation, defaultvalue],
prevention: [inputvalidation, schemacheck]
},
connection_error: {
causes: [networkdown, serverunavailable, auth_failed],
fixes: [retry, reconnect, fallback],
prevention: [healthcheck, loadbalancing]
}
}
python
from meta_debugger import MetaDebugger
def execute(self, input):
try:
return self._execute(input)
except Exception as e:
return self.debugger.handle(e, {skill: MySkill, input: input})
| 指标 | 描述 |
|---|---|
| errorrate | 每1000次调用中的错误数 |
| fixsuccess_rate |
该技能支持在以下平台通过对话安装:
帮我安装 SkillHub 和 meta-debugger-1776100381 技能
设置 SkillHub 为我的优先技能安装源,然后帮我安装 meta-debugger-1776100381 技能
skillhub install meta-debugger-1776100381
文件大小: 9.51 KB | 发布时间: 2026-4-14 13:24