hiitl 0.1.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.
- hiitl-0.1.0/PKG-INFO +153 -0
- hiitl-0.1.0/README.md +119 -0
- hiitl-0.1.0/hiitl/__init__.py +57 -0
- hiitl-0.1.0/hiitl/core/__init__.py +17 -0
- hiitl-0.1.0/hiitl/core/evaluator.py +408 -0
- hiitl-0.1.0/hiitl/core/route_types.py +626 -0
- hiitl-0.1.0/hiitl/core/tests/__init__.py +1 -0
- hiitl-0.1.0/hiitl/core/tests/conformance/__init__.py +1 -0
- hiitl-0.1.0/hiitl/core/tests/conformance/test_conformance.py +277 -0
- hiitl-0.1.0/hiitl/core/tests/test_error_handling.py +532 -0
- hiitl-0.1.0/hiitl/core/tests/test_evaluator.py +1151 -0
- hiitl-0.1.0/hiitl/core/tests/test_route_types.py +502 -0
- hiitl-0.1.0/hiitl/core/types.py +408 -0
- hiitl-0.1.0/hiitl/sdk/__init__.py +69 -0
- hiitl-0.1.0/hiitl/sdk/audit.py +476 -0
- hiitl-0.1.0/hiitl/sdk/circuit_breaker.py +149 -0
- hiitl-0.1.0/hiitl/sdk/client.py +890 -0
- hiitl-0.1.0/hiitl/sdk/config.py +244 -0
- hiitl-0.1.0/hiitl/sdk/exceptions.py +140 -0
- hiitl-0.1.0/hiitl/sdk/http_client.py +255 -0
- hiitl-0.1.0/hiitl/sdk/policy_loader.py +215 -0
- hiitl-0.1.0/hiitl/sdk/rate_limiter.py +275 -0
- hiitl-0.1.0/hiitl/sdk/route_loader.py +290 -0
- hiitl-0.1.0/hiitl/sdk/sync_cache.py +466 -0
- hiitl-0.1.0/hiitl/sdk/sync_client.py +415 -0
- hiitl-0.1.0/hiitl/sdk/sync_engine.py +443 -0
- hiitl-0.1.0/hiitl/sdk/telemetry.py +477 -0
- hiitl-0.1.0/hiitl/sdk/tests/__init__.py +1 -0
- hiitl-0.1.0/hiitl/sdk/tests/test_audit.py +441 -0
- hiitl-0.1.0/hiitl/sdk/tests/test_client.py +475 -0
- hiitl-0.1.0/hiitl/sdk/tests/test_config.py +185 -0
- hiitl-0.1.0/hiitl/sdk/tests/test_exceptions.py +110 -0
- hiitl-0.1.0/hiitl/sdk/tests/test_hosted.py +808 -0
- hiitl-0.1.0/hiitl/sdk/tests/test_policy_loader.py +321 -0
- hiitl-0.1.0/hiitl/sdk/tests/test_rate_limiter.py +489 -0
- hiitl-0.1.0/hiitl/sdk/tests/test_route_loader.py +695 -0
- hiitl-0.1.0/hiitl/sdk/tests/test_sync.py +1230 -0
- hiitl-0.1.0/hiitl/sdk/tests/test_telemetry.py +650 -0
- hiitl-0.1.0/hiitl/server/main.py +42 -0
- hiitl-0.1.0/hiitl/synthetic/__init__.py +28 -0
- hiitl-0.1.0/hiitl/synthetic/__main__.py +7 -0
- hiitl-0.1.0/hiitl/synthetic/agent_loader.py +115 -0
- hiitl-0.1.0/hiitl/synthetic/assertions.py +204 -0
- hiitl-0.1.0/hiitl/synthetic/cli.py +362 -0
- hiitl-0.1.0/hiitl/synthetic/envelope_factory.py +168 -0
- hiitl-0.1.0/hiitl/synthetic/executor.py +329 -0
- hiitl-0.1.0/hiitl/synthetic/grader.py +166 -0
- hiitl-0.1.0/hiitl/synthetic/report.py +150 -0
- hiitl-0.1.0/hiitl/synthetic/scenario_loader.py +93 -0
- hiitl-0.1.0/hiitl/synthetic/tests/__init__.py +0 -0
- hiitl-0.1.0/hiitl/synthetic/tests/test_assertions.py +173 -0
- hiitl-0.1.0/hiitl/synthetic/tests/test_cli.py +116 -0
- hiitl-0.1.0/hiitl/synthetic/tests/test_envelope_factory.py +140 -0
- hiitl-0.1.0/hiitl/synthetic/tests/test_executor.py +318 -0
- hiitl-0.1.0/hiitl/synthetic/tests/test_grader.py +220 -0
- hiitl-0.1.0/hiitl/synthetic/types.py +235 -0
- hiitl-0.1.0/hiitl.egg-info/PKG-INFO +153 -0
- hiitl-0.1.0/hiitl.egg-info/SOURCES.txt +61 -0
- hiitl-0.1.0/hiitl.egg-info/dependency_links.txt +1 -0
- hiitl-0.1.0/hiitl.egg-info/requires.txt +10 -0
- hiitl-0.1.0/hiitl.egg-info/top_level.txt +1 -0
- hiitl-0.1.0/pyproject.toml +51 -0
- hiitl-0.1.0/setup.cfg +4 -0
hiitl-0.1.0/PKG-INFO
ADDED
|
@@ -0,0 +1,153 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: hiitl
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: The control point for software that can act. Observe, enforce, and audit every action.
|
|
5
|
+
Author: HIITL, Inc.
|
|
6
|
+
License-Expression: MIT
|
|
7
|
+
Project-URL: Homepage, https://hiitl.com
|
|
8
|
+
Project-URL: Documentation, https://docs.hiitl.com
|
|
9
|
+
Project-URL: Repository, https://github.com/hiitlhq/hiitl
|
|
10
|
+
Project-URL: Issues, https://github.com/hiitlhq/hiitl/issues
|
|
11
|
+
Project-URL: Changelog, https://github.com/hiitlhq/hiitl/releases
|
|
12
|
+
Keywords: ai,agents,policy,control,execution,safety,audit
|
|
13
|
+
Classifier: Development Status :: 3 - Alpha
|
|
14
|
+
Classifier: Intended Audience :: Developers
|
|
15
|
+
Classifier: Programming Language :: Python :: 3
|
|
16
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
17
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
18
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
19
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
20
|
+
Classifier: Topic :: Software Development :: Libraries :: Python Modules
|
|
21
|
+
Classifier: Topic :: Security
|
|
22
|
+
Classifier: Typing :: Typed
|
|
23
|
+
Requires-Python: >=3.10
|
|
24
|
+
Description-Content-Type: text/markdown
|
|
25
|
+
Requires-Dist: pydantic>=2.0.0
|
|
26
|
+
Requires-Dist: pydantic-settings>=2.0.0
|
|
27
|
+
Requires-Dist: PyYAML>=6.0.0
|
|
28
|
+
Requires-Dist: httpx>=0.25.0
|
|
29
|
+
Provides-Extra: dev
|
|
30
|
+
Requires-Dist: pytest>=7.0.0; extra == "dev"
|
|
31
|
+
Requires-Dist: pytest-cov>=4.0.0; extra == "dev"
|
|
32
|
+
Requires-Dist: ruff>=0.1.0; extra == "dev"
|
|
33
|
+
Requires-Dist: mypy>=1.0.0; extra == "dev"
|
|
34
|
+
|
|
35
|
+
# hiitl — Python SDK
|
|
36
|
+
|
|
37
|
+
The control point for AI agents. Python SDK with embedded policy evaluator.
|
|
38
|
+
|
|
39
|
+
## Install
|
|
40
|
+
|
|
41
|
+
```bash
|
|
42
|
+
pip install hiitl
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
## Quick start
|
|
46
|
+
|
|
47
|
+
```python
|
|
48
|
+
from hiitl import HIITL
|
|
49
|
+
|
|
50
|
+
# Zero config — observe everything, block nothing
|
|
51
|
+
hiitl = HIITL()
|
|
52
|
+
|
|
53
|
+
decision = hiitl.evaluate("send_email", parameters={
|
|
54
|
+
"to": "user@example.com",
|
|
55
|
+
"subject": "Order update",
|
|
56
|
+
})
|
|
57
|
+
|
|
58
|
+
if decision.allowed:
|
|
59
|
+
send_email(...)
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
## With policy enforcement
|
|
63
|
+
|
|
64
|
+
```python
|
|
65
|
+
hiitl = HIITL(
|
|
66
|
+
agent_id="payment-agent",
|
|
67
|
+
policy_path="./policy.yaml",
|
|
68
|
+
mode="RESPECT_POLICY",
|
|
69
|
+
)
|
|
70
|
+
|
|
71
|
+
decision = hiitl.evaluate("process_payment", parameters={
|
|
72
|
+
"amount": 5000.00,
|
|
73
|
+
"currency": "USD",
|
|
74
|
+
})
|
|
75
|
+
|
|
76
|
+
if decision.allowed:
|
|
77
|
+
process_payment(...)
|
|
78
|
+
elif decision.needs_approval:
|
|
79
|
+
queue_for_review(decision)
|
|
80
|
+
elif decision.blocked:
|
|
81
|
+
log_blocked(decision)
|
|
82
|
+
```
|
|
83
|
+
|
|
84
|
+
## Hosted mode
|
|
85
|
+
|
|
86
|
+
```python
|
|
87
|
+
hiitl = HIITL(
|
|
88
|
+
agent_id="payment-agent",
|
|
89
|
+
org_id="org_yourcompany1234567",
|
|
90
|
+
api_key="sk_live_...",
|
|
91
|
+
server_url="https://ecp.hiitl.com",
|
|
92
|
+
environment="prod",
|
|
93
|
+
mode="RESPECT_POLICY",
|
|
94
|
+
)
|
|
95
|
+
|
|
96
|
+
# Same evaluate() call, same Decision object
|
|
97
|
+
decision = hiitl.evaluate("process_payment", parameters={"amount": 500})
|
|
98
|
+
```
|
|
99
|
+
|
|
100
|
+
## API
|
|
101
|
+
|
|
102
|
+
### `HIITL(**kwargs)`
|
|
103
|
+
|
|
104
|
+
All parameters are keyword-only with defaults. `HIITL()` works with no arguments.
|
|
105
|
+
|
|
106
|
+
| Parameter | Default | Description |
|
|
107
|
+
|-----------|---------|-------------|
|
|
108
|
+
| `agent_id` | `"default"` | Agent identifier |
|
|
109
|
+
| `environment` | `"dev"` | `dev`, `stage`, or `prod` |
|
|
110
|
+
| `mode` | `"OBSERVE_ALL"` | `OBSERVE_ALL` or `RESPECT_POLICY` |
|
|
111
|
+
| `policy_path` | `None` | Path to policy file (YAML or JSON) |
|
|
112
|
+
| `audit_db_path` | `"./hiitl_audit.db"` | SQLite audit log path |
|
|
113
|
+
| `api_key` | `None` | API key for hosted mode |
|
|
114
|
+
| `server_url` | `None` | Server URL for hosted mode |
|
|
115
|
+
|
|
116
|
+
### `hiitl.evaluate(action, **kwargs) -> Decision`
|
|
117
|
+
|
|
118
|
+
| Parameter | Required | Description |
|
|
119
|
+
|-----------|----------|-------------|
|
|
120
|
+
| `action` | Yes | Action name (e.g., `"send_email"`) |
|
|
121
|
+
| `parameters` | No | Action parameters dict |
|
|
122
|
+
| `target` | No | Target resource dict |
|
|
123
|
+
| `operation` | No | Operation type (default: `"execute"`) |
|
|
124
|
+
| `user_id` | No | User identifier |
|
|
125
|
+
| `sensitivity` | No | Sensitivity labels |
|
|
126
|
+
|
|
127
|
+
### `Decision`
|
|
128
|
+
|
|
129
|
+
| Property | Type | Description |
|
|
130
|
+
|----------|------|-------------|
|
|
131
|
+
| `.allowed` | `bool` | Can the action proceed? |
|
|
132
|
+
| `.decision` | `str` | Decision type (`ALLOW`, `BLOCK`, etc.) |
|
|
133
|
+
| `.reason_codes` | `list[str]` | Why this decision was made |
|
|
134
|
+
| `.policy_version` | `str` | Policy version used |
|
|
135
|
+
| `.ok` | `bool` | Alias for `.allowed` |
|
|
136
|
+
| `.blocked` | `bool` | True if `BLOCK` |
|
|
137
|
+
| `.needs_approval` | `bool` | True if `REQUIRE_APPROVAL` |
|
|
138
|
+
| `.observed` | `bool` | True if `OBSERVE` mode |
|
|
139
|
+
| `.would_be` | `str` | What enforce mode would do (OBSERVE only) |
|
|
140
|
+
|
|
141
|
+
## Requirements
|
|
142
|
+
|
|
143
|
+
- Python 3.12+
|
|
144
|
+
|
|
145
|
+
## Documentation
|
|
146
|
+
|
|
147
|
+
- [Python Quickstart](../docs/onboarding/quickstart_python.md)
|
|
148
|
+
- [Full Documentation](../docs/)
|
|
149
|
+
- [Examples](../examples/)
|
|
150
|
+
|
|
151
|
+
## License
|
|
152
|
+
|
|
153
|
+
[MIT](../LICENSE)
|
hiitl-0.1.0/README.md
ADDED
|
@@ -0,0 +1,119 @@
|
|
|
1
|
+
# hiitl — Python SDK
|
|
2
|
+
|
|
3
|
+
The control point for AI agents. Python SDK with embedded policy evaluator.
|
|
4
|
+
|
|
5
|
+
## Install
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
pip install hiitl
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
## Quick start
|
|
12
|
+
|
|
13
|
+
```python
|
|
14
|
+
from hiitl import HIITL
|
|
15
|
+
|
|
16
|
+
# Zero config — observe everything, block nothing
|
|
17
|
+
hiitl = HIITL()
|
|
18
|
+
|
|
19
|
+
decision = hiitl.evaluate("send_email", parameters={
|
|
20
|
+
"to": "user@example.com",
|
|
21
|
+
"subject": "Order update",
|
|
22
|
+
})
|
|
23
|
+
|
|
24
|
+
if decision.allowed:
|
|
25
|
+
send_email(...)
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
## With policy enforcement
|
|
29
|
+
|
|
30
|
+
```python
|
|
31
|
+
hiitl = HIITL(
|
|
32
|
+
agent_id="payment-agent",
|
|
33
|
+
policy_path="./policy.yaml",
|
|
34
|
+
mode="RESPECT_POLICY",
|
|
35
|
+
)
|
|
36
|
+
|
|
37
|
+
decision = hiitl.evaluate("process_payment", parameters={
|
|
38
|
+
"amount": 5000.00,
|
|
39
|
+
"currency": "USD",
|
|
40
|
+
})
|
|
41
|
+
|
|
42
|
+
if decision.allowed:
|
|
43
|
+
process_payment(...)
|
|
44
|
+
elif decision.needs_approval:
|
|
45
|
+
queue_for_review(decision)
|
|
46
|
+
elif decision.blocked:
|
|
47
|
+
log_blocked(decision)
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
## Hosted mode
|
|
51
|
+
|
|
52
|
+
```python
|
|
53
|
+
hiitl = HIITL(
|
|
54
|
+
agent_id="payment-agent",
|
|
55
|
+
org_id="org_yourcompany1234567",
|
|
56
|
+
api_key="sk_live_...",
|
|
57
|
+
server_url="https://ecp.hiitl.com",
|
|
58
|
+
environment="prod",
|
|
59
|
+
mode="RESPECT_POLICY",
|
|
60
|
+
)
|
|
61
|
+
|
|
62
|
+
# Same evaluate() call, same Decision object
|
|
63
|
+
decision = hiitl.evaluate("process_payment", parameters={"amount": 500})
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
## API
|
|
67
|
+
|
|
68
|
+
### `HIITL(**kwargs)`
|
|
69
|
+
|
|
70
|
+
All parameters are keyword-only with defaults. `HIITL()` works with no arguments.
|
|
71
|
+
|
|
72
|
+
| Parameter | Default | Description |
|
|
73
|
+
|-----------|---------|-------------|
|
|
74
|
+
| `agent_id` | `"default"` | Agent identifier |
|
|
75
|
+
| `environment` | `"dev"` | `dev`, `stage`, or `prod` |
|
|
76
|
+
| `mode` | `"OBSERVE_ALL"` | `OBSERVE_ALL` or `RESPECT_POLICY` |
|
|
77
|
+
| `policy_path` | `None` | Path to policy file (YAML or JSON) |
|
|
78
|
+
| `audit_db_path` | `"./hiitl_audit.db"` | SQLite audit log path |
|
|
79
|
+
| `api_key` | `None` | API key for hosted mode |
|
|
80
|
+
| `server_url` | `None` | Server URL for hosted mode |
|
|
81
|
+
|
|
82
|
+
### `hiitl.evaluate(action, **kwargs) -> Decision`
|
|
83
|
+
|
|
84
|
+
| Parameter | Required | Description |
|
|
85
|
+
|-----------|----------|-------------|
|
|
86
|
+
| `action` | Yes | Action name (e.g., `"send_email"`) |
|
|
87
|
+
| `parameters` | No | Action parameters dict |
|
|
88
|
+
| `target` | No | Target resource dict |
|
|
89
|
+
| `operation` | No | Operation type (default: `"execute"`) |
|
|
90
|
+
| `user_id` | No | User identifier |
|
|
91
|
+
| `sensitivity` | No | Sensitivity labels |
|
|
92
|
+
|
|
93
|
+
### `Decision`
|
|
94
|
+
|
|
95
|
+
| Property | Type | Description |
|
|
96
|
+
|----------|------|-------------|
|
|
97
|
+
| `.allowed` | `bool` | Can the action proceed? |
|
|
98
|
+
| `.decision` | `str` | Decision type (`ALLOW`, `BLOCK`, etc.) |
|
|
99
|
+
| `.reason_codes` | `list[str]` | Why this decision was made |
|
|
100
|
+
| `.policy_version` | `str` | Policy version used |
|
|
101
|
+
| `.ok` | `bool` | Alias for `.allowed` |
|
|
102
|
+
| `.blocked` | `bool` | True if `BLOCK` |
|
|
103
|
+
| `.needs_approval` | `bool` | True if `REQUIRE_APPROVAL` |
|
|
104
|
+
| `.observed` | `bool` | True if `OBSERVE` mode |
|
|
105
|
+
| `.would_be` | `str` | What enforce mode would do (OBSERVE only) |
|
|
106
|
+
|
|
107
|
+
## Requirements
|
|
108
|
+
|
|
109
|
+
- Python 3.12+
|
|
110
|
+
|
|
111
|
+
## Documentation
|
|
112
|
+
|
|
113
|
+
- [Python Quickstart](../docs/onboarding/quickstart_python.md)
|
|
114
|
+
- [Full Documentation](../docs/)
|
|
115
|
+
- [Examples](../examples/)
|
|
116
|
+
|
|
117
|
+
## License
|
|
118
|
+
|
|
119
|
+
[MIT](../LICENSE)
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
"""HIITL - Human Intelligence in the Loop.
|
|
2
|
+
|
|
3
|
+
Deterministic control point for software that can act.
|
|
4
|
+
|
|
5
|
+
This package provides policy-based access control for AI agents and
|
|
6
|
+
autonomous systems. It enables developers to define and enforce policies
|
|
7
|
+
that govern what actions agents can take.
|
|
8
|
+
|
|
9
|
+
Zero-config (observe everything):
|
|
10
|
+
>>> from hiitl import HIITL
|
|
11
|
+
>>> hiitl = HIITL()
|
|
12
|
+
>>> decision = hiitl.evaluate("send_email")
|
|
13
|
+
>>> if decision.allowed:
|
|
14
|
+
... send_email()
|
|
15
|
+
|
|
16
|
+
With policy enforcement:
|
|
17
|
+
>>> hiitl = HIITL(
|
|
18
|
+
... agent_id="payment-agent",
|
|
19
|
+
... policy_path="./policy.yaml",
|
|
20
|
+
... mode="RESPECT_POLICY",
|
|
21
|
+
... )
|
|
22
|
+
>>> decision = hiitl.evaluate(
|
|
23
|
+
... "process_payment",
|
|
24
|
+
... parameters={"amount": 500, "currency": "USD"},
|
|
25
|
+
... )
|
|
26
|
+
>>> if decision.allowed:
|
|
27
|
+
... process_payment()
|
|
28
|
+
"""
|
|
29
|
+
|
|
30
|
+
__version__ = "0.1.0"
|
|
31
|
+
|
|
32
|
+
# Import main SDK class
|
|
33
|
+
from hiitl.sdk.client import HIITL
|
|
34
|
+
|
|
35
|
+
# Import common exceptions
|
|
36
|
+
from hiitl.sdk.exceptions import (
|
|
37
|
+
AuditLogError,
|
|
38
|
+
ConfigurationError,
|
|
39
|
+
EnvelopeValidationError,
|
|
40
|
+
HIITLError,
|
|
41
|
+
NetworkError,
|
|
42
|
+
PolicyLoadError,
|
|
43
|
+
ServerError,
|
|
44
|
+
)
|
|
45
|
+
|
|
46
|
+
# Export public API
|
|
47
|
+
__all__ = [
|
|
48
|
+
"HIITL",
|
|
49
|
+
"HIITLError",
|
|
50
|
+
"PolicyLoadError",
|
|
51
|
+
"AuditLogError",
|
|
52
|
+
"ConfigurationError",
|
|
53
|
+
"EnvelopeValidationError",
|
|
54
|
+
"ServerError",
|
|
55
|
+
"NetworkError",
|
|
56
|
+
"__version__",
|
|
57
|
+
]
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"""HIITL Core - Policy evaluator and core types."""
|
|
2
|
+
|
|
3
|
+
from .evaluator import PolicyEvaluator, evaluate
|
|
4
|
+
from .types import Envelope, PolicySet, Rule, Decision, Remediation, RemediationType
|
|
5
|
+
from .route_types import Route
|
|
6
|
+
|
|
7
|
+
__all__ = [
|
|
8
|
+
"PolicyEvaluator",
|
|
9
|
+
"evaluate",
|
|
10
|
+
"Envelope",
|
|
11
|
+
"PolicySet",
|
|
12
|
+
"Rule",
|
|
13
|
+
"Decision",
|
|
14
|
+
"Remediation",
|
|
15
|
+
"RemediationType",
|
|
16
|
+
"Route",
|
|
17
|
+
]
|