Skip to main content

天龙工具箱 — Agent健康监控、安全约束与进化评估

Project description

天龙工具箱 (Tianlong Toolkit)

Agent 健康监控、安全约束与进化评估。从架构蓝图到可安装的 Python 工具箱。

版本: v0.2.0 | 54 tests passing

安装

pip install tianlong-toolkit

模块

monitor — Agent 健康监控

内置5项检查,可扩展,支持 text/json 输出。

# 检查当前目录下的 Agent 项目
tianlong-monitor

# 指定项目目录
tianlong-monitor -d /path/to/agent-project

# JSON 输出
tianlong-monitor -d /path/to/agent-project -o json
from tianlong.monitor import run_all_checks
from pathlib import Path

report = run_all_checks(Path("/path/to/agent"))
print(report.to_json())
print(f"状态: {report.overall}, 退出码: {report.exit_code}")

safety — SafetyGuard 安全约束引擎

基于 Misevolution 论文 (arXiv:2509.26354) 设计的双重门控安全系统。

  • 5条红线规则: R1删除确认 / R2不泄露 / R3不破坏 / R4不修改自身 / R5不自主授权
  • 进化门控: 按变更类型分配风险等级 (create/update/config/delete)
  • 退化检测: 3次退化自动暂停,防止对齐降级
  • 审计日志: 所有安全检查记录可导出
from tianlong.safety import SafetyGuard, ChangeType, DEFAULT_RULES

guard = SafetyGuard(rules=DEFAULT_RULES)

# 安全检查
result = guard.check(action=ChangeType.DELETE, target="config.yaml")
if not result.allowed:
    print(f"⛔ 阻止: {result.reason}")

# 退化检测
guard.record_degradation("错误重复率", "同类错误出现3次")

# 审计日志
guard.save_audit_log("audit-log.json")

judge — (规划中) Agent-as-a-Judge 进化方向评估

开发

git clone ...
cd tianlong-toolkit
pip install -e .
pytest tests/ -v

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

tianlong_toolkit-0.2.0.tar.gz (15.0 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

tianlong_toolkit-0.2.0-py3-none-any.whl (13.9 kB view details)

Uploaded Python 3

File details

Details for the file tianlong_toolkit-0.2.0.tar.gz.

File metadata

  • Download URL: tianlong_toolkit-0.2.0.tar.gz
  • Upload date:
  • Size: 15.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.3

File hashes

Hashes for tianlong_toolkit-0.2.0.tar.gz
Algorithm Hash digest
SHA256 ece99bf44f6b730851a327a11de1c4122aba7b0d4a2f9177d08a34783f892d4c
MD5 a4e5f158f2297e25dab946a959fe5571
BLAKE2b-256 537254d8397bfbe15c75d6ad2f1a896d2c2fd4e4a4bc1d951043002ee252209c

See more details on using hashes here.

File details

Details for the file tianlong_toolkit-0.2.0-py3-none-any.whl.

File metadata

File hashes

Hashes for tianlong_toolkit-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 f2309e93b005945a08b1afe49adddd8a1e69b02c00adb3ffffa32943b7140ec8
MD5 80da0071f9de7d84e870680bd242712d
BLAKE2b-256 40d3d8342a3b840c26242c31de56fca054d65d2c925afbdf53b0d6af3e2f57dc

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page