cybernetics-agent 0.6.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- cybernetics_agent-0.6.0/.github/workflows/ci.yml +73 -0
- cybernetics_agent-0.6.0/.gitignore +50 -0
- cybernetics_agent-0.6.0/CHANGELOG.md +18 -0
- cybernetics_agent-0.6.0/CONTRIBUTING.md +49 -0
- cybernetics_agent-0.6.0/LICENSE +21 -0
- cybernetics_agent-0.6.0/PKG-INFO +151 -0
- cybernetics_agent-0.6.0/README.en.md +101 -0
- cybernetics_agent-0.6.0/README.es.md +89 -0
- cybernetics_agent-0.6.0/README.fr.md +89 -0
- cybernetics_agent-0.6.0/README.ja.md +89 -0
- cybernetics_agent-0.6.0/README.ko.md +89 -0
- cybernetics_agent-0.6.0/README.md +109 -0
- cybernetics_agent-0.6.0/assets/dashboard_preview.png +0 -0
- cybernetics_agent-0.6.0/docs/RFC-001.md +493 -0
- cybernetics_agent-0.6.0/docs/v0.4.0-alert-design.md +276 -0
- cybernetics_agent-0.6.0/docs/v0.5.0-design.md +71 -0
- cybernetics_agent-0.6.0/docs/v0.6.0-design.md +46 -0
- cybernetics_agent-0.6.0/examples/cybernetics.json +113 -0
- cybernetics_agent-0.6.0/examples/cybernetics.yaml +107 -0
- cybernetics_agent-0.6.0/examples/minimal_hermes.py +71 -0
- cybernetics_agent-0.6.0/examples/minimal_langchain.py +80 -0
- cybernetics_agent-0.6.0/examples/minimal_native.py +68 -0
- cybernetics_agent-0.6.0/examples/pipeline_integration.py +246 -0
- cybernetics_agent-0.6.0/examples/pipeline_integration_mock.py +110 -0
- cybernetics_agent-0.6.0/pyproject.toml +111 -0
- cybernetics_agent-0.6.0/src/cybernetics_agent/__init__.py +38 -0
- cybernetics_agent-0.6.0/src/cybernetics_agent/adapters/__init__.py +38 -0
- cybernetics_agent-0.6.0/src/cybernetics_agent/adapters/autogen.py +36 -0
- cybernetics_agent-0.6.0/src/cybernetics_agent/adapters/base.py +79 -0
- cybernetics_agent-0.6.0/src/cybernetics_agent/adapters/claude_code.py +106 -0
- cybernetics_agent-0.6.0/src/cybernetics_agent/adapters/codex.py +94 -0
- cybernetics_agent-0.6.0/src/cybernetics_agent/adapters/crewai.py +33 -0
- cybernetics_agent-0.6.0/src/cybernetics_agent/adapters/hermes.py +30 -0
- cybernetics_agent-0.6.0/src/cybernetics_agent/adapters/langchain.py +53 -0
- cybernetics_agent-0.6.0/src/cybernetics_agent/adapters/native.py +31 -0
- cybernetics_agent-0.6.0/src/cybernetics_agent/adapters/openclaw.py +109 -0
- cybernetics_agent-0.6.0/src/cybernetics_agent/adapters/qwenpaw.py +115 -0
- cybernetics_agent-0.6.0/src/cybernetics_agent/alert/__init__.py +20 -0
- cybernetics_agent-0.6.0/src/cybernetics_agent/alert/channels/__init__.py +27 -0
- cybernetics_agent-0.6.0/src/cybernetics_agent/alert/channels/base.py +36 -0
- cybernetics_agent-0.6.0/src/cybernetics_agent/alert/channels/dingtalk.py +65 -0
- cybernetics_agent-0.6.0/src/cybernetics_agent/alert/channels/discord.py +56 -0
- cybernetics_agent-0.6.0/src/cybernetics_agent/alert/channels/email.py +70 -0
- cybernetics_agent-0.6.0/src/cybernetics_agent/alert/channels/feishu.py +63 -0
- cybernetics_agent-0.6.0/src/cybernetics_agent/alert/channels/slack.py +56 -0
- cybernetics_agent-0.6.0/src/cybernetics_agent/alert/channels/stdout.py +32 -0
- cybernetics_agent-0.6.0/src/cybernetics_agent/alert/channels/webhook.py +47 -0
- cybernetics_agent-0.6.0/src/cybernetics_agent/alert/core.py +55 -0
- cybernetics_agent-0.6.0/src/cybernetics_agent/alert/manager.py +117 -0
- cybernetics_agent-0.6.0/src/cybernetics_agent/alert/rules.py +150 -0
- cybernetics_agent-0.6.0/src/cybernetics_agent/cli/__init__.py +9 -0
- cybernetics_agent-0.6.0/src/cybernetics_agent/cli/__main__.py +6 -0
- cybernetics_agent-0.6.0/src/cybernetics_agent/cli/alert_cmd.py +196 -0
- cybernetics_agent-0.6.0/src/cybernetics_agent/cli/audit.py +115 -0
- cybernetics_agent-0.6.0/src/cybernetics_agent/cli/dashboard.py +493 -0
- cybernetics_agent-0.6.0/src/cybernetics_agent/cli/dashboard_fastapi.py +492 -0
- cybernetics_agent-0.6.0/src/cybernetics_agent/cli/init.py +91 -0
- cybernetics_agent-0.6.0/src/cybernetics_agent/cli/main.py +226 -0
- cybernetics_agent-0.6.0/src/cybernetics_agent/cli/plugin_cmd.py +84 -0
- cybernetics_agent-0.6.0/src/cybernetics_agent/cli/preset.py +117 -0
- cybernetics_agent-0.6.0/src/cybernetics_agent/cli/report.py +150 -0
- cybernetics_agent-0.6.0/src/cybernetics_agent/cli/validate.py +133 -0
- cybernetics_agent-0.6.0/src/cybernetics_agent/config.py +202 -0
- cybernetics_agent-0.6.0/src/cybernetics_agent/context.py +235 -0
- cybernetics_agent-0.6.0/src/cybernetics_agent/core/__init__.py +39 -0
- cybernetics_agent-0.6.0/src/cybernetics_agent/core/adaptive_tuner.py +412 -0
- cybernetics_agent-0.6.0/src/cybernetics_agent/core/base.py +140 -0
- cybernetics_agent-0.6.0/src/cybernetics_agent/core/circuit_breaker.py +100 -0
- cybernetics_agent-0.6.0/src/cybernetics_agent/core/feedback_loop.py +257 -0
- cybernetics_agent-0.6.0/src/cybernetics_agent/core/hierarchy_controller.py +204 -0
- cybernetics_agent-0.6.0/src/cybernetics_agent/core/info_flow.py +163 -0
- cybernetics_agent-0.6.0/src/cybernetics_agent/core/optimal_controller.py +266 -0
- cybernetics_agent-0.6.0/src/cybernetics_agent/core/parameter_state.py +23 -0
- cybernetics_agent-0.6.0/src/cybernetics_agent/core/stability_engine.py +312 -0
- cybernetics_agent-0.6.0/src/cybernetics_agent/core/stage_metrics.py +49 -0
- cybernetics_agent-0.6.0/src/cybernetics_agent/core/system_identifier.py +313 -0
- cybernetics_agent-0.6.0/src/cybernetics_agent/presets.py +165 -0
- cybernetics_agent-0.6.0/src/cybernetics_agent/runtime/__init__.py +10 -0
- cybernetics_agent-0.6.0/src/cybernetics_agent/runtime/config_watcher.py +72 -0
- cybernetics_agent-0.6.0/src/cybernetics_agent/runtime/event_bus.py +125 -0
- cybernetics_agent-0.6.0/src/cybernetics_agent/runtime/event_store.py +222 -0
- cybernetics_agent-0.6.0/src/cybernetics_agent/runtime/metrics_collector.py +324 -0
- cybernetics_agent-0.6.0/src/cybernetics_agent/runtime/plugin_loader.py +139 -0
- cybernetics_agent-0.6.0/src/cybernetics_agent/runtime/state_manager.py +188 -0
- cybernetics_agent-0.6.0/tests/test_alert/__init__.py +0 -0
- cybernetics_agent-0.6.0/tests/test_alert/test_alert_channels.py +78 -0
- cybernetics_agent-0.6.0/tests/test_alert/test_alert_core.py +35 -0
- cybernetics_agent-0.6.0/tests/test_alert/test_alert_manager.py +86 -0
- cybernetics_agent-0.6.0/tests/test_alert/test_alert_rules.py +97 -0
- cybernetics_agent-0.6.0/tests/test_alert/test_alert_stdout.py +38 -0
- cybernetics_agent-0.6.0/tests/test_cli/test_alert_cli.py +34 -0
- cybernetics_agent-0.6.0/tests/test_cli/test_cli.py +73 -0
- cybernetics_agent-0.6.0/tests/test_cli/test_dashboard.py +38 -0
- cybernetics_agent-0.6.0/tests/test_core/__init__.py +0 -0
- cybernetics_agent-0.6.0/tests/test_core/test_adaptive_tuner.py +105 -0
- cybernetics_agent-0.6.0/tests/test_core/test_config_validation.py +105 -0
- cybernetics_agent-0.6.0/tests/test_core/test_feedback_loop.py +69 -0
- cybernetics_agent-0.6.0/tests/test_core/test_integration.py +126 -0
- cybernetics_agent-0.6.0/tests/test_core/test_presets.py +98 -0
- cybernetics_agent-0.6.0/tests/test_core/test_stability.py +76 -0
- cybernetics_agent-0.6.0/tests/test_runtime/test_config_watcher.py +87 -0
- cybernetics_agent-0.6.0/tests/test_runtime/test_event_store.py +110 -0
- cybernetics_agent-0.6.0/tests/test_runtime/test_metrics_exporter.py +58 -0
- cybernetics_agent-0.6.0/tests/test_runtime/test_plugin_loader.py +92 -0
- cybernetics_agent-0.6.0/xiaohongshu_post.md +157 -0
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
name: CI
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
push:
|
|
5
|
+
branches: [main, develop]
|
|
6
|
+
pull_request:
|
|
7
|
+
branches: [main]
|
|
8
|
+
|
|
9
|
+
jobs:
|
|
10
|
+
test:
|
|
11
|
+
runs-on: ubuntu-latest
|
|
12
|
+
strategy:
|
|
13
|
+
matrix:
|
|
14
|
+
python-version: ['3.9', '3.10', '3.11', '3.12', '3.13']
|
|
15
|
+
|
|
16
|
+
steps:
|
|
17
|
+
- uses: actions/checkout@v4
|
|
18
|
+
|
|
19
|
+
- name: Set up Python ${{ matrix.python-version }}
|
|
20
|
+
uses: actions/setup-python@v5
|
|
21
|
+
with:
|
|
22
|
+
python-version: ${{ matrix.python-version }}
|
|
23
|
+
|
|
24
|
+
- name: Install dependencies
|
|
25
|
+
run: |
|
|
26
|
+
python -m pip install --upgrade pip
|
|
27
|
+
pip install -e ".[dev]"
|
|
28
|
+
|
|
29
|
+
- name: Run smoke tests
|
|
30
|
+
run: |
|
|
31
|
+
PYTHONPATH=src python3 -c "
|
|
32
|
+
import cybernetics_agent
|
|
33
|
+
from cybernetics_agent.core import FeedbackLoop, StabilityEngine, SystemIdentifier
|
|
34
|
+
from cybernetics_agent.core import OptimalController, InfoFlow, AdaptiveTuner, HierarchyController
|
|
35
|
+
from cybernetics_agent.adapters import HermesAdapter, LangChainAdapter, CrewAIAdapter
|
|
36
|
+
from cybernetics_agent.adapters import AutoGenAdapter, NativeAdapter
|
|
37
|
+
print('All imports successful')
|
|
38
|
+
"
|
|
39
|
+
|
|
40
|
+
- name: Run pytest
|
|
41
|
+
run: python -m pytest tests/ -v --tb=short
|
|
42
|
+
|
|
43
|
+
- name: Run ruff check
|
|
44
|
+
run: ruff check src/ tests/
|
|
45
|
+
|
|
46
|
+
- name: Run mypy
|
|
47
|
+
run: mypy src/
|
|
48
|
+
|
|
49
|
+
build:
|
|
50
|
+
runs-on: ubuntu-latest
|
|
51
|
+
needs: test
|
|
52
|
+
|
|
53
|
+
steps:
|
|
54
|
+
- uses: actions/checkout@v4
|
|
55
|
+
|
|
56
|
+
- name: Set up Python
|
|
57
|
+
uses: actions/setup-python@v5
|
|
58
|
+
with:
|
|
59
|
+
python-version: '3.12'
|
|
60
|
+
|
|
61
|
+
- name: Install build dependencies
|
|
62
|
+
run: |
|
|
63
|
+
python -m pip install --upgrade pip
|
|
64
|
+
pip install build
|
|
65
|
+
|
|
66
|
+
- name: Build package
|
|
67
|
+
run: python -m build
|
|
68
|
+
|
|
69
|
+
- name: Upload artifacts
|
|
70
|
+
uses: actions/upload-artifact@v4
|
|
71
|
+
with:
|
|
72
|
+
name: dist
|
|
73
|
+
path: dist/
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
# Python
|
|
2
|
+
__pycache__/
|
|
3
|
+
*.py[cod]
|
|
4
|
+
*$py.class
|
|
5
|
+
*.so
|
|
6
|
+
.Python
|
|
7
|
+
build/
|
|
8
|
+
develop-eggs/
|
|
9
|
+
dist/
|
|
10
|
+
downloads/
|
|
11
|
+
eggs/
|
|
12
|
+
.eggs/
|
|
13
|
+
lib/
|
|
14
|
+
lib64/
|
|
15
|
+
parts/
|
|
16
|
+
sdist/
|
|
17
|
+
var/
|
|
18
|
+
wheels/
|
|
19
|
+
*.egg-info/
|
|
20
|
+
.installed.cfg
|
|
21
|
+
*.egg
|
|
22
|
+
|
|
23
|
+
# Virtual environments
|
|
24
|
+
venv/
|
|
25
|
+
env/
|
|
26
|
+
ENV/
|
|
27
|
+
.venv
|
|
28
|
+
|
|
29
|
+
# IDE
|
|
30
|
+
.vscode/
|
|
31
|
+
.idea/
|
|
32
|
+
*.swp
|
|
33
|
+
*.swo
|
|
34
|
+
*~
|
|
35
|
+
|
|
36
|
+
# OS
|
|
37
|
+
.DS_Store
|
|
38
|
+
Thumbs.db
|
|
39
|
+
|
|
40
|
+
# Cybernetics Agent runtime data
|
|
41
|
+
.cybernetics/
|
|
42
|
+
|
|
43
|
+
# Test artifacts
|
|
44
|
+
.pytest_cache/
|
|
45
|
+
.coverage
|
|
46
|
+
htmlcov/
|
|
47
|
+
|
|
48
|
+
# Reports
|
|
49
|
+
*_report.md
|
|
50
|
+
*_report.html
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
## [0.6.0] - 2026-05-13
|
|
4
|
+
|
|
5
|
+
### Added
|
|
6
|
+
- **事件持久化** (EventStore)
|
|
7
|
+
- `runtime/event_store.py`: SQLite 存储层,零外部依赖
|
|
8
|
+
- 三个表:`events`、`metrics`、`alerts`,带索引加速查询
|
|
9
|
+
- 支持按时间范围、类型、严重级别筛选查询
|
|
10
|
+
- 自动清理超过 30 天的旧数据
|
|
11
|
+
- **集成点**
|
|
12
|
+
- MetricsCollector 自动将所有事件写入 SQLite
|
|
13
|
+
- AlertManager 自动将触发的告警写入 SQLite
|
|
14
|
+
- Dashboard 新增 `/api/history/*` 端点
|
|
15
|
+
- **Bug 修复**: EventStore 目录自动创建、Dashboard 版本号统一、SQLite 异常保护
|
|
16
|
+
|
|
17
|
+
### Previous Versions
|
|
18
|
+
See [Git history](https://github.com/Jiaqi-Guo-0114/cybernetics-agent/commits/main) for earlier releases (v0.1.0–v0.5.0).
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
# Contributing to Cybernetics Agent
|
|
2
|
+
|
|
3
|
+
感谢你对 Cybernetics Agent 的兴趣!欢迎提交 Issue 和 Pull Request。
|
|
4
|
+
|
|
5
|
+
## 设计原则
|
|
6
|
+
|
|
7
|
+
本项目遵循两个核心原则,所有贡献都应参考:
|
|
8
|
+
|
|
9
|
+
1. **如无必要,勿增实体**(奥卡姆剑刀)— 不引入不必要的依赖、不创建不必要的抽象层、不添加不必要的配置项。每行代码都必须有存在的理由。如果一个功能可以用更少的代码实现,那就是更好的实现。
|
|
10
|
+
|
|
11
|
+
2. **大把拆小,组合为工作流** — 复杂功能不是一个巨大的类,而是多个小模块的组合。模块之间零依赖,单独可用、单独可测。如果一个文件超过 300 行或一个类超过 10 个方法,就应该考虑拆分。
|
|
12
|
+
|
|
13
|
+
## 如何贡献
|
|
14
|
+
|
|
15
|
+
1. **Fork 仓库** 并克隆到本地
|
|
16
|
+
2. **创建分支** `git checkout -b feature/your-feature`
|
|
17
|
+
3. **提交更改** `git commit -am "feat: add new feature"`
|
|
18
|
+
4. **推送到远程** `git push origin feature/your-feature`
|
|
19
|
+
5. **创建 Pull Request**
|
|
20
|
+
|
|
21
|
+
## 开发环境
|
|
22
|
+
|
|
23
|
+
```bash
|
|
24
|
+
# 克隆仓库
|
|
25
|
+
git clone https://github.com/Jiaqi-Guo-0114/cybernetics-agent.git
|
|
26
|
+
cd cybernetics-agent
|
|
27
|
+
|
|
28
|
+
# 运行测试
|
|
29
|
+
PYTHONPATH=src python3 -m pytest tests/ -v
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
## 提交规范
|
|
33
|
+
|
|
34
|
+
- 使用 [Conventional Commits](https://www.conventionalcommits.org/)
|
|
35
|
+
- 保持测试通过
|
|
36
|
+
- 添加相关测试用例
|
|
37
|
+
- 更新文档(如果需要)
|
|
38
|
+
|
|
39
|
+
## 代码风格
|
|
40
|
+
|
|
41
|
+
- Python 3.9+ 兼容
|
|
42
|
+
- 纯标准库,无外部依赖
|
|
43
|
+
- 类型注解尽量完整
|
|
44
|
+
- 中文注释、中文用户面向字符串
|
|
45
|
+
|
|
46
|
+
## 问题反馈
|
|
47
|
+
|
|
48
|
+
- 使用 GitHub Issues 提交 bug 报告和功能请求
|
|
49
|
+
- 提供尽可能详细的复现步骤
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Jiaqi Guo
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
|
@@ -0,0 +1,151 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: cybernetics-agent
|
|
3
|
+
Version: 0.6.0
|
|
4
|
+
Summary: A framework-agnostic cybernetics enhancement layer for AI agents, based on Qian Xuesen's Engineering Cybernetics.
|
|
5
|
+
Project-URL: Homepage, https://github.com/Jiaqi-Guo-0114/cybernetics-agent
|
|
6
|
+
Project-URL: Documentation, https://github.com/Jiaqi-Guo-0114/cybernetics-agent#readme
|
|
7
|
+
Project-URL: Repository, https://github.com/Jiaqi-Guo-0114/cybernetics-agent
|
|
8
|
+
Project-URL: Issues, https://github.com/Jiaqi-Guo-0114/cybernetics-agent/issues
|
|
9
|
+
Author-email: Jiaqi Guo <your-email@example.com>
|
|
10
|
+
License: MIT
|
|
11
|
+
License-File: LICENSE
|
|
12
|
+
Keywords: agent,ai,autogen,control-theory,crewai,cybernetics,feedback-loop,langchain,llm
|
|
13
|
+
Classifier: Development Status :: 3 - Alpha
|
|
14
|
+
Classifier: Intended Audience :: Developers
|
|
15
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
16
|
+
Classifier: Programming Language :: Python :: 3
|
|
17
|
+
Classifier: Programming Language :: Python :: 3.9
|
|
18
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
19
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
20
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
21
|
+
Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
|
|
22
|
+
Requires-Python: >=3.9
|
|
23
|
+
Requires-Dist: typing-extensions>=4.0.0
|
|
24
|
+
Provides-Extra: all
|
|
25
|
+
Requires-Dist: fastapi>=0.100; extra == 'all'
|
|
26
|
+
Requires-Dist: jinja2>=3.1; extra == 'all'
|
|
27
|
+
Requires-Dist: mypy>=1.0; extra == 'all'
|
|
28
|
+
Requires-Dist: pytest-asyncio>=0.21; extra == 'all'
|
|
29
|
+
Requires-Dist: pytest>=7.0; extra == 'all'
|
|
30
|
+
Requires-Dist: ruff>=0.1; extra == 'all'
|
|
31
|
+
Requires-Dist: uvicorn>=0.23; extra == 'all'
|
|
32
|
+
Provides-Extra: dashboard
|
|
33
|
+
Requires-Dist: fastapi>=0.100; extra == 'dashboard'
|
|
34
|
+
Requires-Dist: jinja2>=3.1; extra == 'dashboard'
|
|
35
|
+
Requires-Dist: uvicorn>=0.23; extra == 'dashboard'
|
|
36
|
+
Provides-Extra: dev
|
|
37
|
+
Requires-Dist: mypy>=1.0; extra == 'dev'
|
|
38
|
+
Requires-Dist: pytest-asyncio>=0.21; extra == 'dev'
|
|
39
|
+
Requires-Dist: pytest>=7.0; extra == 'dev'
|
|
40
|
+
Requires-Dist: ruff>=0.1; extra == 'dev'
|
|
41
|
+
Description-Content-Type: text/markdown
|
|
42
|
+
|
|
43
|
+
# 🦙 Cybernetics Agent
|
|
44
|
+
|
|
45
|
+
> 一个框架无关的控制论 Agent 增强层。
|
|
46
|
+
> 基于钱学森《工程控制论》七大核心原则,让任何 Python Agent 都能获得自适应、自恢复、自优化的能力。
|
|
47
|
+
|
|
48
|
+
[](https://www.python.org/downloads/)
|
|
49
|
+
[](https://opensource.org/licenses/MIT)
|
|
50
|
+
[]()
|
|
51
|
+
|
|
52
|
+
🌐 **[English](README.en.md)** · **[Français](README.fr.md)** · **[Español](README.es.md)** · **[日本語](README.ja.md)** · **[한국어](README.ko.md)**
|
|
53
|
+
|
|
54
|
+
---
|
|
55
|
+
|
|
56
|
+
## ✅ 特性
|
|
57
|
+
|
|
58
|
+
- **框架无关** — 不依赖任何 LLM 框架,纯标准库
|
|
59
|
+
- **七大原则** — 钱学森《工程控制论》全覆盖
|
|
60
|
+
- **多框架适配** — 支持 LangChain、AutoGen、CrewAI、Hermes、Claude Code、Codex 等
|
|
61
|
+
- **声明式配置** — JSON/YAML 配置,灵活可控
|
|
62
|
+
- **策略预设** — 4 种开箱即用配置模板
|
|
63
|
+
- **Metrics 导出** — Prometheus / OpenMetrics 文本格式
|
|
64
|
+
- **Plugin 系统** — 热插拔自定义模块
|
|
65
|
+
- **实时 Dashboard** — FastAPI + SSE 事件流,告警面板 + 历史查询
|
|
66
|
+
- **配置热重载** — 运行时修改配置文件自动生效
|
|
67
|
+
- **告警系统** — 阈值规则 + 7 个通知渠道(飞书/钉钉/Discord/Slack/Email/Webhook/Stdout)
|
|
68
|
+
- **事件持久化** — SQLite 存储,进程重启不丢失
|
|
69
|
+
- **自适应调优** — ε-greedy 参数自动优化
|
|
70
|
+
- **完整 CLI** — `cybernetix` 命令行工具
|
|
71
|
+
- **线程安全** — 内置线程锁保护
|
|
72
|
+
|
|
73
|
+
**设计哲学**: ① 如无必要,勿增实体 ② 大把拆小,组合为工作流
|
|
74
|
+
|
|
75
|
+
## 🚀 快速开始
|
|
76
|
+
|
|
77
|
+
```bash
|
|
78
|
+
# 安装
|
|
79
|
+
pip install cybernetics-agent
|
|
80
|
+
|
|
81
|
+
# 初始化配置
|
|
82
|
+
cybernetix init
|
|
83
|
+
|
|
84
|
+
# 使用
|
|
85
|
+
python -c "
|
|
86
|
+
from cybernetics_agent import CyberneticsConfig, CyberneticsContext
|
|
87
|
+
ctx = CyberneticsContext(CyberneticsConfig(project_name='my-agent'))
|
|
88
|
+
ctx.emit_tool_result('search', ['paper1', 'paper2'])
|
|
89
|
+
print(ctx.get_status())
|
|
90
|
+
"
|
|
91
|
+
```
|
|
92
|
+
|
|
93
|
+
## 🎯 七大原则
|
|
94
|
+
|
|
95
|
+
| 原则 | 模块 | 功能 |
|
|
96
|
+
|------|------|------|
|
|
97
|
+
| 1. 反馈闭环 | FeedbackLoop | 触发式行动,自动调整 |
|
|
98
|
+
| 2. 稳定性优先 | StabilityEngine | 重试、熔断器、降级、超时控制 |
|
|
99
|
+
| 3. 系统辨识 | SystemIdentifier | 转化漏斗、效率指标采集 |
|
|
100
|
+
| 4. 最优控制 | OptimalController | 预算管理、约束检查 |
|
|
101
|
+
| 5. 信息论 | InfoFlow | 消息过滤、分发 |
|
|
102
|
+
| 6. 自适应 | AdaptiveTuner | 参数自动调优 |
|
|
103
|
+
| 7. 分层控制 | HierarchyController | 战略/战术/执行三层架构 |
|
|
104
|
+
|
|
105
|
+
## 🔧 支持的框架
|
|
106
|
+
|
|
107
|
+
```python
|
|
108
|
+
from cybernetics_agent.adapters import (
|
|
109
|
+
NativeAdapter, # 纯 Python
|
|
110
|
+
LangChainAdapter, # LangChain
|
|
111
|
+
AutoGenAdapter, # AutoGen
|
|
112
|
+
CrewAIAdapter, # CrewAI
|
|
113
|
+
HermesAdapter, # Hermes Agent
|
|
114
|
+
ClaudeCodeAdapter, # Claude Code CLI
|
|
115
|
+
CodexAdapter, # OpenAI Codex CLI
|
|
116
|
+
OpenClawAdapter, # OpenClaw (HTTP)
|
|
117
|
+
QwenpawAdapter, # Qwenpaw
|
|
118
|
+
)
|
|
119
|
+
```
|
|
120
|
+
|
|
121
|
+
## 📁 CLI 工具
|
|
122
|
+
|
|
123
|
+
```bash
|
|
124
|
+
cybernetix init # 初始化配置
|
|
125
|
+
cybernetix preset list # 列出策略预设
|
|
126
|
+
cybernetix preset show <name> # 查看预设详情
|
|
127
|
+
cybernetix preset apply <name> -o cfg.json # 应用预设
|
|
128
|
+
cybernetix validate cfg.json # 验证配置文件
|
|
129
|
+
cybernetix plugin list # 列出插件
|
|
130
|
+
cybernetix plugin discover # 发现插件
|
|
131
|
+
cybernetix dashboard # 启动监控仪表盘
|
|
132
|
+
cybernetix alert test # 测试告警渠道
|
|
133
|
+
cybernetix alert status # 查看告警规则状态
|
|
134
|
+
cybernetix alert fire -m "msg" -s error # 手动触发告警
|
|
135
|
+
cybernetix audit ./src # 审计代码缺陷
|
|
136
|
+
cybernetix run ./task.py # 运行任务并采集指标
|
|
137
|
+
cybernetix --version # 查看版本号
|
|
138
|
+
```
|
|
139
|
+
|
|
140
|
+
## 📊 监控仪表盘
|
|
141
|
+
|
|
142
|
+

|
|
143
|
+
|
|
144
|
+
启动监控仪表盘:
|
|
145
|
+
```bash
|
|
146
|
+
cybernetix dashboard
|
|
147
|
+
```
|
|
148
|
+
|
|
149
|
+
## 📝 许可证
|
|
150
|
+
|
|
151
|
+
MIT License © 2026 Jiaqi Guo
|
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
# 🦙 Cybernetics Agent
|
|
2
|
+
|
|
3
|
+
> A framework-agnostic cybernetics enhancement layer for AI agents.
|
|
4
|
+
> Based on H.S. Tsien's *Engineering Cybernetics* seven core principles, enabling any Python agent with self-adaptive, self-healing, and self-optimizing capabilities.
|
|
5
|
+
|
|
6
|
+
[](https://www.python.org/downloads/)
|
|
7
|
+
[](https://opensource.org/licenses/MIT)
|
|
8
|
+
[]()
|
|
9
|
+
|
|
10
|
+
🌐 **[English](README.en.md)** · [中文](README.md) · [Français](README.fr.md) · [Español](README.es.md) · [日本語](README.ja.md) · [한국어](README.ko.md)
|
|
11
|
+
|
|
12
|
+
---
|
|
13
|
+
|
|
14
|
+
## ✅ Features
|
|
15
|
+
|
|
16
|
+
- **Framework-agnostic** — No dependency on any LLM framework, pure stdlib
|
|
17
|
+
- **Seven Principles** — Full coverage of Qian Xuesen's Engineering Cybernetics
|
|
18
|
+
- **Multi-framework Adapters** — LangChain, AutoGen, CrewAI, Hermes, Claude Code, Codex, etc.
|
|
19
|
+
- **Declarative Config** — JSON/YAML configuration, flexible and controllable
|
|
20
|
+
- **Strategy Presets** — 4 out-of-the-box templates (high-concurrency / low-cost / high-reliability / debug)
|
|
21
|
+
- **Metrics Export** — Prometheus / OpenMetrics text format, Grafana-ready
|
|
22
|
+
- **Plugin System** — Hot-swappable custom modules, auto-discovery
|
|
23
|
+
- **Real-time Dashboard** — FastAPI + SSE streaming, live frontend
|
|
24
|
+
- **Auto-tuning** — ε-greedy parameter optimization with confidence scoring
|
|
25
|
+
- **Full CLI Toolkit** — `cybernetix` (init / audit / dashboard / preset / plugin / validate / run / --version)
|
|
26
|
+
- **Thread-safe** — Built-in thread lock protection
|
|
27
|
+
|
|
28
|
+
## 🚀 Quick Start
|
|
29
|
+
|
|
30
|
+
```bash
|
|
31
|
+
# Install
|
|
32
|
+
pip install cybernetics-agent
|
|
33
|
+
|
|
34
|
+
# Initialize config
|
|
35
|
+
cybernetix init
|
|
36
|
+
|
|
37
|
+
# Use
|
|
38
|
+
python -c "
|
|
39
|
+
from cybernetics_agent import CyberneticsConfig, CyberneticsContext
|
|
40
|
+
ctx = CyberneticsContext(CyberneticsConfig(project_name='my-agent'))
|
|
41
|
+
ctx.emit_tool_result('search', ['paper1', 'paper2'])
|
|
42
|
+
print(ctx.get_status())
|
|
43
|
+
"
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
## 🎯 Seven Principles
|
|
47
|
+
|
|
48
|
+
| Principle | Module | Function |
|
|
49
|
+
|-----------|--------|----------|
|
|
50
|
+
| 1. Feedback Loop | FeedbackLoop | Trigger-based actions, automatic adjustment |
|
|
51
|
+
| 2. Stability First | StabilityEngine | Retry, circuit breaker, degradation, timeout |
|
|
52
|
+
| 3. System Identification | SystemIdentifier | Conversion funnel, efficiency metrics |
|
|
53
|
+
| 4. Optimal Control | OptimalController | Budget management, constraint checking |
|
|
54
|
+
| 5. Information Theory | InfoFlow | Message filtering, distribution |
|
|
55
|
+
| 6. Adaptive Control | AdaptiveTuner | Parameter auto-tuning |
|
|
56
|
+
| 7. Hierarchical Control | HierarchyController | Strategic / Tactical / Executive layers |
|
|
57
|
+
|
|
58
|
+
## 🔧 Supported Frameworks
|
|
59
|
+
|
|
60
|
+
```python
|
|
61
|
+
from cybernetics_agent.adapters import (
|
|
62
|
+
NativeAdapter, # Pure Python
|
|
63
|
+
LangChainAdapter, # LangChain
|
|
64
|
+
AutoGenAdapter, # AutoGen
|
|
65
|
+
CrewAIAdapter, # CrewAI
|
|
66
|
+
HermesAdapter, # Hermes Agent
|
|
67
|
+
ClaudeCodeAdapter, # Claude Code CLI
|
|
68
|
+
CodexAdapter, # OpenAI Codex CLI
|
|
69
|
+
OpenClawAdapter, # OpenClaw (HTTP)
|
|
70
|
+
QwenpawAdapter, # Qwenpaw
|
|
71
|
+
)
|
|
72
|
+
```
|
|
73
|
+
|
|
74
|
+
## 📁 CLI Tools
|
|
75
|
+
|
|
76
|
+
```bash
|
|
77
|
+
cybernetix init # Initialize config
|
|
78
|
+
cybernetix preset list # List strategy presets
|
|
79
|
+
cybernetix preset show <name> # Show preset details
|
|
80
|
+
cybernetix preset apply <name> -o cfg.json # Apply preset
|
|
81
|
+
cybernetix validate cfg.json # Validate config file
|
|
82
|
+
cybernetix plugin list # List plugins
|
|
83
|
+
cybernetix plugin discover # Discover plugins
|
|
84
|
+
cybernetix dashboard # Launch monitoring dashboard
|
|
85
|
+
cybernetix audit ./src # Audit code issues
|
|
86
|
+
cybernetix run ./task.py # Run task with metrics
|
|
87
|
+
cybernetix --version # Show version
|
|
88
|
+
```
|
|
89
|
+
|
|
90
|
+
## 📊 Dashboard
|
|
91
|
+
|
|
92
|
+

|
|
93
|
+
|
|
94
|
+
Launch dashboard:
|
|
95
|
+
```bash
|
|
96
|
+
cybernetix dashboard
|
|
97
|
+
```
|
|
98
|
+
|
|
99
|
+
## 📝 License
|
|
100
|
+
|
|
101
|
+
MIT License © 2026 Jiaqi Guo
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
# 🦙 Cybernetics Agent
|
|
2
|
+
|
|
3
|
+
> Una capa de mejora cibernética independiente del framework para agentes de IA.
|
|
4
|
+
> Basada en los siete principios fundamentales de la *Cibernética de Ingeniería* de H.S. Tsien, permitiendo que cualquier agente Python sea auto-adaptativo, auto-reparable y auto-optimizante.
|
|
5
|
+
|
|
6
|
+
[](https://www.python.org/downloads/)
|
|
7
|
+
[](https://opensource.org/licenses/MIT)
|
|
8
|
+
[]()
|
|
9
|
+
|
|
10
|
+
🌐 **[Español](README.es.md)** · [中文](README.md) · [English](README.en.md) · [Français](README.fr.md) · [日本語](README.ja.md) · [한국어](README.ko.md)
|
|
11
|
+
|
|
12
|
+
---
|
|
13
|
+
|
|
14
|
+
## ✅ Características
|
|
15
|
+
|
|
16
|
+
- **Independiente del framework** — Biblioteca estándar pura, cero dependencias externas
|
|
17
|
+
- **Siete Principios** — Cobertura completa de la *Cibernética de Ingeniería* de Tsien
|
|
18
|
+
- **Adaptadores multi-framework** — LangChain, AutoGen, CrewAI, Hermes, Claude Code, Codex, etc.
|
|
19
|
+
- **Configuración declarativa** — Configuración JSON/YAML, flexible y controlable
|
|
20
|
+
- **CLI completa** — Herramientas de línea de comandos `cybernetix` (init / audit / dashboard / run)
|
|
21
|
+
- **Thread-safe** — Bloqueos de threading integrados para seguridad
|
|
22
|
+
|
|
23
|
+
## 🚀 Inicio Rápido
|
|
24
|
+
|
|
25
|
+
```bash
|
|
26
|
+
# Instalar
|
|
27
|
+
pip install cybernetics-agent
|
|
28
|
+
|
|
29
|
+
# Inicializar configuración
|
|
30
|
+
cybernetix init
|
|
31
|
+
|
|
32
|
+
# Uso
|
|
33
|
+
python -c "
|
|
34
|
+
from cybernetics_agent import CyberneticsConfig, CyberneticsContext
|
|
35
|
+
ctx = CyberneticsContext(CyberneticsConfig(project_name='mi-agente'))
|
|
36
|
+
ctx.emit_tool_result('search', ['paper1', 'paper2'])
|
|
37
|
+
print(ctx.get_status())
|
|
38
|
+
"
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
## 🎯 Siete Principios
|
|
42
|
+
|
|
43
|
+
| Principio | Módulo | Función |
|
|
44
|
+
|-----------|---------|----------|
|
|
45
|
+
| 1. Bucle de retroalimentación | FeedbackLoop | Acciones por disparadores, ajuste automático |
|
|
46
|
+
| 2. Estabilidad primero | StabilityEngine | Reintento, disyuntor, degradación, timeout |
|
|
47
|
+
| 3. Identificación del sistema | SystemIdentifier | Embudo de conversión, métricas de eficiencia |
|
|
48
|
+
| 4. Control óptimo | OptimalController | Gestión de presupuesto, verificación de restricciones |
|
|
49
|
+
| 5. Teoría de la información | InfoFlow | Filtrado de mensajes, distribución |
|
|
50
|
+
| 6. Control adaptativo | AdaptiveTuner | Auto-ajuste de parámetros |
|
|
51
|
+
| 7. Control jerárquico | HierarchyController | Capas Estratégica / Táctica / Ejecutiva |
|
|
52
|
+
|
|
53
|
+
## 🔧 Frameworks Soportados
|
|
54
|
+
|
|
55
|
+
```python
|
|
56
|
+
from cybernetics_agent.adapters import (
|
|
57
|
+
NativeAdapter, # Python puro
|
|
58
|
+
LangChainAdapter, # LangChain
|
|
59
|
+
AutoGenAdapter, # AutoGen
|
|
60
|
+
CrewAIAdapter, # CrewAI
|
|
61
|
+
HermesAdapter, # Hermes Agent
|
|
62
|
+
ClaudeCodeAdapter, # Claude Code CLI
|
|
63
|
+
CodexAdapter, # OpenAI Codex CLI
|
|
64
|
+
OpenClawAdapter, # OpenClaw (HTTP)
|
|
65
|
+
QwenpawAdapter, # Qwenpaw
|
|
66
|
+
)
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
## 📁 Herramientas CLI
|
|
70
|
+
|
|
71
|
+
```bash
|
|
72
|
+
cybernetix init # Inicializar config
|
|
73
|
+
cybernetix audit ./src # Auditar defectos de código
|
|
74
|
+
cybernetix dashboard # Iniciar panel de control
|
|
75
|
+
cybernetix run ./task.py # Ejecutar tarea y recolectar métricas
|
|
76
|
+
```
|
|
77
|
+
|
|
78
|
+
## 📊 Panel de Control
|
|
79
|
+
|
|
80
|
+

|
|
81
|
+
|
|
82
|
+
Iniciar panel de control:
|
|
83
|
+
```bash
|
|
84
|
+
cybernetix dashboard
|
|
85
|
+
```
|
|
86
|
+
|
|
87
|
+
## 📝 Licencia
|
|
88
|
+
|
|
89
|
+
MIT License © 2026 Jiaqi Guo
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
# 🦙 Cybernetics Agent
|
|
2
|
+
|
|
3
|
+
> Une couche d'amélioration cybernétique indépendante du framework pour les agents IA.
|
|
4
|
+
> Basée sur les sept principes fondamentaux de l'*Ingénierie Cybernétique* de H.S. Tsien, permettant à tout agent Python d'être auto-adaptatif, auto-réparant et auto-optimisant.
|
|
5
|
+
|
|
6
|
+
[](https://www.python.org/downloads/)
|
|
7
|
+
[](https://opensource.org/licenses/MIT)
|
|
8
|
+
[]()
|
|
9
|
+
|
|
10
|
+
🌐 **[Français](README.fr.md)** · [中文](README.md) · [English](README.en.md) · [Español](README.es.md) · [日本語](README.ja.md) · [한국어](README.ko.md)
|
|
11
|
+
|
|
12
|
+
---
|
|
13
|
+
|
|
14
|
+
## ✅ Fonctionnalités
|
|
15
|
+
|
|
16
|
+
- **Indépendant du framework** — Bibliothèque standard pure, zéro dépendance externe
|
|
17
|
+
- **Sept Principes** — Couverture complète de l'*Ingénierie Cybernétique* de Tsien
|
|
18
|
+
- **Adaptateurs multi-frameworks** — LangChain, AutoGen, CrewAI, Hermes, Claude Code, Codex, etc.
|
|
19
|
+
- **Configuration déclarative** — Configuration JSON/YAML, flexible et contrôlable
|
|
20
|
+
- **CLI complète** — Outils en ligne de commande `cybernetix` (init / audit / dashboard / run)
|
|
21
|
+
- **Thread-safe** — Verrous de threading intégrés pour la sécurité
|
|
22
|
+
|
|
23
|
+
## 🚀 Démarrage Rapide
|
|
24
|
+
|
|
25
|
+
```bash
|
|
26
|
+
# Installation
|
|
27
|
+
pip install cybernetics-agent
|
|
28
|
+
|
|
29
|
+
# Initialiser la configuration
|
|
30
|
+
cybernetix init
|
|
31
|
+
|
|
32
|
+
# Utilisation
|
|
33
|
+
python -c "
|
|
34
|
+
from cybernetics_agent import CyberneticsConfig, CyberneticsContext
|
|
35
|
+
ctx = CyberneticsContext(CyberneticsConfig(project_name='mon-agent'))
|
|
36
|
+
ctx.emit_tool_result('search', ['article1', 'article2'])
|
|
37
|
+
print(ctx.get_status())
|
|
38
|
+
"
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
## 🎯 Sept Principes
|
|
42
|
+
|
|
43
|
+
| Principe | Module | Fonction |
|
|
44
|
+
|----------|--------|----------|
|
|
45
|
+
| 1. Boucle de rétroaction | FeedbackLoop | Actions basées sur déclencheurs, ajustement automatique |
|
|
46
|
+
| 2. Stabilité prioritaire | StabilityEngine | Réessai, disjoncteur, dégradation, timeout |
|
|
47
|
+
| 3. Identification système | SystemIdentifier | Entonnoir de conversion, métriques d'efficacité |
|
|
48
|
+
| 4. Contrôle optimal | OptimalController | Gestion budget, vérification contraintes |
|
|
49
|
+
| 5. Théorie de l'information | InfoFlow | Filtrage messages, distribution |
|
|
50
|
+
| 6. Contrôle adaptatif | AdaptiveTuner | Auto-ajustement paramètres |
|
|
51
|
+
| 7. Contrôle hiérarchique | HierarchyController | Couches Stratégique / Tactique / Exécutive |
|
|
52
|
+
|
|
53
|
+
## 🔧 Frameworks Supportés
|
|
54
|
+
|
|
55
|
+
```python
|
|
56
|
+
from cybernetics_agent.adapters import (
|
|
57
|
+
NativeAdapter, # Python pur
|
|
58
|
+
LangChainAdapter, # LangChain
|
|
59
|
+
AutoGenAdapter, # AutoGen
|
|
60
|
+
CrewAIAdapter, # CrewAI
|
|
61
|
+
HermesAdapter, # Hermes Agent
|
|
62
|
+
ClaudeCodeAdapter, # Claude Code CLI
|
|
63
|
+
CodexAdapter, # OpenAI Codex CLI
|
|
64
|
+
OpenClawAdapter, # OpenClaw (HTTP)
|
|
65
|
+
QwenpawAdapter, # Qwenpaw
|
|
66
|
+
)
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
## 📁 Outils CLI
|
|
70
|
+
|
|
71
|
+
```bash
|
|
72
|
+
cybernetix init # Initialiser config
|
|
73
|
+
cybernetix audit ./src # Auditer défauts code
|
|
74
|
+
cybernetix dashboard # Lancer tableau de bord
|
|
75
|
+
cybernetix run ./task.py # Exécuter tâche et collecter métriques
|
|
76
|
+
```
|
|
77
|
+
|
|
78
|
+
## 📊 Tableau de Bord
|
|
79
|
+
|
|
80
|
+

|
|
81
|
+
|
|
82
|
+
Lancer le tableau de bord:
|
|
83
|
+
```bash
|
|
84
|
+
cybernetix dashboard
|
|
85
|
+
```
|
|
86
|
+
|
|
87
|
+
## 📝 Licence
|
|
88
|
+
|
|
89
|
+
MIT License © 2026 Jiaqi Guo
|