raxit 0.0.1__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.
Files changed (48) hide show
  1. raxit-0.0.1/.gitignore +5 -0
  2. raxit-0.0.1/LICENSE +215 -0
  3. raxit-0.0.1/PKG-INFO +161 -0
  4. raxit-0.0.1/README.md +143 -0
  5. raxit-0.0.1/pyproject.toml +45 -0
  6. raxit-0.0.1/src/raxit/__init__.py +57 -0
  7. raxit-0.0.1/src/raxit/_engine_pin.py +9 -0
  8. raxit-0.0.1/src/raxit/_http.py +86 -0
  9. raxit-0.0.1/src/raxit/_launcher.py +213 -0
  10. raxit-0.0.1/src/raxit/_sitecustomize/sitecustomize.py +71 -0
  11. raxit-0.0.1/src/raxit/agent.py +209 -0
  12. raxit-0.0.1/src/raxit/approvals.py +124 -0
  13. raxit-0.0.1/src/raxit/audit.py +114 -0
  14. raxit-0.0.1/src/raxit/autopatch.py +1568 -0
  15. raxit-0.0.1/src/raxit/budget.py +63 -0
  16. raxit-0.0.1/src/raxit/client.py +271 -0
  17. raxit-0.0.1/src/raxit/fleet.py +117 -0
  18. raxit-0.0.1/src/raxit/govern.py +203 -0
  19. raxit-0.0.1/src/raxit/identity.py +81 -0
  20. raxit-0.0.1/src/raxit/langchain.py +68 -0
  21. raxit-0.0.1/src/raxit/lifecycle.py +75 -0
  22. raxit-0.0.1/src/raxit/output.py +87 -0
  23. raxit-0.0.1/src/raxit/phase.py +55 -0
  24. raxit-0.0.1/src/raxit/types.py +320 -0
  25. raxit-0.0.1/src/raxit/warrants.py +56 -0
  26. raxit-0.0.1/tests/conftest.py +155 -0
  27. raxit-0.0.1/tests/test_agent.py +344 -0
  28. raxit-0.0.1/tests/test_approvals.py +228 -0
  29. raxit-0.0.1/tests/test_audit.py +327 -0
  30. raxit-0.0.1/tests/test_autopatch.py +338 -0
  31. raxit-0.0.1/tests/test_autopatch_adversarial.py +144 -0
  32. raxit-0.0.1/tests/test_autopatch_canary.py +329 -0
  33. raxit-0.0.1/tests/test_autopatch_drift.py +178 -0
  34. raxit-0.0.1/tests/test_budget.py +170 -0
  35. raxit-0.0.1/tests/test_contract.py +158 -0
  36. raxit-0.0.1/tests/test_fleet.py +223 -0
  37. raxit-0.0.1/tests/test_govern.py +79 -0
  38. raxit-0.0.1/tests/test_governance_enablement.py +60 -0
  39. raxit-0.0.1/tests/test_handshake.py +55 -0
  40. raxit-0.0.1/tests/test_langchain.py +79 -0
  41. raxit-0.0.1/tests/test_launcher.py +248 -0
  42. raxit-0.0.1/tests/test_lifecycle.py +184 -0
  43. raxit-0.0.1/tests/test_output.py +61 -0
  44. raxit-0.0.1/tests/test_patchers.py +801 -0
  45. raxit-0.0.1/tests/test_phase.py +144 -0
  46. raxit-0.0.1/tests/test_sitecustomize.py +92 -0
  47. raxit-0.0.1/tests/test_warrants.py +143 -0
  48. raxit-0.0.1/uv.lock +156 -0
