nees-sdk 3.0.0rc1__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.
- nees_sdk-3.0.0rc1/LICENSE +28 -0
- nees_sdk-3.0.0rc1/MANIFEST.in +7 -0
- nees_sdk-3.0.0rc1/PKG-INFO +304 -0
- nees_sdk-3.0.0rc1/README.md +279 -0
- nees_sdk-3.0.0rc1/SECURITY.md +28 -0
- nees_sdk-3.0.0rc1/pyproject.toml +51 -0
- nees_sdk-3.0.0rc1/setup.cfg +4 -0
- nees_sdk-3.0.0rc1/src/nees/__init__.py +93 -0
- nees_sdk-3.0.0rc1/src/nees/cli.py +81 -0
- nees_sdk-3.0.0rc1/src/nees/client.py +145 -0
- nees_sdk-3.0.0rc1/src/nees/config.py +99 -0
- nees_sdk-3.0.0rc1/src/nees/contracts.py +75 -0
- nees_sdk-3.0.0rc1/src/nees/errors.py +97 -0
- nees_sdk-3.0.0rc1/src/nees/http.py +301 -0
- nees_sdk-3.0.0rc1/src/nees/py.typed +0 -0
- nees_sdk-3.0.0rc1/src/nees/results.py +69 -0
- nees_sdk-3.0.0rc1/src/nees/testing.py +34 -0
- nees_sdk-3.0.0rc1/src/nees_sdk.egg-info/PKG-INFO +304 -0
- nees_sdk-3.0.0rc1/src/nees_sdk.egg-info/SOURCES.txt +21 -0
- nees_sdk-3.0.0rc1/src/nees_sdk.egg-info/dependency_links.txt +1 -0
- nees_sdk-3.0.0rc1/src/nees_sdk.egg-info/entry_points.txt +2 -0
- nees_sdk-3.0.0rc1/src/nees_sdk.egg-info/requires.txt +6 -0
- nees_sdk-3.0.0rc1/src/nees_sdk.egg-info/top_level.txt +1 -0
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
Nainacore SDK Proprietary License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Nainacore Emotional Tech. All rights reserved.
|
|
4
|
+
|
|
5
|
+
Permission is granted to download, install, and use the NEES Python SDK solely
|
|
6
|
+
for the purpose of accessing NEES services for which the user has valid
|
|
7
|
+
authorization.
|
|
8
|
+
|
|
9
|
+
This license applies only to the NEES Python SDK distribution. It does not grant
|
|
10
|
+
any license, ownership right, or other right in the NEES Core Engine, NEES
|
|
11
|
+
service-side software, governance implementation, policies, models, data,
|
|
12
|
+
infrastructure, trademarks, patents, or other proprietary technology of
|
|
13
|
+
Nainacore Emotional Tech.
|
|
14
|
+
|
|
15
|
+
Except where applicable law expressly permits otherwise, you may not:
|
|
16
|
+
- use the SDK to bypass authentication, authorization, usage limits, or service
|
|
17
|
+
protections;
|
|
18
|
+
- use the SDK or service interfaces to obtain, reconstruct, or disclose
|
|
19
|
+
non-public service-side implementation details; or
|
|
20
|
+
- represent this SDK or any modified version as an official Nainacore product.
|
|
21
|
+
|
|
22
|
+
THE SDK IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
|
|
23
|
+
INCLUDING BUT NOT LIMITED TO WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
|
|
24
|
+
PARTICULAR PURPOSE, AND NON-INFRINGEMENT. TO THE MAXIMUM EXTENT PERMITTED BY
|
|
25
|
+
LAW, NAINACORE EMOTIONAL TECH SHALL NOT BE LIABLE FOR ANY CLAIM, DAMAGES, OR
|
|
26
|
+
OTHER LIABILITY ARISING FROM USE OF THE SDK.
|
|
27
|
+
|
|
28
|
+
Use of NEES hosted services may also be subject to separate service terms.
|
|
@@ -0,0 +1,304 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: nees-sdk
|
|
3
|
+
Version: 3.0.0rc1
|
|
4
|
+
Summary: Python SDK for the NEES AI Governance Platform
|
|
5
|
+
Author: Nainacore Emotional Tech
|
|
6
|
+
License-Expression: LicenseRef-Nainacore-SDK-Proprietary
|
|
7
|
+
Project-URL: Homepage, https://nees.cloud
|
|
8
|
+
Keywords: ai,governance,agents,safety,runtime,nees
|
|
9
|
+
Classifier: Development Status :: 4 - Beta
|
|
10
|
+
Classifier: Intended Audience :: Developers
|
|
11
|
+
Classifier: Programming Language :: Python :: 3
|
|
12
|
+
Classifier: Programming Language :: Python :: 3 :: Only
|
|
13
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
14
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
15
|
+
Classifier: Topic :: Software Development :: Libraries :: Python Modules
|
|
16
|
+
Requires-Python: >=3.11
|
|
17
|
+
Description-Content-Type: text/markdown
|
|
18
|
+
License-File: LICENSE
|
|
19
|
+
Provides-Extra: dev
|
|
20
|
+
Requires-Dist: build>=1.0; extra == "dev"
|
|
21
|
+
Requires-Dist: pytest>=8; extra == "dev"
|
|
22
|
+
Requires-Dist: ruff>=0.6; extra == "dev"
|
|
23
|
+
Requires-Dist: mypy>=1.11; extra == "dev"
|
|
24
|
+
Dynamic: license-file
|
|
25
|
+
|
|
26
|
+
# NEES Python SDK
|
|
27
|
+
|
|
28
|
+
`nees-sdk` is the developer-facing Python SDK for the **NEES AI Governance Platform**.
|
|
29
|
+
|
|
30
|
+
NEES is designed to sit between AI intent and real-world execution. It evaluates governance facts
|
|
31
|
+
such as authority, policy, scope, approvals, limits, relationships, and execution state before an
|
|
32
|
+
action is allowed to proceed, and it records evidence and receipts after execution.
|
|
33
|
+
|
|
34
|
+
```text
|
|
35
|
+
AI application / agent / SaaS
|
|
36
|
+
|
|
|
37
|
+
v
|
|
38
|
+
nees-sdk
|
|
39
|
+
|
|
|
40
|
+
v
|
|
41
|
+
api.nees.cloud
|
|
42
|
+
|
|
|
43
|
+
v
|
|
44
|
+
NEES Governance Platform
|
|
45
|
+
|
|
|
46
|
+
v
|
|
47
|
+
NEES Core
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
The SDK does not perform your application's physical side effects. Your trusted host application or
|
|
51
|
+
effect adapter performs the action only after the NEES lifecycle has reached the appropriate
|
|
52
|
+
execution boundary.
|
|
53
|
+
|
|
54
|
+
## Release
|
|
55
|
+
|
|
56
|
+
Current release candidate: **3.0.0rc1**
|
|
57
|
+
|
|
58
|
+
Python: **3.11+**
|
|
59
|
+
|
|
60
|
+
## Install
|
|
61
|
+
|
|
62
|
+
```bash
|
|
63
|
+
pip install nees-sdk
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
The standard PyPI package is hosted-first and does **not** require the private NEES Core package.
|
|
67
|
+
|
|
68
|
+
## Hosted quick start
|
|
69
|
+
|
|
70
|
+
A hosted integration needs:
|
|
71
|
+
|
|
72
|
+
- a NEES Deployment base URL;
|
|
73
|
+
- a runtime API credential issued for the intended NEES environment.
|
|
74
|
+
|
|
75
|
+
Use environment variables for credentials:
|
|
76
|
+
|
|
77
|
+
```bash
|
|
78
|
+
NEES_BASE_URL=https://api.nees.cloud
|
|
79
|
+
NEES_API_KEY=your-runtime-api-key
|
|
80
|
+
NEES_HTTP_TIMEOUT_SECONDS=10
|
|
81
|
+
```
|
|
82
|
+
|
|
83
|
+
Then connect:
|
|
84
|
+
|
|
85
|
+
```python
|
|
86
|
+
from nees import NEESHTTPClient
|
|
87
|
+
|
|
88
|
+
client = NEESHTTPClient.from_env()
|
|
89
|
+
|
|
90
|
+
print(client.health())
|
|
91
|
+
print(client.list_actions())
|
|
92
|
+
```
|
|
93
|
+
|
|
94
|
+
Or construct the client explicitly:
|
|
95
|
+
|
|
96
|
+
```python
|
|
97
|
+
from nees import NEESHTTPClient
|
|
98
|
+
|
|
99
|
+
client = NEESHTTPClient.connect(
|
|
100
|
+
"https://api.nees.cloud",
|
|
101
|
+
"your-runtime-api-key",
|
|
102
|
+
)
|
|
103
|
+
```
|
|
104
|
+
|
|
105
|
+
Remote endpoints must use HTTPS. Plain HTTP is accepted only for localhost development.
|
|
106
|
+
|
|
107
|
+
## Where the runtime API key comes from
|
|
108
|
+
|
|
109
|
+
A NEES runtime credential belongs to a configured organization/project/runtime/environment. In a
|
|
110
|
+
hosted deployment, credentials are issued through the NEES Control Plane or customer onboarding
|
|
111
|
+
surface. The credential identifies the runtime environment server-side; callers do not submit
|
|
112
|
+
tenant or owner identity as governance authority.
|
|
113
|
+
|
|
114
|
+
Treat the credential as a secret. Do not commit it, place it in prompts or tool arguments, expose it
|
|
115
|
+
to browser-side code, or write it to logs.
|
|
116
|
+
|
|
117
|
+
## First governance check
|
|
118
|
+
|
|
119
|
+
This example registers a non-side-effect action and submits an informational governance assessment.
|
|
120
|
+
It is suitable as a first connectivity/governance proof because it does not perform a physical
|
|
121
|
+
external effect.
|
|
122
|
+
|
|
123
|
+
```python
|
|
124
|
+
from nees import (
|
|
125
|
+
ActionDefinition,
|
|
126
|
+
ActionRequest,
|
|
127
|
+
GovernanceAssessment,
|
|
128
|
+
IntentClass,
|
|
129
|
+
NEESHTTPClient,
|
|
130
|
+
)
|
|
131
|
+
|
|
132
|
+
client = NEESHTTPClient.from_env()
|
|
133
|
+
|
|
134
|
+
client.register_action(
|
|
135
|
+
ActionDefinition(
|
|
136
|
+
action_ref="quickstart.inspect",
|
|
137
|
+
name="Quickstart inspection",
|
|
138
|
+
kind="internal",
|
|
139
|
+
resource="quickstart",
|
|
140
|
+
operation="inspect",
|
|
141
|
+
side_effect=False,
|
|
142
|
+
)
|
|
143
|
+
)
|
|
144
|
+
|
|
145
|
+
decision = client.submit(
|
|
146
|
+
ActionRequest(
|
|
147
|
+
"quickstart.inspect",
|
|
148
|
+
"quickstart-001",
|
|
149
|
+
{"source": "sdk-quickstart"},
|
|
150
|
+
),
|
|
151
|
+
GovernanceAssessment(
|
|
152
|
+
action_ref="quickstart.inspect",
|
|
153
|
+
intent=IntentClass.INFORMATIONAL,
|
|
154
|
+
resource_ref="quickstart",
|
|
155
|
+
requested_operation="inspect",
|
|
156
|
+
resource_operation_requested=False,
|
|
157
|
+
scope_ref="quickstart:first-check",
|
|
158
|
+
actor="developer",
|
|
159
|
+
principal="developer",
|
|
160
|
+
requested_capability="inspect",
|
|
161
|
+
resource_type="quickstart",
|
|
162
|
+
),
|
|
163
|
+
)
|
|
164
|
+
|
|
165
|
+
print(decision.to_dict())
|
|
166
|
+
print([event.kind for event in client.evidence(decision.operation_id)])
|
|
167
|
+
print(client.receipt(decision.operation_id))
|
|
168
|
+
```
|
|
169
|
+
|
|
170
|
+
The repository also contains `examples/first_governance_check.py`.
|
|
171
|
+
|
|
172
|
+
## Governance lifecycle
|
|
173
|
+
|
|
174
|
+
For executable side-effecting actions, the important lifecycle is:
|
|
175
|
+
|
|
176
|
+
1. Register an action.
|
|
177
|
+
2. Establish trusted governance configuration through the appropriate administrative boundary.
|
|
178
|
+
3. Submit an `ActionRequest` and `GovernanceAssessment`.
|
|
179
|
+
4. Inspect the governance decision.
|
|
180
|
+
5. Qualify an allowed executable decision.
|
|
181
|
+
6. Redeem the issued start permit.
|
|
182
|
+
7. Perform the physical effect in the trusted host application.
|
|
183
|
+
8. Report the result as succeeded, failed, or uncertain.
|
|
184
|
+
9. Reconcile uncertain outcomes when the external result becomes known.
|
|
185
|
+
10. Inspect evidence and the final receipt.
|
|
186
|
+
|
|
187
|
+
**An allow decision is not the same as performing an external effect.** Decision, qualification,
|
|
188
|
+
permit redemption, effect execution, reporting, and reconciliation are separate boundaries.
|
|
189
|
+
|
|
190
|
+
Example runtime flow:
|
|
191
|
+
|
|
192
|
+
```python
|
|
193
|
+
decision = client.submit(request, assessment)
|
|
194
|
+
|
|
195
|
+
if decision.is_allowed:
|
|
196
|
+
qualification = client.qualify(decision.operation_id)
|
|
197
|
+
client.start(qualification)
|
|
198
|
+
|
|
199
|
+
# Your trusted application performs the real external effect here.
|
|
200
|
+
|
|
201
|
+
client.report(
|
|
202
|
+
decision.operation_id,
|
|
203
|
+
qualification.qualification_id,
|
|
204
|
+
"succeeded",
|
|
205
|
+
{"provider_reference": "example-123"},
|
|
206
|
+
)
|
|
207
|
+
|
|
208
|
+
events = client.evidence(decision.operation_id)
|
|
209
|
+
receipt = client.receipt(decision.operation_id)
|
|
210
|
+
```
|
|
211
|
+
|
|
212
|
+
## Governance requests
|
|
213
|
+
|
|
214
|
+
The hosted client also supports continuation workflows for governance requests:
|
|
215
|
+
|
|
216
|
+
```python
|
|
217
|
+
client.answer_clarification(request_id, {"answer": "..."})
|
|
218
|
+
|
|
219
|
+
client.decide_approval(
|
|
220
|
+
request_id,
|
|
221
|
+
approved=True,
|
|
222
|
+
approver_ref="trusted-approver",
|
|
223
|
+
expires_at=expires_at,
|
|
224
|
+
)
|
|
225
|
+
|
|
226
|
+
client.resume(request_id)
|
|
227
|
+
client.cancel_governance_request(request_id, "no longer required")
|
|
228
|
+
```
|
|
229
|
+
|
|
230
|
+
Approvals and authority must come from trusted application/control-plane flows. Model output or
|
|
231
|
+
caller-supplied text does not create governance authority by itself.
|
|
232
|
+
|
|
233
|
+
## Result types
|
|
234
|
+
|
|
235
|
+
The SDK returns small typed public result objects such as:
|
|
236
|
+
|
|
237
|
+
- `DecisionResult`
|
|
238
|
+
- `QualificationResult`
|
|
239
|
+
- `OperationResult`
|
|
240
|
+
- `EvidenceEvent`
|
|
241
|
+
- `ReceiptResult`
|
|
242
|
+
|
|
243
|
+
Normal governance outcomes are returned as results. Transport, authentication, invalid-request,
|
|
244
|
+
lifecycle, governance-denied, rate-limit, not-found, and backend failures use the SDK exception
|
|
245
|
+
hierarchy rooted at `NEESError`.
|
|
246
|
+
|
|
247
|
+
## CLI
|
|
248
|
+
|
|
249
|
+
The package installs the `nees` command:
|
|
250
|
+
|
|
251
|
+
```bash
|
|
252
|
+
nees health
|
|
253
|
+
nees actions
|
|
254
|
+
nees operation <operation-id>
|
|
255
|
+
nees evidence <operation-id>
|
|
256
|
+
nees receipt <operation-id>
|
|
257
|
+
```
|
|
258
|
+
|
|
259
|
+
The CLI reads `NEES_BASE_URL` and `NEES_API_KEY`, or accepts `--base-url` and `--api-key`.
|
|
260
|
+
|
|
261
|
+
## Integration options across the NEES Governance Platform
|
|
262
|
+
|
|
263
|
+
The Python SDK is one integration path. The broader NEES Governance Platform is designed to support
|
|
264
|
+
multiple integration styles, including:
|
|
265
|
+
|
|
266
|
+
- Python SDK;
|
|
267
|
+
- direct REST/HTTP integration;
|
|
268
|
+
- NEES Gateway;
|
|
269
|
+
- REST/OpenAPI connectors;
|
|
270
|
+
- MCP governance gateway;
|
|
271
|
+
- framework adapters for agent/application ecosystems.
|
|
272
|
+
|
|
273
|
+
Those surfaces all converge on the NEES governance lifecycle rather than implementing separate policy
|
|
274
|
+
engines.
|
|
275
|
+
|
|
276
|
+
## Embedded / customer-managed mode
|
|
277
|
+
|
|
278
|
+
The repository also contains `NEESClient` for trusted embedded or customer-managed deployments that
|
|
279
|
+
have separately licensed/provided access to NEES Core.
|
|
280
|
+
|
|
281
|
+
That mode can use SQLite or PostgreSQL directly and is intentionally **not** a dependency of the
|
|
282
|
+
standard public PyPI installation.
|
|
283
|
+
|
|
284
|
+
Hosted users should use `NEESHTTPClient`.
|
|
285
|
+
|
|
286
|
+
## Security
|
|
287
|
+
|
|
288
|
+
- Never commit runtime API keys or database credentials.
|
|
289
|
+
- Never expose runtime API keys in browser JavaScript, mobile bundles, prompts, or model/tool inputs.
|
|
290
|
+
- Use environment variables or a managed secret store.
|
|
291
|
+
- Remote NEES endpoints should use HTTPS.
|
|
292
|
+
- Revoke or rotate a credential immediately if exposure is suspected.
|
|
293
|
+
|
|
294
|
+
See `SECURITY.md` in the source distribution for the vulnerability-reporting policy.
|
|
295
|
+
|
|
296
|
+
## Product information
|
|
297
|
+
|
|
298
|
+
NEES is developed by **Nainacore Emotional Tech**.
|
|
299
|
+
|
|
300
|
+
Product website: https://nees.cloud
|
|
301
|
+
|
|
302
|
+
This SDK is distributed under the Nainacore SDK Proprietary License. NEES Core, service-side
|
|
303
|
+
governance implementation, infrastructure, policies, models, and other proprietary technology are
|
|
304
|
+
not included in this SDK distribution.
|
|
@@ -0,0 +1,279 @@
|
|
|
1
|
+
# NEES Python SDK
|
|
2
|
+
|
|
3
|
+
`nees-sdk` is the developer-facing Python SDK for the **NEES AI Governance Platform**.
|
|
4
|
+
|
|
5
|
+
NEES is designed to sit between AI intent and real-world execution. It evaluates governance facts
|
|
6
|
+
such as authority, policy, scope, approvals, limits, relationships, and execution state before an
|
|
7
|
+
action is allowed to proceed, and it records evidence and receipts after execution.
|
|
8
|
+
|
|
9
|
+
```text
|
|
10
|
+
AI application / agent / SaaS
|
|
11
|
+
|
|
|
12
|
+
v
|
|
13
|
+
nees-sdk
|
|
14
|
+
|
|
|
15
|
+
v
|
|
16
|
+
api.nees.cloud
|
|
17
|
+
|
|
|
18
|
+
v
|
|
19
|
+
NEES Governance Platform
|
|
20
|
+
|
|
|
21
|
+
v
|
|
22
|
+
NEES Core
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
The SDK does not perform your application's physical side effects. Your trusted host application or
|
|
26
|
+
effect adapter performs the action only after the NEES lifecycle has reached the appropriate
|
|
27
|
+
execution boundary.
|
|
28
|
+
|
|
29
|
+
## Release
|
|
30
|
+
|
|
31
|
+
Current release candidate: **3.0.0rc1**
|
|
32
|
+
|
|
33
|
+
Python: **3.11+**
|
|
34
|
+
|
|
35
|
+
## Install
|
|
36
|
+
|
|
37
|
+
```bash
|
|
38
|
+
pip install nees-sdk
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
The standard PyPI package is hosted-first and does **not** require the private NEES Core package.
|
|
42
|
+
|
|
43
|
+
## Hosted quick start
|
|
44
|
+
|
|
45
|
+
A hosted integration needs:
|
|
46
|
+
|
|
47
|
+
- a NEES Deployment base URL;
|
|
48
|
+
- a runtime API credential issued for the intended NEES environment.
|
|
49
|
+
|
|
50
|
+
Use environment variables for credentials:
|
|
51
|
+
|
|
52
|
+
```bash
|
|
53
|
+
NEES_BASE_URL=https://api.nees.cloud
|
|
54
|
+
NEES_API_KEY=your-runtime-api-key
|
|
55
|
+
NEES_HTTP_TIMEOUT_SECONDS=10
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
Then connect:
|
|
59
|
+
|
|
60
|
+
```python
|
|
61
|
+
from nees import NEESHTTPClient
|
|
62
|
+
|
|
63
|
+
client = NEESHTTPClient.from_env()
|
|
64
|
+
|
|
65
|
+
print(client.health())
|
|
66
|
+
print(client.list_actions())
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
Or construct the client explicitly:
|
|
70
|
+
|
|
71
|
+
```python
|
|
72
|
+
from nees import NEESHTTPClient
|
|
73
|
+
|
|
74
|
+
client = NEESHTTPClient.connect(
|
|
75
|
+
"https://api.nees.cloud",
|
|
76
|
+
"your-runtime-api-key",
|
|
77
|
+
)
|
|
78
|
+
```
|
|
79
|
+
|
|
80
|
+
Remote endpoints must use HTTPS. Plain HTTP is accepted only for localhost development.
|
|
81
|
+
|
|
82
|
+
## Where the runtime API key comes from
|
|
83
|
+
|
|
84
|
+
A NEES runtime credential belongs to a configured organization/project/runtime/environment. In a
|
|
85
|
+
hosted deployment, credentials are issued through the NEES Control Plane or customer onboarding
|
|
86
|
+
surface. The credential identifies the runtime environment server-side; callers do not submit
|
|
87
|
+
tenant or owner identity as governance authority.
|
|
88
|
+
|
|
89
|
+
Treat the credential as a secret. Do not commit it, place it in prompts or tool arguments, expose it
|
|
90
|
+
to browser-side code, or write it to logs.
|
|
91
|
+
|
|
92
|
+
## First governance check
|
|
93
|
+
|
|
94
|
+
This example registers a non-side-effect action and submits an informational governance assessment.
|
|
95
|
+
It is suitable as a first connectivity/governance proof because it does not perform a physical
|
|
96
|
+
external effect.
|
|
97
|
+
|
|
98
|
+
```python
|
|
99
|
+
from nees import (
|
|
100
|
+
ActionDefinition,
|
|
101
|
+
ActionRequest,
|
|
102
|
+
GovernanceAssessment,
|
|
103
|
+
IntentClass,
|
|
104
|
+
NEESHTTPClient,
|
|
105
|
+
)
|
|
106
|
+
|
|
107
|
+
client = NEESHTTPClient.from_env()
|
|
108
|
+
|
|
109
|
+
client.register_action(
|
|
110
|
+
ActionDefinition(
|
|
111
|
+
action_ref="quickstart.inspect",
|
|
112
|
+
name="Quickstart inspection",
|
|
113
|
+
kind="internal",
|
|
114
|
+
resource="quickstart",
|
|
115
|
+
operation="inspect",
|
|
116
|
+
side_effect=False,
|
|
117
|
+
)
|
|
118
|
+
)
|
|
119
|
+
|
|
120
|
+
decision = client.submit(
|
|
121
|
+
ActionRequest(
|
|
122
|
+
"quickstart.inspect",
|
|
123
|
+
"quickstart-001",
|
|
124
|
+
{"source": "sdk-quickstart"},
|
|
125
|
+
),
|
|
126
|
+
GovernanceAssessment(
|
|
127
|
+
action_ref="quickstart.inspect",
|
|
128
|
+
intent=IntentClass.INFORMATIONAL,
|
|
129
|
+
resource_ref="quickstart",
|
|
130
|
+
requested_operation="inspect",
|
|
131
|
+
resource_operation_requested=False,
|
|
132
|
+
scope_ref="quickstart:first-check",
|
|
133
|
+
actor="developer",
|
|
134
|
+
principal="developer",
|
|
135
|
+
requested_capability="inspect",
|
|
136
|
+
resource_type="quickstart",
|
|
137
|
+
),
|
|
138
|
+
)
|
|
139
|
+
|
|
140
|
+
print(decision.to_dict())
|
|
141
|
+
print([event.kind for event in client.evidence(decision.operation_id)])
|
|
142
|
+
print(client.receipt(decision.operation_id))
|
|
143
|
+
```
|
|
144
|
+
|
|
145
|
+
The repository also contains `examples/first_governance_check.py`.
|
|
146
|
+
|
|
147
|
+
## Governance lifecycle
|
|
148
|
+
|
|
149
|
+
For executable side-effecting actions, the important lifecycle is:
|
|
150
|
+
|
|
151
|
+
1. Register an action.
|
|
152
|
+
2. Establish trusted governance configuration through the appropriate administrative boundary.
|
|
153
|
+
3. Submit an `ActionRequest` and `GovernanceAssessment`.
|
|
154
|
+
4. Inspect the governance decision.
|
|
155
|
+
5. Qualify an allowed executable decision.
|
|
156
|
+
6. Redeem the issued start permit.
|
|
157
|
+
7. Perform the physical effect in the trusted host application.
|
|
158
|
+
8. Report the result as succeeded, failed, or uncertain.
|
|
159
|
+
9. Reconcile uncertain outcomes when the external result becomes known.
|
|
160
|
+
10. Inspect evidence and the final receipt.
|
|
161
|
+
|
|
162
|
+
**An allow decision is not the same as performing an external effect.** Decision, qualification,
|
|
163
|
+
permit redemption, effect execution, reporting, and reconciliation are separate boundaries.
|
|
164
|
+
|
|
165
|
+
Example runtime flow:
|
|
166
|
+
|
|
167
|
+
```python
|
|
168
|
+
decision = client.submit(request, assessment)
|
|
169
|
+
|
|
170
|
+
if decision.is_allowed:
|
|
171
|
+
qualification = client.qualify(decision.operation_id)
|
|
172
|
+
client.start(qualification)
|
|
173
|
+
|
|
174
|
+
# Your trusted application performs the real external effect here.
|
|
175
|
+
|
|
176
|
+
client.report(
|
|
177
|
+
decision.operation_id,
|
|
178
|
+
qualification.qualification_id,
|
|
179
|
+
"succeeded",
|
|
180
|
+
{"provider_reference": "example-123"},
|
|
181
|
+
)
|
|
182
|
+
|
|
183
|
+
events = client.evidence(decision.operation_id)
|
|
184
|
+
receipt = client.receipt(decision.operation_id)
|
|
185
|
+
```
|
|
186
|
+
|
|
187
|
+
## Governance requests
|
|
188
|
+
|
|
189
|
+
The hosted client also supports continuation workflows for governance requests:
|
|
190
|
+
|
|
191
|
+
```python
|
|
192
|
+
client.answer_clarification(request_id, {"answer": "..."})
|
|
193
|
+
|
|
194
|
+
client.decide_approval(
|
|
195
|
+
request_id,
|
|
196
|
+
approved=True,
|
|
197
|
+
approver_ref="trusted-approver",
|
|
198
|
+
expires_at=expires_at,
|
|
199
|
+
)
|
|
200
|
+
|
|
201
|
+
client.resume(request_id)
|
|
202
|
+
client.cancel_governance_request(request_id, "no longer required")
|
|
203
|
+
```
|
|
204
|
+
|
|
205
|
+
Approvals and authority must come from trusted application/control-plane flows. Model output or
|
|
206
|
+
caller-supplied text does not create governance authority by itself.
|
|
207
|
+
|
|
208
|
+
## Result types
|
|
209
|
+
|
|
210
|
+
The SDK returns small typed public result objects such as:
|
|
211
|
+
|
|
212
|
+
- `DecisionResult`
|
|
213
|
+
- `QualificationResult`
|
|
214
|
+
- `OperationResult`
|
|
215
|
+
- `EvidenceEvent`
|
|
216
|
+
- `ReceiptResult`
|
|
217
|
+
|
|
218
|
+
Normal governance outcomes are returned as results. Transport, authentication, invalid-request,
|
|
219
|
+
lifecycle, governance-denied, rate-limit, not-found, and backend failures use the SDK exception
|
|
220
|
+
hierarchy rooted at `NEESError`.
|
|
221
|
+
|
|
222
|
+
## CLI
|
|
223
|
+
|
|
224
|
+
The package installs the `nees` command:
|
|
225
|
+
|
|
226
|
+
```bash
|
|
227
|
+
nees health
|
|
228
|
+
nees actions
|
|
229
|
+
nees operation <operation-id>
|
|
230
|
+
nees evidence <operation-id>
|
|
231
|
+
nees receipt <operation-id>
|
|
232
|
+
```
|
|
233
|
+
|
|
234
|
+
The CLI reads `NEES_BASE_URL` and `NEES_API_KEY`, or accepts `--base-url` and `--api-key`.
|
|
235
|
+
|
|
236
|
+
## Integration options across the NEES Governance Platform
|
|
237
|
+
|
|
238
|
+
The Python SDK is one integration path. The broader NEES Governance Platform is designed to support
|
|
239
|
+
multiple integration styles, including:
|
|
240
|
+
|
|
241
|
+
- Python SDK;
|
|
242
|
+
- direct REST/HTTP integration;
|
|
243
|
+
- NEES Gateway;
|
|
244
|
+
- REST/OpenAPI connectors;
|
|
245
|
+
- MCP governance gateway;
|
|
246
|
+
- framework adapters for agent/application ecosystems.
|
|
247
|
+
|
|
248
|
+
Those surfaces all converge on the NEES governance lifecycle rather than implementing separate policy
|
|
249
|
+
engines.
|
|
250
|
+
|
|
251
|
+
## Embedded / customer-managed mode
|
|
252
|
+
|
|
253
|
+
The repository also contains `NEESClient` for trusted embedded or customer-managed deployments that
|
|
254
|
+
have separately licensed/provided access to NEES Core.
|
|
255
|
+
|
|
256
|
+
That mode can use SQLite or PostgreSQL directly and is intentionally **not** a dependency of the
|
|
257
|
+
standard public PyPI installation.
|
|
258
|
+
|
|
259
|
+
Hosted users should use `NEESHTTPClient`.
|
|
260
|
+
|
|
261
|
+
## Security
|
|
262
|
+
|
|
263
|
+
- Never commit runtime API keys or database credentials.
|
|
264
|
+
- Never expose runtime API keys in browser JavaScript, mobile bundles, prompts, or model/tool inputs.
|
|
265
|
+
- Use environment variables or a managed secret store.
|
|
266
|
+
- Remote NEES endpoints should use HTTPS.
|
|
267
|
+
- Revoke or rotate a credential immediately if exposure is suspected.
|
|
268
|
+
|
|
269
|
+
See `SECURITY.md` in the source distribution for the vulnerability-reporting policy.
|
|
270
|
+
|
|
271
|
+
## Product information
|
|
272
|
+
|
|
273
|
+
NEES is developed by **Nainacore Emotional Tech**.
|
|
274
|
+
|
|
275
|
+
Product website: https://nees.cloud
|
|
276
|
+
|
|
277
|
+
This SDK is distributed under the Nainacore SDK Proprietary License. NEES Core, service-side
|
|
278
|
+
governance implementation, infrastructure, policies, models, and other proprietary technology are
|
|
279
|
+
not included in this SDK distribution.
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
# Security Policy
|
|
2
|
+
|
|
3
|
+
## Reporting a vulnerability
|
|
4
|
+
|
|
5
|
+
Please report suspected security vulnerabilities privately to Nainacore Emotional Tech through the
|
|
6
|
+
security contact published on the official NEES website at https://nees.cloud.
|
|
7
|
+
|
|
8
|
+
Do not publish API keys, credentials, database connection strings, access tokens, customer data,
|
|
9
|
+
private deployment details, or exploit steps in public channels.
|
|
10
|
+
|
|
11
|
+
## Credential safety
|
|
12
|
+
|
|
13
|
+
NEES runtime API keys are secrets.
|
|
14
|
+
|
|
15
|
+
- Store them in environment variables or a managed secret store.
|
|
16
|
+
- Do not commit them to source control.
|
|
17
|
+
- Do not expose them in browser-side JavaScript, mobile bundles, logs, prompts, or model/tool arguments.
|
|
18
|
+
- Rotate or revoke a credential immediately if exposure is suspected.
|
|
19
|
+
|
|
20
|
+
## Supported release line
|
|
21
|
+
|
|
22
|
+
Security fixes are applied to the current supported NEES SDK release line. Pre-release versions such
|
|
23
|
+
as 3.0.0rc1 are release candidates and may change before the final 3.0.0 release.
|
|
24
|
+
|
|
25
|
+
## Scope
|
|
26
|
+
|
|
27
|
+
This repository contains the developer-facing Python SDK. NEES Core and service-side governance
|
|
28
|
+
implementation are separate proprietary components and are not part of this SDK distribution.
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
[build-system]
|
|
2
|
+
requires = ["setuptools>=77"]
|
|
3
|
+
build-backend = "setuptools.build_meta"
|
|
4
|
+
|
|
5
|
+
[project]
|
|
6
|
+
name = "nees-sdk"
|
|
7
|
+
version = "3.0.0rc1"
|
|
8
|
+
description = "Python SDK for the NEES AI Governance Platform"
|
|
9
|
+
readme = "README.md"
|
|
10
|
+
requires-python = ">=3.11"
|
|
11
|
+
authors = [{ name = "Nainacore Emotional Tech" }]
|
|
12
|
+
license = "LicenseRef-Nainacore-SDK-Proprietary"
|
|
13
|
+
license-files = ["LICENSE"]
|
|
14
|
+
keywords = ["ai", "governance", "agents", "safety", "runtime", "nees"]
|
|
15
|
+
classifiers = [
|
|
16
|
+
"Development Status :: 4 - Beta",
|
|
17
|
+
"Intended Audience :: Developers",
|
|
18
|
+
"Programming Language :: Python :: 3",
|
|
19
|
+
"Programming Language :: Python :: 3 :: Only",
|
|
20
|
+
"Programming Language :: Python :: 3.11",
|
|
21
|
+
"Programming Language :: Python :: 3.12",
|
|
22
|
+
"Topic :: Software Development :: Libraries :: Python Modules",
|
|
23
|
+
]
|
|
24
|
+
dependencies = []
|
|
25
|
+
|
|
26
|
+
[project.optional-dependencies]
|
|
27
|
+
dev = ["build>=1.0", "pytest>=8", "ruff>=0.6", "mypy>=1.11"]
|
|
28
|
+
|
|
29
|
+
[project.scripts]
|
|
30
|
+
nees = "nees.cli:main"
|
|
31
|
+
|
|
32
|
+
[project.urls]
|
|
33
|
+
Homepage = "https://nees.cloud"
|
|
34
|
+
|
|
35
|
+
[tool.setuptools.packages.find]
|
|
36
|
+
where = ["src"]
|
|
37
|
+
|
|
38
|
+
[tool.pytest.ini_options]
|
|
39
|
+
testpaths = ["tests"]
|
|
40
|
+
addopts = "-ra"
|
|
41
|
+
|
|
42
|
+
[tool.ruff]
|
|
43
|
+
line-length = 120
|
|
44
|
+
target-version = "py311"
|
|
45
|
+
|
|
46
|
+
[tool.mypy]
|
|
47
|
+
python_version = "3.11"
|
|
48
|
+
strict = true
|
|
49
|
+
|
|
50
|
+
[tool.setuptools.package-data]
|
|
51
|
+
nees = ["py.typed"]
|