openbox-sdk-python 0.2.0__py3-none-any.whl
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.
- openbox_core/__init__.py +59 -0
- openbox_core/adapters/__init__.py +3 -0
- openbox_core/adapters/base.py +123 -0
- openbox_core/approvals.py +106 -0
- openbox_core/client.py +298 -0
- openbox_core/config.py +260 -0
- openbox_core/conformance/__init__.py +3 -0
- openbox_core/conformance/fake_core.py +169 -0
- openbox_core/conformance/hook_preflight.py +87 -0
- openbox_core/conformance/instrumentation.py +91 -0
- openbox_core/context.py +205 -0
- openbox_core/contracts/__init__.py +3 -0
- openbox_core/contracts/context.py +79 -0
- openbox_core/contracts/events.py +401 -0
- openbox_core/contracts/otel_spans.py +325 -0
- openbox_core/contracts/results.py +287 -0
- openbox_core/errors.py +287 -0
- openbox_core/gate.py +185 -0
- openbox_core/hooks/__init__.py +3 -0
- openbox_core/hooks/events.py +64 -0
- openbox_core/hooks/preflight.py +292 -0
- openbox_core/hooks/wrappers.py +105 -0
- openbox_core/identity.py +231 -0
- openbox_core/instrumentation/__init__.py +3 -0
- openbox_core/instrumentation/db.py +689 -0
- openbox_core/instrumentation/file.py +239 -0
- openbox_core/instrumentation/function.py +121 -0
- openbox_core/instrumentation/http.py +840 -0
- openbox_core/instrumentation/llm.py +3 -0
- openbox_core/instrumentation/manager.py +135 -0
- openbox_core/instrumentation/shared.py +27 -0
- openbox_core/otel/__init__.py +3 -0
- openbox_core/otel/propagation.py +45 -0
- openbox_core/otel/provider.py +35 -0
- openbox_core/otel/setup.py +36 -0
- openbox_core/otel/span_processor.py +62 -0
- openbox_core/otel/trace_context.py +71 -0
- openbox_core/py.typed +0 -0
- openbox_core/runtime.py +138 -0
- openbox_core/sdk_version.py +79 -0
- openbox_core/serialization.py +129 -0
- openbox_core/validation/__init__.py +3 -0
- openbox_core/validation/diagnostics.py +60 -0
- openbox_core/validation/event_rules.py +164 -0
- openbox_core/validation/registry.py +31 -0
- openbox_core/validation/span_normalization.py +107 -0
- openbox_core/wire/__init__.py +3 -0
- openbox_core/wire/core_span.py +130 -0
- openbox_core/wire/evaluate_payload.py +56 -0
- openbox_sdk_python-0.2.0.dist-info/METADATA +94 -0
- openbox_sdk_python-0.2.0.dist-info/RECORD +52 -0
- openbox_sdk_python-0.2.0.dist-info/WHEEL +4 -0
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: openbox-sdk-python
|
|
3
|
+
Version: 0.2.0
|
|
4
|
+
Summary: OpenBox base SDK - governance contracts, strict gate, identity/signing, evaluate client, context runtime, OTel span wire serialization, and generic instrumentation shared by every OpenBox framework SDK
|
|
5
|
+
Author-email: OpenBox Team <tino@openbox.ai>
|
|
6
|
+
License-Expression: MIT
|
|
7
|
+
Keywords: governance,observability,openbox,opentelemetry,sdk
|
|
8
|
+
Classifier: Development Status :: 3 - Alpha
|
|
9
|
+
Classifier: Intended Audience :: Developers
|
|
10
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
11
|
+
Classifier: Programming Language :: Python :: 3
|
|
12
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
13
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
14
|
+
Classifier: Topic :: Software Development :: Libraries :: Python Modules
|
|
15
|
+
Classifier: Topic :: System :: Monitoring
|
|
16
|
+
Classifier: Typing :: Typed
|
|
17
|
+
Requires-Python: >=3.11
|
|
18
|
+
Requires-Dist: cryptography<47,>=43
|
|
19
|
+
Requires-Dist: httpx<1,>=0.28.0
|
|
20
|
+
Requires-Dist: opentelemetry-api<1.40.0,>=1.38.0
|
|
21
|
+
Requires-Dist: opentelemetry-sdk<1.40.0,>=1.38.0
|
|
22
|
+
Provides-Extra: db
|
|
23
|
+
Requires-Dist: asyncpg>=0.29.0; extra == 'db'
|
|
24
|
+
Requires-Dist: opentelemetry-instrumentation-asyncpg<0.61b0,>=0.59b0; extra == 'db'
|
|
25
|
+
Requires-Dist: opentelemetry-instrumentation-dbapi<0.61b0,>=0.59b0; extra == 'db'
|
|
26
|
+
Requires-Dist: opentelemetry-instrumentation-redis<0.61b0,>=0.59b0; extra == 'db'
|
|
27
|
+
Requires-Dist: opentelemetry-instrumentation-sqlalchemy<0.61b0,>=0.59b0; extra == 'db'
|
|
28
|
+
Requires-Dist: pymongo>=4.6.0; extra == 'db'
|
|
29
|
+
Requires-Dist: redis>=5.0.0; extra == 'db'
|
|
30
|
+
Requires-Dist: sqlalchemy>=2.0.0; extra == 'db'
|
|
31
|
+
Requires-Dist: wrapt>=1.16.0; extra == 'db'
|
|
32
|
+
Provides-Extra: http
|
|
33
|
+
Requires-Dist: opentelemetry-instrumentation-httpx<0.61b0,>=0.59b0; extra == 'http'
|
|
34
|
+
Requires-Dist: opentelemetry-instrumentation-requests<0.61b0,>=0.59b0; extra == 'http'
|
|
35
|
+
Requires-Dist: opentelemetry-instrumentation-urllib3<0.61b0,>=0.59b0; extra == 'http'
|
|
36
|
+
Requires-Dist: opentelemetry-instrumentation-urllib<0.61b0,>=0.59b0; extra == 'http'
|
|
37
|
+
Requires-Dist: requests>=2.31.0; extra == 'http'
|
|
38
|
+
Description-Content-Type: text/markdown
|
|
39
|
+
|
|
40
|
+
# openbox-sdk-python
|
|
41
|
+
|
|
42
|
+
OpenBox base SDK (`import openbox_core`) — the standalone core every OpenBox
|
|
43
|
+
framework SDK builds on. It owns:
|
|
44
|
+
|
|
45
|
+
- **Contracts** — event and result dataclasses (`EventEnvelope`,
|
|
46
|
+
`EvaluationResult`, `ApprovalResult`, `Verdict`).
|
|
47
|
+
- **Always-strict governance gate** — malformed event/runtime contracts raise
|
|
48
|
+
`ContractError` before send; there are no configurable gate modes.
|
|
49
|
+
- **Identity & signing** — AIP DID validation + Ed25519 request signing,
|
|
50
|
+
byte-compatible with the Temporal SDK signing contract.
|
|
51
|
+
- **Evaluate client** — sync + async calls to OpenBox Core
|
|
52
|
+
(`/api/v1/governance/evaluate`, `/approval`, `/auth/validate`).
|
|
53
|
+
- **Context & runtime** — `ActivityContext`, `ContextStore`, trace
|
|
54
|
+
correlation, `FrameworkAdapter` protocol, `OpenBoxRuntime`.
|
|
55
|
+
- **OTel span wire serialization** — OTel spans are the internal source of
|
|
56
|
+
truth, projected to the current Core `SpanData` wire shape before send.
|
|
57
|
+
- **Generic instrumentation** — HTTP/DB/file/function wrappers with a
|
|
58
|
+
started/completed hook runtime enforcing preflight before real operations.
|
|
59
|
+
- **Conformance kit** — reusable fixtures framework SDKs run to prove parity.
|
|
60
|
+
|
|
61
|
+
Framework SDKs (Temporal, LangGraph, LangChain, DeepAgent, CrewAI) are thin
|
|
62
|
+
adapters: they bind framework lifecycle into `ActivityContext`, emit lifecycle
|
|
63
|
+
events, and translate `EvaluationResult` into native behavior.
|
|
64
|
+
|
|
65
|
+
## Framework SDK integration
|
|
66
|
+
|
|
67
|
+
New framework SDK developers and agents should start with
|
|
68
|
+
[the OpenBox Python Framework SDK Integration guide](.github/instructions/openbox-sdk-python.instructions.md).
|
|
69
|
+
It describes how to build a framework SDK on top of this base package without
|
|
70
|
+
reimplementing config, signing, governance gates, hook wire payloads, or
|
|
71
|
+
conformance fixtures.
|
|
72
|
+
|
|
73
|
+
## Install
|
|
74
|
+
|
|
75
|
+
```bash
|
|
76
|
+
uv sync # core
|
|
77
|
+
uv sync --extra http # + HTTP instrumentation targets
|
|
78
|
+
uv sync --extra db # + DB instrumentation targets
|
|
79
|
+
```
|
|
80
|
+
|
|
81
|
+
## Import safety
|
|
82
|
+
|
|
83
|
+
`openbox_core.__init__` and all `openbox_core.contracts.*` modules import
|
|
84
|
+
without pulling in `httpx`, `cryptography`, `requests`, or OTel
|
|
85
|
+
instrumentation — safe for constrained framework paths such as the Temporal
|
|
86
|
+
workflow sandbox. `tests/test_import_safety.py` enforces this in CI.
|
|
87
|
+
|
|
88
|
+
## Development
|
|
89
|
+
|
|
90
|
+
```bash
|
|
91
|
+
uv sync --all-extras
|
|
92
|
+
uv run pytest
|
|
93
|
+
uv run ruff check .
|
|
94
|
+
```
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
openbox_core/__init__.py,sha256=xdbYBImDu2mUeTVo_9U4TvaeSoUpFcTE7kwwtPn0a4Q,1983
|
|
2
|
+
openbox_core/approvals.py,sha256=eobLN4rSBvaFaTbsPExu2XcGS5fSuWvo0GC1DR18w0I,4400
|
|
3
|
+
openbox_core/client.py,sha256=Mo3HSFj7VmDYLiTJ0FnJdxNdetjU-NHK8IrBU7AL4vU,12615
|
|
4
|
+
openbox_core/config.py,sha256=-YasfXrRmA2u_iywtFF0AysAp88hzHWu19je5cy4mo8,9684
|
|
5
|
+
openbox_core/context.py,sha256=sNYnFYzZkHGDcrVmDSpRSx_uU818OPRNZBgUegWBcBk,7648
|
|
6
|
+
openbox_core/errors.py,sha256=6nLNYNpHqoXSpsYl4Cf3kwG6-huYN_p5RRvdbjFok64,12114
|
|
7
|
+
openbox_core/gate.py,sha256=xRzwM7VI1oWGNxiQqsZnUcuBg3S0GJEXqs0nliVaIsM,8649
|
|
8
|
+
openbox_core/identity.py,sha256=avyiosTeuB4MnMGJx8ZNfK48am2tnipQ1f2pFI_VHtI,8400
|
|
9
|
+
openbox_core/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
10
|
+
openbox_core/runtime.py,sha256=5pm_lxk1DGY8HDmfEnfvuCXJvzLai5CD71Yp8LtAz8U,5912
|
|
11
|
+
openbox_core/sdk_version.py,sha256=vlBs5mJVcSJmpbijVissRGuUDlwmTK2w94TgCPHIOcQ,2207
|
|
12
|
+
openbox_core/serialization.py,sha256=DT1bXF33REkjSn72svUYwC-98xeD1yw8h88gheDqIt8,4642
|
|
13
|
+
openbox_core/adapters/__init__.py,sha256=RBN5_-V4qa55kKPzO3ownU8f70dPPQzyzeHway7JkGc,67
|
|
14
|
+
openbox_core/adapters/base.py,sha256=U021sq08BvRzHTgbSijErFi89R5GZUgEBnyYzSQjiqc,4653
|
|
15
|
+
openbox_core/conformance/__init__.py,sha256=muxUxcflVR-sZbX7R_uEFiREC0PQmI4ozO7gH2JQIc0,91
|
|
16
|
+
openbox_core/conformance/fake_core.py,sha256=d4WlM867zVWNzxbFYI-M7hlyVQa67QC-IEg2LVqLM2o,6181
|
|
17
|
+
openbox_core/conformance/hook_preflight.py,sha256=jRKNcM-yUUtCL6uYgf-XcFQUbI8Vcl8za62eY-vyEOk,3172
|
|
18
|
+
openbox_core/conformance/instrumentation.py,sha256=MMx6H2Q7AofF6V-bWAR1ZXBXg5Jmczg4qW0Ehl-C3FM,3010
|
|
19
|
+
openbox_core/contracts/__init__.py,sha256=7uBSUIxfUG6uZDsotQmT1jjXs3G75M2hFHtYEln_FGU,122
|
|
20
|
+
openbox_core/contracts/context.py,sha256=V-eVbB-NIrXI1NKduengG0GVx7q1wKawyhwZh-D0C9Y,2873
|
|
21
|
+
openbox_core/contracts/events.py,sha256=Loy5IW4UyPiffBVYK06IxiID6NKsNQjoTLguBb-j4Uw,13428
|
|
22
|
+
openbox_core/contracts/otel_spans.py,sha256=PnElhgdOM_qlYVF9thPxvhNxloXOb3fpgSXDQN3evWg,10753
|
|
23
|
+
openbox_core/contracts/results.py,sha256=3nxMxbK02jzgf5wh6TS5UVIS5J_jU7-HGxl9Loie9gs,10723
|
|
24
|
+
openbox_core/hooks/__init__.py,sha256=jAZGEbN-sZbBD7o_tV-9ZDhBki88yHXKVQf4qhhkYTc,63
|
|
25
|
+
openbox_core/hooks/events.py,sha256=PQSzH_8vLyUopjCDu6dxCtVh7OvNbiWnLx87fCY5jnU,2129
|
|
26
|
+
openbox_core/hooks/preflight.py,sha256=W0pJKLo0OSQ9knyeM4ZZPdZeTcU4Fb8PLbeCB8hR71o,12723
|
|
27
|
+
openbox_core/hooks/wrappers.py,sha256=KVyWhQ36FOP81L8lTo0TNNYSKo0bHmkcF47oMcLiTSg,3282
|
|
28
|
+
openbox_core/instrumentation/__init__.py,sha256=1vGDrIwVdysd0xiaGMle_6R29UIWkyshJbK8G92NNPY,94
|
|
29
|
+
openbox_core/instrumentation/db.py,sha256=GRGQFFemz75mHW9HRpqS8NfSCkCG9cofKcGKu0m506g,25058
|
|
30
|
+
openbox_core/instrumentation/file.py,sha256=4fWl830VbGNnz4-G46yfpsq9hAhU0Vh9OpPdAy8v0L8,8648
|
|
31
|
+
openbox_core/instrumentation/function.py,sha256=VBp_ubqdtzEutihUzUxEEYrqPSEfYaOZOkNLBU04B4E,3915
|
|
32
|
+
openbox_core/instrumentation/http.py,sha256=9V2RoI1OB-AAWyD7Uw-pwzIV7TFiP2W5lR3EHETHlQo,28782
|
|
33
|
+
openbox_core/instrumentation/llm.py,sha256=tDl1Vir4hl92MD94hurCt8v1_vhLkG_TB-uskW5YHpg,73
|
|
34
|
+
openbox_core/instrumentation/manager.py,sha256=k2tTeBasQViDE8icGpFjQtuOAE4_mCz_A00vWFJvFqk,5643
|
|
35
|
+
openbox_core/instrumentation/shared.py,sha256=cJ95L5p45zAuH75fCtoGC3C1-8oacQHayi8qsQhokWw,751
|
|
36
|
+
openbox_core/otel/__init__.py,sha256=jt23K51OPKBmnDYe-VFSpYorkiu1QD-SUDZ2RuWul9s,114
|
|
37
|
+
openbox_core/otel/propagation.py,sha256=oiy7CjH6NpsmVlffbhv7dc-ztgUtYHiNK2c4hhq0xIw,1660
|
|
38
|
+
openbox_core/otel/provider.py,sha256=u2HAw3uUptsgiq_GMuJ9xz5m3tFzXvAiLu_pAC6tBFs,1145
|
|
39
|
+
openbox_core/otel/setup.py,sha256=2WWmT0PjO8--4ZHIn_ZqhIo-qxFbKw7bLdpTWp8xCks,1289
|
|
40
|
+
openbox_core/otel/span_processor.py,sha256=0cGanVux9OxgQwSWcl_bWZh1Vmx5mEpiCP4R8BK4m2k,2321
|
|
41
|
+
openbox_core/otel/trace_context.py,sha256=blyLx6fekp6-JRHOooAfxEADXokqFrgtnVCMFFihQO0,2330
|
|
42
|
+
openbox_core/validation/__init__.py,sha256=4SidWNPFY_GAkOccprotz6CfcvdNCh8WpxUpn_NDDxg,77
|
|
43
|
+
openbox_core/validation/diagnostics.py,sha256=z5NqhtFgsym0uSS9GPd4kXpKd510e6Mb_mLFdRe9sVI,1677
|
|
44
|
+
openbox_core/validation/event_rules.py,sha256=2ayE0aerCK1fRDwRodOHIo0BsPsJj7Egb9-lrSXBEhA,6536
|
|
45
|
+
openbox_core/validation/registry.py,sha256=U2XvNCtcMgQlhPge38aZeMRTtv1QHQHDS4dM5QAPW_I,1145
|
|
46
|
+
openbox_core/validation/span_normalization.py,sha256=mB8GghMwOo3WGdKNrm6g8krP7KmG5_TRIFI3cDdO2PQ,3611
|
|
47
|
+
openbox_core/wire/__init__.py,sha256=bI-snmNkEvLKqyYl1fItOCwAo46ehKD9vykOFfqaZz0,105
|
|
48
|
+
openbox_core/wire/core_span.py,sha256=U_d93VSa8992DQ_dqP2dgzp4Vu7eEROishH_oQZFuvM,5059
|
|
49
|
+
openbox_core/wire/evaluate_payload.py,sha256=RQ9TaeMLQ08YSmN1FYlvVFfOy0FLp0ve6LBLDi2ZKeI,2027
|
|
50
|
+
openbox_sdk_python-0.2.0.dist-info/METADATA,sha256=-JBntef7yQMyfVw4ghn8FBT4poS5UIJP9aUmB_ToYBI,4381
|
|
51
|
+
openbox_sdk_python-0.2.0.dist-info/WHEEL,sha256=mffPy8wBnZQn2VnJUU5jE99KsxaSfiyMHV9Yt0aLVxs,87
|
|
52
|
+
openbox_sdk_python-0.2.0.dist-info/RECORD,,
|