raxit-0.0.1/.gitignore ADDED
@@ -0,0 +1,5 @@
1
+ .venv/
2
+ __pycache__/
3
+ *.egg-info/
4
+ dist/
5
+ .pytest_cache/
raxit-0.0.1/LICENSE ADDED
@@ -0,0 +1,215 @@
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
177
+
178
+ APPENDIX: How to apply the Apache License to your work.
179
+
180
+ To apply the Apache License to your work, attach the following
181
+ boilerplate notice, with the fields enclosed by brackets "[]"
182
+ replaced with your own identifying information. (Don't include
183
+ the brackets!) The text should be enclosed in the appropriate
184
+ comment syntax for the file format. We also recommend that a
185
+ file or class name and description of purpose be included on the
186
+ same "printed page" as the copyright notice for easier
187
+ identification within third-party archives.
188
+
189
+ Copyright [yyyy] [name of copyright owner]
190
+
191
+ Licensed under the Apache License, Version 2.0 (the "License");
192
+ you may not use this file except in compliance with the License.
193
+ You may obtain a copy of the License at
194
+
195
+ http://www.apache.org/licenses/LICENSE-2.0
196
+
197
+ Unless required by applicable law or agreed to in writing, software
198
+ distributed under the License is distributed on an "AS IS" BASIS,
199
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
200
+ See the License for the specific language governing permissions and
201
+ limitations under the License.
202
+
203
+ Copyright 2026 raxIT Labs
204
+
205
+ Licensed under the Apache License, Version 2.0 (the "License");
206
+ you may not use this file except in compliance with the License.
207
+ You may obtain a copy of the License at
208
+
209
+ http://www.apache.org/licenses/LICENSE-2.0
210
+
211
+ Unless required by applicable law or agreed to in writing, software
212
+ distributed under the License is distributed on an "AS IS" BASIS,
213
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
214
+ See the License for the specific language governing permissions and
215
+ limitations under the License.
raxit-0.0.1/PKG-INFO ADDED
@@ -0,0 +1,161 @@
1
+ Metadata-Version: 2.4
2
+ Name: raxit
3
+ Version: 0.0.1
4
+ Summary: Zero-dependency Python client for the raxIT runtime governance engine (permit / defer / deny on every tool call)
5
+ Project-URL: Homepage, https://rax.it
6
+ Project-URL: Repository, https://github.com/raxitlabs/runtime-security-core
7
+ Author: raxIT Labs
8
+ License-Expression: Apache-2.0
9
+ License-File: LICENSE
10
+ Classifier: Intended Audience :: Developers
11
+ Classifier: Operating System :: MacOS
12
+ Classifier: Operating System :: POSIX :: Linux
13
+ Classifier: Programming Language :: Python :: 3
14
+ Classifier: Programming Language :: Python :: 3.10
15
+ Classifier: Topic :: Security
16
+ Requires-Python: >=3.10
17
+ Description-Content-Type: text/markdown
18
+
19
+ # raxit — thin Python client for the raxIT governance daemon
20
+
21
+ Govern every agent tool call with permit / defer / deny, before it executes.
22
+
23
+ ```sh
24
+ uv add raxit # zero runtime dependencies (stdlib only)
25
+ ```
26
+
27
+ > **Not yet published:** `raxit` isn't on PyPI yet (publish is a founder-owned
28
+ > manual step). Until then, install from the monorepo — see
29
+ > [`docs/quickstart.md`](../../docs/quickstart.md#monorepo--operator-path-contributing-or-pre-publish).
30
+
31
+ **Platforms:** the launcher resolves/downloads engine binaries for
32
+ `darwin`/`linux` only. On Windows, run raxit from **WSL** — there is no
33
+ native Windows engine build.
34
+
35
+ ## Zero-code governance (`raxit run`)
36
+
37
+ The fastest path is no SDK calls at all. `raxit run` boots the daemon on
38
+ `localhost:8181`, sets the child environment, and preloads the auto-patcher
39
+ (via `sitecustomize`) so every tool call is governed. `raxit init` scans your
40
+ repo and generates the `.raxit/` policy workspace first — `raxit run`
41
+ fail-closes without it:
42
+
43
+ ```sh
44
+ raxit init # scan -> generate .raxit/
45
+ raxit run --agent-id my-agent -- python agent.py
46
+ ```
47
+
48
+ Under the hood this sets `RAXIT_AUTOLOAD=1` and puts the raxit
49
+ `sitecustomize` dir on `PYTHONPATH`, so the auto-patcher fires at Python
50
+ startup and patches the tool-dispatch choke point of each detected
51
+ framework:
52
+
53
+ | Framework | How it's governed |
54
+ | --- | --- |
55
+ | LangChain | Auto-patched (importable) |
56
+ | LangGraph | Auto-patched |
57
+ | CrewAI | Auto-patched |
58
+ | AutoGen | Auto-patched |
59
+ | OpenAI Agents SDK | Auto-patched |
60
+ | Pydantic AI | Auto-patched |
61
+ | Google ADK | Auto-patched |
62
+ | LlamaIndex | Auto-patched |
63
+ | Strands Agents | Auto-patched |
64
+ | smolagents | Auto-patched |
65
+ | Haystack | Auto-patched |
66
+
67
+ A blocked call raises `RaxitDenied`; a `MODIFY` verdict runs the tool on the
68
+ engine's transformed arguments; a `permit` runs it unchanged. `raxit.agent`
69
+ also exposes `governed` / `governed_tool` as a manual, per-tool escape hatch
70
+ when auto-patch doesn't fit.
71
+
72
+ ## Programmatic client
73
+
74
+ ```python
75
+ from raxit import RaxitClient
76
+
77
+ client = RaxitClient("http://localhost:8181", agent_id="my-agent")
78
+ d = client.govern(resource="db.read", args={"query": "select 1"})
79
+ if d.deferred:
80
+ d = client.govern.approve_wait(d) # blocks until a human approves
81
+ if d.denied:
82
+ raise RuntimeError(f"{d.reason_code}: {d.hint}")
83
+ result = run_tool() # only runs on permit
84
+ client.output.record(result, car=d.car) # feeds output governance + taint
85
+ ```
86
+
87
+ LangChain (no langchain import required by this package):
88
+
89
+ ```python
90
+ from raxit.langchain import RaxitCallbackHandler
91
+ handler = RaxitCallbackHandler(client) # raises RaxitDenied on deny
92
+ agent.run("...", callbacks=[handler])
93
+ ```
94
+
95
+ Fail-closed by default: if the daemon is unreachable, `govern()` returns
96
+ `deny` (`deny.daemon_unreachable`). Pass `fail_open=True` for dev only.
97
+
98
+ ### `RAXIT_GOVERNANCE`
99
+
100
+ Governed by default. `RAXIT_GOVERNANCE=off` is the kill-switch for
101
+ contrast/before-after demos — the client then bypasses the daemon entirely
102
+ and every call synthesizes `permit`. Only two values are accepted (after
103
+ `strip().lower()`): `on` and `off`; unset defaults to `on`. Any other value —
104
+ `1`/`true`/`yes`/`0`/`false`/`no`, or a typo — raises `ValueError` at client
105
+ construction, before any network call, rather than silently guessing.
106
+
107
+
108
+
109
+ ## Audit — verify the tamper-evident decision log
110
+
111
+ `client.audit.verify()` checks the hash-chained Decision Provenance log; pass
112
+ `signatures=True` with one or more pinned Ed25519 public keys to also verify
113
+ record signatures offline against a trusted key (not the daemon's own
114
+ config):
115
+
116
+ ```python
117
+ client = RaxitClient("http://localhost:8181", operator_token="<operator token>")
118
+ report = client.audit.verify(
119
+ signatures=True,
120
+ require_signed=True,
121
+ pubkeys=["<base64 raw-32-byte Ed25519 pubkey>"],
122
+ )
123
+ assert report["signatures_verified"] and report["signed_count"] > 0
124
+ ```
125
+
126
+ Operator-gated (`Authorization: Bearer <operator_token>`). For fully offline,
127
+ adversarial-grade verification use the CLI:
128
+ `raxit audit verify --signatures --pubkey <key>`.
129
+
130
+ ## Budget — read the session/principal budget projection
131
+
132
+ `client.budget.get()` is a strictly read-only projection of the engine's budget
133
+ accountant — never a reservation. It reports `used`/`remaining` against each
134
+ configured cap (call budget, per-session and per-day token/cost caps):
135
+
136
+ ```python
137
+ client = RaxitClient("http://localhost:8181", operator_token="<operator token>")
138
+ snap = client.budget.get(agent_id="payments-bot", session_id="sess-1")
139
+ for b in snap.budgets:
140
+ print(b.name, b.used, "/", b.limit, b.unit, f"({b.window})")
141
+ ```
142
+
143
+ Operator-gated (`Authorization: Bearer <operator_token>`). Fails closed: an
144
+ unreachable daemon **raises** `GovernanceError` — it is never read as an empty
145
+ or infinite budget. An empty `snap.budgets` means genuinely no cap configured.
146
+
147
+ ## Warrants — inspect the loaded standing grants
148
+
149
+ `client.warrants.list()` / `client.warrants.get(id)` are a read-only view of the
150
+ warrants loaded at `raxit serve` startup. There is no create/revoke — minting
151
+ stays the operator-controlled load path.
152
+
153
+ ```python
154
+ client = RaxitClient("http://localhost:8181", operator_token="<operator token>")
155
+ for w in client.warrants.list():
156
+ print(w.id, w.agent_id, w.tool_pattern, w.status, "expires", w.expires_at)
157
+ ```
158
+
159
+ Operator-gated. Fails closed (**raises** `GovernanceError` when unreachable, so
160
+ "none" is never confused with "unreachable"). Warrants carry no credentials and
161
+ the attested intent-baseline text is never projected.
raxit-0.0.1/README.md ADDED
@@ -0,0 +1,143 @@
1
+ # raxit — thin Python client for the raxIT governance daemon
2
+
3
+ Govern every agent tool call with permit / defer / deny, before it executes.
4
+
5
+ ```sh
6
+ uv add raxit # zero runtime dependencies (stdlib only)
7
+ ```
8
+
9
+ > **Not yet published:** `raxit` isn't on PyPI yet (publish is a founder-owned
10
+ > manual step). Until then, install from the monorepo — see
11
+ > [`docs/quickstart.md`](../../docs/quickstart.md#monorepo--operator-path-contributing-or-pre-publish).
12
+
13
+ **Platforms:** the launcher resolves/downloads engine binaries for
14
+ `darwin`/`linux` only. On Windows, run raxit from **WSL** — there is no
15
+ native Windows engine build.
16
+
17
+ ## Zero-code governance (`raxit run`)
18
+
19
+ The fastest path is no SDK calls at all. `raxit run` boots the daemon on
20
+ `localhost:8181`, sets the child environment, and preloads the auto-patcher
21
+ (via `sitecustomize`) so every tool call is governed. `raxit init` scans your
22
+ repo and generates the `.raxit/` policy workspace first — `raxit run`
23
+ fail-closes without it:
24
+
25
+ ```sh
26
+ raxit init # scan -> generate .raxit/
27
+ raxit run --agent-id my-agent -- python agent.py
28
+ ```
29
+
30
+ Under the hood this sets `RAXIT_AUTOLOAD=1` and puts the raxit
31
+ `sitecustomize` dir on `PYTHONPATH`, so the auto-patcher fires at Python
32
+ startup and patches the tool-dispatch choke point of each detected
33
+ framework:
34
+
35
+ | Framework | How it's governed |
36
+ | --- | --- |
37
+ | LangChain | Auto-patched (importable) |
38
+ | LangGraph | Auto-patched |
39
+ | CrewAI | Auto-patched |
40
+ | AutoGen | Auto-patched |
41
+ | OpenAI Agents SDK | Auto-patched |
42
+ | Pydantic AI | Auto-patched |
43
+ | Google ADK | Auto-patched |
44
+ | LlamaIndex | Auto-patched |
45
+ | Strands Agents | Auto-patched |
46
+ | smolagents | Auto-patched |
47
+ | Haystack | Auto-patched |
48
+
49
+ A blocked call raises `RaxitDenied`; a `MODIFY` verdict runs the tool on the
50
+ engine's transformed arguments; a `permit` runs it unchanged. `raxit.agent`
51
+ also exposes `governed` / `governed_tool` as a manual, per-tool escape hatch
52
+ when auto-patch doesn't fit.
53
+
54
+ ## Programmatic client
55
+
56
+ ```python
57
+ from raxit import RaxitClient
58
+
59
+ client = RaxitClient("http://localhost:8181", agent_id="my-agent")
60
+ d = client.govern(resource="db.read", args={"query": "select 1"})
61
+ if d.deferred:
62
+ d = client.govern.approve_wait(d) # blocks until a human approves
63
+ if d.denied:
64
+ raise RuntimeError(f"{d.reason_code}: {d.hint}")
65
+ result = run_tool() # only runs on permit
66
+ client.output.record(result, car=d.car) # feeds output governance + taint
67
+ ```
68
+
69
+ LangChain (no langchain import required by this package):
70
+
71
+ ```python
72
+ from raxit.langchain import RaxitCallbackHandler
73
+ handler = RaxitCallbackHandler(client) # raises RaxitDenied on deny
74
+ agent.run("...", callbacks=[handler])
75
+ ```
76
+
77
+ Fail-closed by default: if the daemon is unreachable, `govern()` returns
78
+ `deny` (`deny.daemon_unreachable`). Pass `fail_open=True` for dev only.
79
+
80
+ ### `RAXIT_GOVERNANCE`
81
+
82
+ Governed by default. `RAXIT_GOVERNANCE=off` is the kill-switch for
83
+ contrast/before-after demos — the client then bypasses the daemon entirely
84
+ and every call synthesizes `permit`. Only two values are accepted (after
85
+ `strip().lower()`): `on` and `off`; unset defaults to `on`. Any other value —
86
+ `1`/`true`/`yes`/`0`/`false`/`no`, or a typo — raises `ValueError` at client
87
+ construction, before any network call, rather than silently guessing.
88
+
89
+
90
+
91
+ ## Audit — verify the tamper-evident decision log
92
+
93
+ `client.audit.verify()` checks the hash-chained Decision Provenance log; pass
94
+ `signatures=True` with one or more pinned Ed25519 public keys to also verify
95
+ record signatures offline against a trusted key (not the daemon's own
96
+ config):
97
+
98
+ ```python
99
+ client = RaxitClient("http://localhost:8181", operator_token="<operator token>")
100
+ report = client.audit.verify(
101
+ signatures=True,
102
+ require_signed=True,
103
+ pubkeys=["<base64 raw-32-byte Ed25519 pubkey>"],
104
+ )
105
+ assert report["signatures_verified"] and report["signed_count"] > 0
106
+ ```
107
+
108
+ Operator-gated (`Authorization: Bearer <operator_token>`). For fully offline,
109
+ adversarial-grade verification use the CLI:
110
+ `raxit audit verify --signatures --pubkey <key>`.
111
+
112
+ ## Budget — read the session/principal budget projection
113
+
114
+ `client.budget.get()` is a strictly read-only projection of the engine's budget
115
+ accountant — never a reservation. It reports `used`/`remaining` against each
116
+ configured cap (call budget, per-session and per-day token/cost caps):
117
+
118
+ ```python
119
+ client = RaxitClient("http://localhost:8181", operator_token="<operator token>")
120
+ snap = client.budget.get(agent_id="payments-bot", session_id="sess-1")
121
+ for b in snap.budgets:
122
+ print(b.name, b.used, "/", b.limit, b.unit, f"({b.window})")
123
+ ```
124
+
125
+ Operator-gated (`Authorization: Bearer <operator_token>`). Fails closed: an
126
+ unreachable daemon **raises** `GovernanceError` — it is never read as an empty
127
+ or infinite budget. An empty `snap.budgets` means genuinely no cap configured.
128
+
129
+ ## Warrants — inspect the loaded standing grants
130
+
131
+ `client.warrants.list()` / `client.warrants.get(id)` are a read-only view of the
132
+ warrants loaded at `raxit serve` startup. There is no create/revoke — minting
133
+ stays the operator-controlled load path.
134
+
135
+ ```python
136
+ client = RaxitClient("http://localhost:8181", operator_token="<operator token>")
137
+ for w in client.warrants.list():
138
+ print(w.id, w.agent_id, w.tool_pattern, w.status, "expires", w.expires_at)
139
+ ```
140
+
141
+ Operator-gated. Fails closed (**raises** `GovernanceError` when unreachable, so
142
+ "none" is never confused with "unreachable"). Warrants carry no credentials and
143
+ the attested intent-baseline text is never projected.
@@ -0,0 +1,45 @@
1
+ [project]
2
+ name = "raxit"
3
+ version = "0.0.1"
4
+ description = "Zero-dependency Python client for the raxIT runtime governance engine (permit / defer / deny on every tool call)"
5
+ readme = "README.md"
6
+ requires-python = ">=3.10"
7
+ license = "Apache-2.0"
8
+ authors = [{ name = "raxIT Labs" }]
9
+ classifiers = [
10
+ "Programming Language :: Python :: 3",
11
+ "Programming Language :: Python :: 3.10",
12
+ "Intended Audience :: Developers",
13
+ "Topic :: Security",
14
+ "Operating System :: POSIX :: Linux",
15
+ "Operating System :: MacOS",
16
+ ]
17
+ # Zero runtime dependencies by design: stdlib urllib + json + hmac + hashlib + uuid only.
18
+ dependencies = []
19
+
20
+ [project.scripts]
21
+ raxit = "raxit._launcher:main"
22
+
23
+ [project.urls]
24
+ Homepage = "https://rax.it"
25
+ Repository = "https://github.com/raxitlabs/runtime-security-core"
26
+
27
+ [dependency-groups]
28
+ dev = ["pytest>=8"]
29
+
30
+ [build-system]
31
+ requires = ["hatchling==1.31.0"]
32
+ build-backend = "hatchling.build"
33
+
34
+ [tool.hatch.build.targets.wheel]
35
+ packages = ["src/raxit"]
36
+
37
+ # _sitecustomize/ is a non-package dir (no __init__.py) so it loads as a
38
+ # top-level `sitecustomize` when `raxit run` puts it on PYTHONPATH. Force-include
39
+ # it so it ships in the wheel too (auto-patch DX works from a pip install, not
40
+ # just from source).
41
+ [tool.hatch.build.targets.wheel.force-include]
42
+ "src/raxit/_sitecustomize/sitecustomize.py" = "raxit/_sitecustomize/sitecustomize.py"
43
+
44
+ [tool.pytest.ini_options]
45
+ testpaths = ["tests"]
@@ -0,0 +1,57 @@
1
+ """raxit — zero-dependency Python client for the raxIT runtime governance engine.
2
+
3
+ ``import raxit`` gives you the full surface:
4
+
5
+ - ``RaxitClient`` — the facade; capability namespaces hang off it
6
+ (``govern`` / ``output`` / ``approvals`` / ``phase`` / ``fleet`` /
7
+ ``lifecycle`` / ``audit``).
8
+ - ``Decision`` / ``RecordResult`` / ``ApprovalRecord`` / ``AgentView`` — types.
9
+ - ``build_car`` / ``issue_local_token`` / ``governance_enabled`` /
10
+ ``decision_permitted`` — helpers.
11
+ - ``GovernanceClient`` / ``GovernanceError`` — testbed-compatible drop-in.
12
+ - ``raxit.agent`` (``governed`` / ``governed_tool``) and ``raxit.langchain``
13
+ (``RaxitCallbackHandler``) — the agent + LangChain layers.
14
+
15
+ Zero runtime dependencies by design: stdlib ``urllib`` / ``json`` / ``hmac`` /
16
+ ``hashlib`` / ``uuid`` only.
17
+ """
18
+
19
+ from .agent import governed, governed_tool
20
+ from .client import RaxitClient, GovernanceClient, GovernanceError
21
+ from .identity import governance_enabled, issue_local_token
22
+ from .types import (
23
+ AgentView,
24
+ ApprovalRecord,
25
+ BudgetLine,
26
+ BudgetSnapshot,
27
+ Decision,
28
+ RecordResult,
29
+ WarrantView,
30
+ build_car,
31
+ decision_permitted,
32
+ )
33
+
34
+ __all__ = [
35
+ # facade + types
36
+ "RaxitClient",
37
+ "Decision",
38
+ "RecordResult",
39
+ "ApprovalRecord",
40
+ "AgentView",
41
+ "BudgetSnapshot",
42
+ "BudgetLine",
43
+ "WarrantView",
44
+ # helpers
45
+ "build_car",
46
+ "issue_local_token",
47
+ "governance_enabled",
48
+ "decision_permitted",
49
+ # agent layer
50
+ "governed",
51
+ "governed_tool",
52
+ # testbed-compatible drop-in
53
+ "GovernanceClient",
54
+ "GovernanceError",
55
+ ]
56
+
57
+ __version__ = "0.0.1"
@@ -0,0 +1,9 @@
1
+ # GENERATED by scripts/bake_engine_pin.py at release time — do not edit by hand.
2
+ ENGINE_VERSION = "v0.0.1"
3
+ ENGINE_BASE_URL = "https://github.com/raxitlabs/raxit-engine-releases/releases/download/v0.0.1"
4
+ ENGINE_SHA256: dict[str, str] = {
5
+ "darwin_arm64": "b5c51b068e9c9831d973874007f86d05e4d3160b77aa70a6ded9bc10d8fc9bdf",
6
+ "darwin_amd64": "f06f962828c22ddeb77fac673ee428b15bc7b5905e440e35c24628108870652a",
7
+ "linux_arm64": "6a747780586aa655ff9cf6a67efb984dca0dcd73a680bfc1ea26107d9db776dd",
8
+ "linux_amd64": "023448ef95944b834f0c1025e005355f459857f39be328da803897312ffb389c",
9
+ }