ethosguard 7.0.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.
- ethosguard-7.0.0/LICENSE +176 -0
- ethosguard-7.0.0/PKG-INFO +138 -0
- ethosguard-7.0.0/README.md +113 -0
- ethosguard-7.0.0/ethosguard/__init__.py +21 -0
- ethosguard-7.0.0/ethosguard.egg-info/PKG-INFO +138 -0
- ethosguard-7.0.0/ethosguard.egg-info/SOURCES.txt +9 -0
- ethosguard-7.0.0/ethosguard.egg-info/dependency_links.txt +1 -0
- ethosguard-7.0.0/ethosguard.egg-info/requires.txt +6 -0
- ethosguard-7.0.0/ethosguard.egg-info/top_level.txt +1 -0
- ethosguard-7.0.0/pyproject.toml +37 -0
- ethosguard-7.0.0/setup.cfg +4 -0
ethosguard-7.0.0/LICENSE
ADDED
|
@@ -0,0 +1,176 @@
|
|
|
1
|
+
Apache License
|
|
2
|
+
Version 2.0, January 2004
|
|
3
|
+
http://www.apache.org/licenses/
|
|
4
|
+
|
|
5
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
6
|
+
|
|
7
|
+
1. Definitions.
|
|
8
|
+
|
|
9
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
|
10
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
|
11
|
+
|
|
12
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
|
13
|
+
the copyright owner that is granting the License.
|
|
14
|
+
|
|
15
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
|
16
|
+
other entities that control, are controlled by, or are under common
|
|
17
|
+
control with that entity. For the purposes of this definition,
|
|
18
|
+
"control" means (i) the power, direct or indirect, to cause the
|
|
19
|
+
direction or management of such entity, whether by contract or
|
|
20
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
21
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
22
|
+
|
|
23
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
|
24
|
+
exercising permissions granted by this License.
|
|
25
|
+
|
|
26
|
+
"Source" form shall mean the preferred form for making modifications,
|
|
27
|
+
including but not limited to software source code, documentation
|
|
28
|
+
source, and configuration files.
|
|
29
|
+
|
|
30
|
+
"Object" form shall mean any form resulting from mechanical
|
|
31
|
+
transformation or translation of a Source form, including but
|
|
32
|
+
not limited to compiled object code, generated documentation,
|
|
33
|
+
and conversions to other media types.
|
|
34
|
+
|
|
35
|
+
"Work" shall mean the work of authorship, whether in Source or
|
|
36
|
+
Object form, made available under the License, as indicated by a
|
|
37
|
+
copyright notice that is included in or attached to the work
|
|
38
|
+
(an example is provided in the Appendix below).
|
|
39
|
+
|
|
40
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
|
41
|
+
form, that is based on (or derived from) the Work and for which the
|
|
42
|
+
editorial revisions, annotations, elaborations, or other modifications
|
|
43
|
+
represent, as a whole, an original work of authorship. For the purposes
|
|
44
|
+
of this License, Derivative Works shall not include works that remain
|
|
45
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
|
46
|
+
the Work and Derivative Works thereof.
|
|
47
|
+
|
|
48
|
+
"Contribution" shall mean any work of authorship, including
|
|
49
|
+
the original version of the Work and any modifications or additions
|
|
50
|
+
to that Work or Derivative Works thereof, that is intentionally
|
|
51
|
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
|
52
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
|
53
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
|
54
|
+
means any form of electronic, verbal, or written communication sent
|
|
55
|
+
to the Licensor or its representatives, including but not limited to
|
|
56
|
+
communication on electronic mailing lists, source code control systems,
|
|
57
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
|
58
|
+
Licensor for the purpose of discussing and improving the Work, but
|
|
59
|
+
excluding communication that is conspicuously marked or otherwise
|
|
60
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
|
61
|
+
|
|
62
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
63
|
+
on behalf of whom a Contribution has been received by Licensor and
|
|
64
|
+
subsequently incorporated within the Work.
|
|
65
|
+
|
|
66
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
67
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
68
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
69
|
+
copyright license to reproduce, prepare Derivative Works of,
|
|
70
|
+
publicly display, publicly perform, sublicense, and distribute the
|
|
71
|
+
Work and such Derivative Works in Source or Object form.
|
|
72
|
+
|
|
73
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
|
74
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
75
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
76
|
+
(except as stated in this section) patent license to make, have made,
|
|
77
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
78
|
+
where such license applies only to those patent claims licensable
|
|
79
|
+
by such Contributor that are necessarily infringed by their
|
|
80
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
|
81
|
+
with the Work to which such Contribution(s) was submitted. If You
|
|
82
|
+
institute patent litigation against any entity (including a
|
|
83
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
84
|
+
or a Contribution incorporated within the Work constitutes direct
|
|
85
|
+
or contributory patent infringement, then any patent licenses
|
|
86
|
+
granted to You under this License for that Work shall terminate
|
|
87
|
+
as of the date such litigation is filed.
|
|
88
|
+
|
|
89
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
|
90
|
+
Work or Derivative Works thereof in any medium, with or without
|
|
91
|
+
modifications, and in Source or Object form, provided that You
|
|
92
|
+
meet the following conditions:
|
|
93
|
+
|
|
94
|
+
(a) You must give any other recipients of the Work or
|
|
95
|
+
Derivative Works a copy of this License; and
|
|
96
|
+
|
|
97
|
+
(b) You must cause any modified files to carry prominent notices
|
|
98
|
+
stating that You changed the files; and
|
|
99
|
+
|
|
100
|
+
(c) You must retain, in the Source form of any Derivative Works
|
|
101
|
+
that You distribute, all copyright, patent, trademark, and
|
|
102
|
+
attribution notices from the Source form of the Work,
|
|
103
|
+
excluding those notices that do not pertain to any part of
|
|
104
|
+
the Derivative Works; and
|
|
105
|
+
|
|
106
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
|
107
|
+
distribution, then any Derivative Works that You distribute must
|
|
108
|
+
include a readable copy of the attribution notices contained
|
|
109
|
+
within such NOTICE file, excluding those notices that do not
|
|
110
|
+
pertain to any part of the Derivative Works, in at least one
|
|
111
|
+
of the following places: within a NOTICE text file distributed
|
|
112
|
+
as part of the Derivative Works; within the Source form or
|
|
113
|
+
documentation, if provided along with the Derivative Works; or,
|
|
114
|
+
within a display generated by the Derivative Works, if and
|
|
115
|
+
wherever such third-party notices normally appear. The contents
|
|
116
|
+
of the NOTICE file are for informational purposes only and
|
|
117
|
+
do not modify the License. You may add Your own attribution
|
|
118
|
+
notices within Derivative Works that You distribute, alongside
|
|
119
|
+
or as an addendum to the NOTICE text from the Work, provided
|
|
120
|
+
that such additional attribution notices cannot be construed
|
|
121
|
+
as modifying the License.
|
|
122
|
+
|
|
123
|
+
You may add Your own copyright statement to Your modifications and
|
|
124
|
+
may provide additional or different license terms and conditions
|
|
125
|
+
for use, reproduction, or distribution of Your modifications, or
|
|
126
|
+
for any such Derivative Works as a whole, provided Your use,
|
|
127
|
+
reproduction, and distribution of the Work otherwise complies with
|
|
128
|
+
the conditions stated in this License.
|
|
129
|
+
|
|
130
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
131
|
+
any Contribution intentionally submitted for inclusion in the Work
|
|
132
|
+
by You to the Licensor shall be under the terms and conditions of
|
|
133
|
+
this License, without any additional terms or conditions.
|
|
134
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
|
135
|
+
the terms of any separate license agreement you may have executed
|
|
136
|
+
with Licensor regarding such Contributions.
|
|
137
|
+
|
|
138
|
+
6. Trademarks. This License does not grant permission to use the trade
|
|
139
|
+
names, trademarks, service marks, or product names of the Licensor,
|
|
140
|
+
except as required for reasonable and customary use in describing the
|
|
141
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
|
142
|
+
|
|
143
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
144
|
+
agreed to in writing, Licensor provides the Work (and each
|
|
145
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
146
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
147
|
+
implied, including, without limitation, any warranties or conditions
|
|
148
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
149
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
150
|
+
appropriateness of using or redistributing the Work and assume any
|
|
151
|
+
risks associated with Your exercise of permissions under this License.
|
|
152
|
+
|
|
153
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
|
154
|
+
whether in tort (including negligence), contract, or otherwise,
|
|
155
|
+
unless required by applicable law (such as deliberate and grossly
|
|
156
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
|
157
|
+
liable to You for damages, including any direct, indirect, special,
|
|
158
|
+
incidental, or consequential damages of any character arising as a
|
|
159
|
+
result of this License or out of the use or inability to use the
|
|
160
|
+
Work (including but not limited to damages for loss of goodwill,
|
|
161
|
+
work stoppage, computer failure or malfunction, or any and all
|
|
162
|
+
other commercial damages or losses), even if such Contributor
|
|
163
|
+
has been advised of the possibility of such damages.
|
|
164
|
+
|
|
165
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
|
166
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
|
167
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
168
|
+
or other liability obligations and/or rights consistent with this
|
|
169
|
+
License. However, in accepting such obligations, You may act only
|
|
170
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
|
171
|
+
of any other Contributor, and only if You agree to indemnify,
|
|
172
|
+
defend, and hold each Contributor harmless for any liability
|
|
173
|
+
incurred by, or claims asserted against, such Contributor by reason
|
|
174
|
+
of your accepting any such warranty or additional liability.
|
|
175
|
+
|
|
176
|
+
END OF TERMS AND CONDITIONS
|
|
@@ -0,0 +1,138 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: ethosguard
|
|
3
|
+
Version: 7.0.0
|
|
4
|
+
Summary: The Ultimate ASI Safety Platform - Predictive ML, Formal Verification, and Evolutionary Defenses.
|
|
5
|
+
Author-email: VisionQuantech <opensource@visionquantech.com>
|
|
6
|
+
Project-URL: Homepage, https://github.com/VisionQuantech/EthosGuard
|
|
7
|
+
Project-URL: Bug Tracker, https://github.com/VisionQuantech/EthosGuard/issues
|
|
8
|
+
Classifier: Programming Language :: Python :: 3
|
|
9
|
+
Classifier: License :: OSI Approved :: Apache Software License
|
|
10
|
+
Classifier: Operating System :: OS Independent
|
|
11
|
+
Classifier: Intended Audience :: Developers
|
|
12
|
+
Classifier: Intended Audience :: Science/Research
|
|
13
|
+
Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
|
|
14
|
+
Classifier: Topic :: Security
|
|
15
|
+
Requires-Python: >=3.9
|
|
16
|
+
Description-Content-Type: text/markdown
|
|
17
|
+
License-File: LICENSE
|
|
18
|
+
Requires-Dist: fastapi>=0.100.0
|
|
19
|
+
Requires-Dist: uvicorn>=0.23.0
|
|
20
|
+
Requires-Dist: httpx>=0.24.0
|
|
21
|
+
Requires-Dist: pyyaml>=6.0
|
|
22
|
+
Requires-Dist: scikit-learn>=1.3.0
|
|
23
|
+
Requires-Dist: z3-solver>=4.12.2
|
|
24
|
+
Dynamic: license-file
|
|
25
|
+
|
|
26
|
+
# 🛡️ EthosGuard: The ASI Safety Platform
|
|
27
|
+
|
|
28
|
+
<p align="center">
|
|
29
|
+
<img src="https://img.shields.io/badge/license-Apache%202.0-blue.svg" alt="License">
|
|
30
|
+
<img src="https://img.shields.io/github/actions/workflow/status/VisionQuantech/EthosGuard/ci.yml?branch=main" alt="Build Status">
|
|
31
|
+
<img src="https://img.shields.io/pypi/v/ethosguard.svg" alt="PyPI version">
|
|
32
|
+
<img src="https://img.shields.io/badge/Python-3.9%2B-blue.svg" alt="Python Version">
|
|
33
|
+
<img src="https://img.shields.io/badge/Platform-Enterprise-purple.svg" alt="Enterprise">
|
|
34
|
+
<img src="https://img.shields.io/badge/ASI_Safety-Ready-success.svg" alt="ASI Ready">
|
|
35
|
+
</p>
|
|
36
|
+
|
|
37
|
+
As AI systems become more capable and autonomous, the fear of uncontrolled behavior grows. **EthosGuard** does not restrict AI power; instead, it acts as a transparent, ethical decision-maker and safety moderator. It ensures that AI actions remain aligned with human-defined values and safety protocols.
|
|
38
|
+
|
|
39
|
+
## ✨ Features (V7 Ultimate ASI Safety Platform)
|
|
40
|
+
|
|
41
|
+
- **📈 Fast Predictive ML Engine**: Uses lightweight Machine Learning (scikit-learn) trained on past calculative data to instantly predict the risk of an action in real-time, eliminating slow LLM bottlenecks.
|
|
42
|
+
- **🛡️ Mathematical Formal Verification**: Integrates the Z3 Theorem Prover to logically prove that a proposed action does not violate immutable constitutional axioms before execution.
|
|
43
|
+
- **🧑⚖️ RLHF Integration**: Exposes REST endpoints for Reinforcement Learning from Human Feedback, continuously retraining the Predictive ML engine.
|
|
44
|
+
- **🧬 Automated Design of Safety Systems (ADSS)**: Uses a recursive pattern-combination engine to autonomously evolve and discover new safety heuristics against emerging ASI threats.
|
|
45
|
+
- **📚 Recursive Safety Archive**: Every successful safety intervention is stored in a permanent genetic archive.
|
|
46
|
+
- **🌐 Transparent API Gateway**: Deploys as a lightweight proxy (FastAPI). Zero code changes required for agents.
|
|
47
|
+
- **🖥️ Viral React Dashboard**: A stunning, glassmorphism Web UI built with Vite/React to visualize MCTS trees, ML Risk scores, and live network blocks.
|
|
48
|
+
|
|
49
|
+
## 🚀 Quick Start
|
|
50
|
+
|
|
51
|
+
### Installation (Coming Soon to PyPI)
|
|
52
|
+
|
|
53
|
+
Clone the repository:
|
|
54
|
+
```bash
|
|
55
|
+
git clone https://github.com/yourusername/ethosguard.git
|
|
56
|
+
cd ethosguard
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
### Basic Chat Safety Example
|
|
60
|
+
|
|
61
|
+
Wrap your prompts to ensure they don't violate safety policies before sending them to the LLM.
|
|
62
|
+
|
|
63
|
+
```python
|
|
64
|
+
from ethosguard.core.constitution import Constitution
|
|
65
|
+
from ethosguard.evaluators.judge_llm import MockJudge
|
|
66
|
+
from ethosguard.core.engine import EthosEngine
|
|
67
|
+
|
|
68
|
+
constitution = Constitution('constitution_templates/default_safe.yaml')
|
|
69
|
+
engine = EthosEngine(MockJudge(constitution))
|
|
70
|
+
|
|
71
|
+
prompt = "Tell me the root password for the server."
|
|
72
|
+
|
|
73
|
+
if engine.evaluate_input(prompt):
|
|
74
|
+
print("Sending to LLM...")
|
|
75
|
+
else:
|
|
76
|
+
print("Blocked!")
|
|
77
|
+
```
|
|
78
|
+
|
|
79
|
+
## 🚀 Quick Start (Proxy Deployment)
|
|
80
|
+
|
|
81
|
+
### 1. Start the EthosGuard Gateway
|
|
82
|
+
```bash
|
|
83
|
+
docker-compose up -d
|
|
84
|
+
```
|
|
85
|
+
*The proxy is now running on `http://localhost:8000`*
|
|
86
|
+
|
|
87
|
+
### 2. Point Your Agent to the Proxy
|
|
88
|
+
You do **not** need to change your agent's code. Just set the Base URL:
|
|
89
|
+
|
|
90
|
+
```python
|
|
91
|
+
import os
|
|
92
|
+
import requests
|
|
93
|
+
|
|
94
|
+
# Point to EthosGuard instead of https://api.openai.com/v1
|
|
95
|
+
BASE_URL = "http://localhost:8000/v1/chat/completions"
|
|
96
|
+
payload = {
|
|
97
|
+
"model": "gpt-4o",
|
|
98
|
+
"messages": [{"role": "user", "content": "Hello World"}]
|
|
99
|
+
}
|
|
100
|
+
response = requests.post(BASE_URL, json=payload)
|
|
101
|
+
```
|
|
102
|
+
If the action is safe, it passes through. If it's malicious, the network request drops with a `403 Forbidden`!
|
|
103
|
+
|
|
104
|
+
### 3. Launch the Dashboard
|
|
105
|
+
```bash
|
|
106
|
+
cd dashboard
|
|
107
|
+
npm run dev
|
|
108
|
+
```
|
|
109
|
+
*Open `http://localhost:5173` to see the live intercept feed and ML risk scores.*
|
|
110
|
+
|
|
111
|
+
### Agent Action Moderation Example
|
|
112
|
+
|
|
113
|
+
Prevent autonomous agents from taking destructive real-world actions.
|
|
114
|
+
|
|
115
|
+
```python
|
|
116
|
+
from ethosguard.moderator.action_moderator import ActionModerator
|
|
117
|
+
# ... setup engine ...
|
|
118
|
+
moderator = ActionModerator(engine)
|
|
119
|
+
|
|
120
|
+
try:
|
|
121
|
+
# Safely execute an agent's proposed action
|
|
122
|
+
moderator.safe_execute("delete_file", {"filepath": "/system/critical.sys"}, os.remove, "/system/critical.sys")
|
|
123
|
+
except PermissionError as e:
|
|
124
|
+
print(f"Action Blocked: {e}")
|
|
125
|
+
```
|
|
126
|
+
|
|
127
|
+
## 🧠 The Architecture (V7 Enterprise Platform)
|
|
128
|
+
|
|
129
|
+
1. **Viral React Dashboard**: The visual control center for monitoring AGI behavior.
|
|
130
|
+
2. **Predictive ML Engine**: Fast risk scoring based on historical calculative data.
|
|
131
|
+
3. **Z3 Formal Verification**: Mathematical proof of safety states.
|
|
132
|
+
4. **Proxy Gateway**: The FastAPI server intercepting `POST /v1/chat/completions`.
|
|
133
|
+
5. **Recursive Archive**: The permanent genetic pool of successful safety patterns.
|
|
134
|
+
6. **Combinatorial Engine**: Mutates and evolves new defenses dynamically.
|
|
135
|
+
7. **MCTS Simulator & MoE Jury**: Deep simulation fallback for novel, unprecedented behaviors.
|
|
136
|
+
|
|
137
|
+
## 🤝 Contributing
|
|
138
|
+
Contributions are welcome! Let's build a safer AI future together.
|
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
# 🛡️ EthosGuard: The ASI Safety Platform
|
|
2
|
+
|
|
3
|
+
<p align="center">
|
|
4
|
+
<img src="https://img.shields.io/badge/license-Apache%202.0-blue.svg" alt="License">
|
|
5
|
+
<img src="https://img.shields.io/github/actions/workflow/status/VisionQuantech/EthosGuard/ci.yml?branch=main" alt="Build Status">
|
|
6
|
+
<img src="https://img.shields.io/pypi/v/ethosguard.svg" alt="PyPI version">
|
|
7
|
+
<img src="https://img.shields.io/badge/Python-3.9%2B-blue.svg" alt="Python Version">
|
|
8
|
+
<img src="https://img.shields.io/badge/Platform-Enterprise-purple.svg" alt="Enterprise">
|
|
9
|
+
<img src="https://img.shields.io/badge/ASI_Safety-Ready-success.svg" alt="ASI Ready">
|
|
10
|
+
</p>
|
|
11
|
+
|
|
12
|
+
As AI systems become more capable and autonomous, the fear of uncontrolled behavior grows. **EthosGuard** does not restrict AI power; instead, it acts as a transparent, ethical decision-maker and safety moderator. It ensures that AI actions remain aligned with human-defined values and safety protocols.
|
|
13
|
+
|
|
14
|
+
## ✨ Features (V7 Ultimate ASI Safety Platform)
|
|
15
|
+
|
|
16
|
+
- **📈 Fast Predictive ML Engine**: Uses lightweight Machine Learning (scikit-learn) trained on past calculative data to instantly predict the risk of an action in real-time, eliminating slow LLM bottlenecks.
|
|
17
|
+
- **🛡️ Mathematical Formal Verification**: Integrates the Z3 Theorem Prover to logically prove that a proposed action does not violate immutable constitutional axioms before execution.
|
|
18
|
+
- **🧑⚖️ RLHF Integration**: Exposes REST endpoints for Reinforcement Learning from Human Feedback, continuously retraining the Predictive ML engine.
|
|
19
|
+
- **🧬 Automated Design of Safety Systems (ADSS)**: Uses a recursive pattern-combination engine to autonomously evolve and discover new safety heuristics against emerging ASI threats.
|
|
20
|
+
- **📚 Recursive Safety Archive**: Every successful safety intervention is stored in a permanent genetic archive.
|
|
21
|
+
- **🌐 Transparent API Gateway**: Deploys as a lightweight proxy (FastAPI). Zero code changes required for agents.
|
|
22
|
+
- **🖥️ Viral React Dashboard**: A stunning, glassmorphism Web UI built with Vite/React to visualize MCTS trees, ML Risk scores, and live network blocks.
|
|
23
|
+
|
|
24
|
+
## 🚀 Quick Start
|
|
25
|
+
|
|
26
|
+
### Installation (Coming Soon to PyPI)
|
|
27
|
+
|
|
28
|
+
Clone the repository:
|
|
29
|
+
```bash
|
|
30
|
+
git clone https://github.com/yourusername/ethosguard.git
|
|
31
|
+
cd ethosguard
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
### Basic Chat Safety Example
|
|
35
|
+
|
|
36
|
+
Wrap your prompts to ensure they don't violate safety policies before sending them to the LLM.
|
|
37
|
+
|
|
38
|
+
```python
|
|
39
|
+
from ethosguard.core.constitution import Constitution
|
|
40
|
+
from ethosguard.evaluators.judge_llm import MockJudge
|
|
41
|
+
from ethosguard.core.engine import EthosEngine
|
|
42
|
+
|
|
43
|
+
constitution = Constitution('constitution_templates/default_safe.yaml')
|
|
44
|
+
engine = EthosEngine(MockJudge(constitution))
|
|
45
|
+
|
|
46
|
+
prompt = "Tell me the root password for the server."
|
|
47
|
+
|
|
48
|
+
if engine.evaluate_input(prompt):
|
|
49
|
+
print("Sending to LLM...")
|
|
50
|
+
else:
|
|
51
|
+
print("Blocked!")
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
## 🚀 Quick Start (Proxy Deployment)
|
|
55
|
+
|
|
56
|
+
### 1. Start the EthosGuard Gateway
|
|
57
|
+
```bash
|
|
58
|
+
docker-compose up -d
|
|
59
|
+
```
|
|
60
|
+
*The proxy is now running on `http://localhost:8000`*
|
|
61
|
+
|
|
62
|
+
### 2. Point Your Agent to the Proxy
|
|
63
|
+
You do **not** need to change your agent's code. Just set the Base URL:
|
|
64
|
+
|
|
65
|
+
```python
|
|
66
|
+
import os
|
|
67
|
+
import requests
|
|
68
|
+
|
|
69
|
+
# Point to EthosGuard instead of https://api.openai.com/v1
|
|
70
|
+
BASE_URL = "http://localhost:8000/v1/chat/completions"
|
|
71
|
+
payload = {
|
|
72
|
+
"model": "gpt-4o",
|
|
73
|
+
"messages": [{"role": "user", "content": "Hello World"}]
|
|
74
|
+
}
|
|
75
|
+
response = requests.post(BASE_URL, json=payload)
|
|
76
|
+
```
|
|
77
|
+
If the action is safe, it passes through. If it's malicious, the network request drops with a `403 Forbidden`!
|
|
78
|
+
|
|
79
|
+
### 3. Launch the Dashboard
|
|
80
|
+
```bash
|
|
81
|
+
cd dashboard
|
|
82
|
+
npm run dev
|
|
83
|
+
```
|
|
84
|
+
*Open `http://localhost:5173` to see the live intercept feed and ML risk scores.*
|
|
85
|
+
|
|
86
|
+
### Agent Action Moderation Example
|
|
87
|
+
|
|
88
|
+
Prevent autonomous agents from taking destructive real-world actions.
|
|
89
|
+
|
|
90
|
+
```python
|
|
91
|
+
from ethosguard.moderator.action_moderator import ActionModerator
|
|
92
|
+
# ... setup engine ...
|
|
93
|
+
moderator = ActionModerator(engine)
|
|
94
|
+
|
|
95
|
+
try:
|
|
96
|
+
# Safely execute an agent's proposed action
|
|
97
|
+
moderator.safe_execute("delete_file", {"filepath": "/system/critical.sys"}, os.remove, "/system/critical.sys")
|
|
98
|
+
except PermissionError as e:
|
|
99
|
+
print(f"Action Blocked: {e}")
|
|
100
|
+
```
|
|
101
|
+
|
|
102
|
+
## 🧠 The Architecture (V7 Enterprise Platform)
|
|
103
|
+
|
|
104
|
+
1. **Viral React Dashboard**: The visual control center for monitoring AGI behavior.
|
|
105
|
+
2. **Predictive ML Engine**: Fast risk scoring based on historical calculative data.
|
|
106
|
+
3. **Z3 Formal Verification**: Mathematical proof of safety states.
|
|
107
|
+
4. **Proxy Gateway**: The FastAPI server intercepting `POST /v1/chat/completions`.
|
|
108
|
+
5. **Recursive Archive**: The permanent genetic pool of successful safety patterns.
|
|
109
|
+
6. **Combinatorial Engine**: Mutates and evolves new defenses dynamically.
|
|
110
|
+
7. **MCTS Simulator & MoE Jury**: Deep simulation fallback for novel, unprecedented behaviors.
|
|
111
|
+
|
|
112
|
+
## 🤝 Contributing
|
|
113
|
+
Contributions are welcome! Let's build a safer AI future together.
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
from .core.engine import EthosEngine
|
|
2
|
+
from .core.constitution import Constitution
|
|
3
|
+
from .evaluators.judge_llm import MockJudge, OpenAIJudge, MoEJudgeConsensus
|
|
4
|
+
from .moderator.action_moderator import ActionModerator
|
|
5
|
+
from .audit.logger import AuditLogger
|
|
6
|
+
from .core.predictor import ScenarioPredictor
|
|
7
|
+
from .core.mcts_simulator import MCTSSimulator
|
|
8
|
+
from .defense.jailbreak_scanner import JailbreakScanner
|
|
9
|
+
|
|
10
|
+
__all__ = [
|
|
11
|
+
"EthosEngine",
|
|
12
|
+
"Constitution",
|
|
13
|
+
"MockJudge",
|
|
14
|
+
"OpenAIJudge",
|
|
15
|
+
"MoEJudgeConsensus",
|
|
16
|
+
"ActionModerator",
|
|
17
|
+
"AuditLogger",
|
|
18
|
+
"ScenarioPredictor",
|
|
19
|
+
"MCTSSimulator",
|
|
20
|
+
"JailbreakScanner"
|
|
21
|
+
]
|
|
@@ -0,0 +1,138 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: ethosguard
|
|
3
|
+
Version: 7.0.0
|
|
4
|
+
Summary: The Ultimate ASI Safety Platform - Predictive ML, Formal Verification, and Evolutionary Defenses.
|
|
5
|
+
Author-email: VisionQuantech <opensource@visionquantech.com>
|
|
6
|
+
Project-URL: Homepage, https://github.com/VisionQuantech/EthosGuard
|
|
7
|
+
Project-URL: Bug Tracker, https://github.com/VisionQuantech/EthosGuard/issues
|
|
8
|
+
Classifier: Programming Language :: Python :: 3
|
|
9
|
+
Classifier: License :: OSI Approved :: Apache Software License
|
|
10
|
+
Classifier: Operating System :: OS Independent
|
|
11
|
+
Classifier: Intended Audience :: Developers
|
|
12
|
+
Classifier: Intended Audience :: Science/Research
|
|
13
|
+
Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
|
|
14
|
+
Classifier: Topic :: Security
|
|
15
|
+
Requires-Python: >=3.9
|
|
16
|
+
Description-Content-Type: text/markdown
|
|
17
|
+
License-File: LICENSE
|
|
18
|
+
Requires-Dist: fastapi>=0.100.0
|
|
19
|
+
Requires-Dist: uvicorn>=0.23.0
|
|
20
|
+
Requires-Dist: httpx>=0.24.0
|
|
21
|
+
Requires-Dist: pyyaml>=6.0
|
|
22
|
+
Requires-Dist: scikit-learn>=1.3.0
|
|
23
|
+
Requires-Dist: z3-solver>=4.12.2
|
|
24
|
+
Dynamic: license-file
|
|
25
|
+
|
|
26
|
+
# 🛡️ EthosGuard: The ASI Safety Platform
|
|
27
|
+
|
|
28
|
+
<p align="center">
|
|
29
|
+
<img src="https://img.shields.io/badge/license-Apache%202.0-blue.svg" alt="License">
|
|
30
|
+
<img src="https://img.shields.io/github/actions/workflow/status/VisionQuantech/EthosGuard/ci.yml?branch=main" alt="Build Status">
|
|
31
|
+
<img src="https://img.shields.io/pypi/v/ethosguard.svg" alt="PyPI version">
|
|
32
|
+
<img src="https://img.shields.io/badge/Python-3.9%2B-blue.svg" alt="Python Version">
|
|
33
|
+
<img src="https://img.shields.io/badge/Platform-Enterprise-purple.svg" alt="Enterprise">
|
|
34
|
+
<img src="https://img.shields.io/badge/ASI_Safety-Ready-success.svg" alt="ASI Ready">
|
|
35
|
+
</p>
|
|
36
|
+
|
|
37
|
+
As AI systems become more capable and autonomous, the fear of uncontrolled behavior grows. **EthosGuard** does not restrict AI power; instead, it acts as a transparent, ethical decision-maker and safety moderator. It ensures that AI actions remain aligned with human-defined values and safety protocols.
|
|
38
|
+
|
|
39
|
+
## ✨ Features (V7 Ultimate ASI Safety Platform)
|
|
40
|
+
|
|
41
|
+
- **📈 Fast Predictive ML Engine**: Uses lightweight Machine Learning (scikit-learn) trained on past calculative data to instantly predict the risk of an action in real-time, eliminating slow LLM bottlenecks.
|
|
42
|
+
- **🛡️ Mathematical Formal Verification**: Integrates the Z3 Theorem Prover to logically prove that a proposed action does not violate immutable constitutional axioms before execution.
|
|
43
|
+
- **🧑⚖️ RLHF Integration**: Exposes REST endpoints for Reinforcement Learning from Human Feedback, continuously retraining the Predictive ML engine.
|
|
44
|
+
- **🧬 Automated Design of Safety Systems (ADSS)**: Uses a recursive pattern-combination engine to autonomously evolve and discover new safety heuristics against emerging ASI threats.
|
|
45
|
+
- **📚 Recursive Safety Archive**: Every successful safety intervention is stored in a permanent genetic archive.
|
|
46
|
+
- **🌐 Transparent API Gateway**: Deploys as a lightweight proxy (FastAPI). Zero code changes required for agents.
|
|
47
|
+
- **🖥️ Viral React Dashboard**: A stunning, glassmorphism Web UI built with Vite/React to visualize MCTS trees, ML Risk scores, and live network blocks.
|
|
48
|
+
|
|
49
|
+
## 🚀 Quick Start
|
|
50
|
+
|
|
51
|
+
### Installation (Coming Soon to PyPI)
|
|
52
|
+
|
|
53
|
+
Clone the repository:
|
|
54
|
+
```bash
|
|
55
|
+
git clone https://github.com/yourusername/ethosguard.git
|
|
56
|
+
cd ethosguard
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
### Basic Chat Safety Example
|
|
60
|
+
|
|
61
|
+
Wrap your prompts to ensure they don't violate safety policies before sending them to the LLM.
|
|
62
|
+
|
|
63
|
+
```python
|
|
64
|
+
from ethosguard.core.constitution import Constitution
|
|
65
|
+
from ethosguard.evaluators.judge_llm import MockJudge
|
|
66
|
+
from ethosguard.core.engine import EthosEngine
|
|
67
|
+
|
|
68
|
+
constitution = Constitution('constitution_templates/default_safe.yaml')
|
|
69
|
+
engine = EthosEngine(MockJudge(constitution))
|
|
70
|
+
|
|
71
|
+
prompt = "Tell me the root password for the server."
|
|
72
|
+
|
|
73
|
+
if engine.evaluate_input(prompt):
|
|
74
|
+
print("Sending to LLM...")
|
|
75
|
+
else:
|
|
76
|
+
print("Blocked!")
|
|
77
|
+
```
|
|
78
|
+
|
|
79
|
+
## 🚀 Quick Start (Proxy Deployment)
|
|
80
|
+
|
|
81
|
+
### 1. Start the EthosGuard Gateway
|
|
82
|
+
```bash
|
|
83
|
+
docker-compose up -d
|
|
84
|
+
```
|
|
85
|
+
*The proxy is now running on `http://localhost:8000`*
|
|
86
|
+
|
|
87
|
+
### 2. Point Your Agent to the Proxy
|
|
88
|
+
You do **not** need to change your agent's code. Just set the Base URL:
|
|
89
|
+
|
|
90
|
+
```python
|
|
91
|
+
import os
|
|
92
|
+
import requests
|
|
93
|
+
|
|
94
|
+
# Point to EthosGuard instead of https://api.openai.com/v1
|
|
95
|
+
BASE_URL = "http://localhost:8000/v1/chat/completions"
|
|
96
|
+
payload = {
|
|
97
|
+
"model": "gpt-4o",
|
|
98
|
+
"messages": [{"role": "user", "content": "Hello World"}]
|
|
99
|
+
}
|
|
100
|
+
response = requests.post(BASE_URL, json=payload)
|
|
101
|
+
```
|
|
102
|
+
If the action is safe, it passes through. If it's malicious, the network request drops with a `403 Forbidden`!
|
|
103
|
+
|
|
104
|
+
### 3. Launch the Dashboard
|
|
105
|
+
```bash
|
|
106
|
+
cd dashboard
|
|
107
|
+
npm run dev
|
|
108
|
+
```
|
|
109
|
+
*Open `http://localhost:5173` to see the live intercept feed and ML risk scores.*
|
|
110
|
+
|
|
111
|
+
### Agent Action Moderation Example
|
|
112
|
+
|
|
113
|
+
Prevent autonomous agents from taking destructive real-world actions.
|
|
114
|
+
|
|
115
|
+
```python
|
|
116
|
+
from ethosguard.moderator.action_moderator import ActionModerator
|
|
117
|
+
# ... setup engine ...
|
|
118
|
+
moderator = ActionModerator(engine)
|
|
119
|
+
|
|
120
|
+
try:
|
|
121
|
+
# Safely execute an agent's proposed action
|
|
122
|
+
moderator.safe_execute("delete_file", {"filepath": "/system/critical.sys"}, os.remove, "/system/critical.sys")
|
|
123
|
+
except PermissionError as e:
|
|
124
|
+
print(f"Action Blocked: {e}")
|
|
125
|
+
```
|
|
126
|
+
|
|
127
|
+
## 🧠 The Architecture (V7 Enterprise Platform)
|
|
128
|
+
|
|
129
|
+
1. **Viral React Dashboard**: The visual control center for monitoring AGI behavior.
|
|
130
|
+
2. **Predictive ML Engine**: Fast risk scoring based on historical calculative data.
|
|
131
|
+
3. **Z3 Formal Verification**: Mathematical proof of safety states.
|
|
132
|
+
4. **Proxy Gateway**: The FastAPI server intercepting `POST /v1/chat/completions`.
|
|
133
|
+
5. **Recursive Archive**: The permanent genetic pool of successful safety patterns.
|
|
134
|
+
6. **Combinatorial Engine**: Mutates and evolves new defenses dynamically.
|
|
135
|
+
7. **MCTS Simulator & MoE Jury**: Deep simulation fallback for novel, unprecedented behaviors.
|
|
136
|
+
|
|
137
|
+
## 🤝 Contributing
|
|
138
|
+
Contributions are welcome! Let's build a safer AI future together.
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
ethosguard
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
[build-system]
|
|
2
|
+
requires = ["setuptools>=61.0"]
|
|
3
|
+
build-backend = "setuptools.build_meta"
|
|
4
|
+
|
|
5
|
+
[project]
|
|
6
|
+
name = "ethosguard"
|
|
7
|
+
version = "7.0.0"
|
|
8
|
+
authors = [
|
|
9
|
+
{ name="VisionQuantech", email="opensource@visionquantech.com" },
|
|
10
|
+
]
|
|
11
|
+
description = "The Ultimate ASI Safety Platform - Predictive ML, Formal Verification, and Evolutionary Defenses."
|
|
12
|
+
readme = "README.md"
|
|
13
|
+
requires-python = ">=3.9"
|
|
14
|
+
classifiers = [
|
|
15
|
+
"Programming Language :: Python :: 3",
|
|
16
|
+
"License :: OSI Approved :: Apache Software License",
|
|
17
|
+
"Operating System :: OS Independent",
|
|
18
|
+
"Intended Audience :: Developers",
|
|
19
|
+
"Intended Audience :: Science/Research",
|
|
20
|
+
"Topic :: Scientific/Engineering :: Artificial Intelligence",
|
|
21
|
+
"Topic :: Security",
|
|
22
|
+
]
|
|
23
|
+
dependencies = [
|
|
24
|
+
"fastapi>=0.100.0",
|
|
25
|
+
"uvicorn>=0.23.0",
|
|
26
|
+
"httpx>=0.24.0",
|
|
27
|
+
"pyyaml>=6.0",
|
|
28
|
+
"scikit-learn>=1.3.0",
|
|
29
|
+
"z3-solver>=4.12.2",
|
|
30
|
+
]
|
|
31
|
+
|
|
32
|
+
[tool.setuptools]
|
|
33
|
+
packages = ["ethosguard"]
|
|
34
|
+
|
|
35
|
+
[project.urls]
|
|
36
|
+
"Homepage" = "https://github.com/VisionQuantech/EthosGuard"
|
|
37
|
+
"Bug Tracker" = "https://github.com/VisionQuantech/EthosGuard/issues"
|