unifyapps-guardrails 0.2.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.
@@ -0,0 +1,201 @@
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.
@@ -0,0 +1,151 @@
1
+ Metadata-Version: 2.4
2
+ Name: unifyapps-guardrails
3
+ Version: 0.2.0
4
+ Summary: Thin client for UnifyApps platform guardrails (config-driven controls/policies), traced to UnifyApps observability.
5
+ Author: UnifyApps
6
+ License-Expression: Apache-2.0
7
+ Project-URL: Homepage, https://github.com/unify-apps/unifyapps-guardrails
8
+ Project-URL: Repository, https://github.com/unify-apps/unifyapps-guardrails
9
+ Keywords: unifyapps,guardrails,ai,governance,opentelemetry,llm
10
+ Classifier: Development Status :: 4 - Beta
11
+ Classifier: Intended Audience :: Developers
12
+ Classifier: Programming Language :: Python :: 3
13
+ Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
14
+ Requires-Python: >=3.9
15
+ Description-Content-Type: text/markdown
16
+ License-File: LICENSE
17
+ Requires-Dist: opentelemetry-api>=1.20.0
18
+ Dynamic: license-file
19
+
20
+ # unifyapps-guardrails
21
+
22
+ A thin client for **UnifyApps platform guardrails**. Checks are *not* run in this
23
+ process — they are config-driven `controls` (Denied Topics, Content Filter, PII,
24
+ Prompt Injection, Custom terms, Regex, Credentials, Blocked Tools, Custom LLM)
25
+ grouped into `policies` applied to an agent. This client calls the exported
26
+ `Governance | Inline Evaluate` endpoint, which resolves the agent's controls for a
27
+ given surface, runs only those, writes incidents itself, and returns one decision.
28
+
29
+ Add or remove a control in the UI and the same code enforces it — nothing about the
30
+ checks is hardcoded here. Every call emits an OpenTelemetry span so it nests inside
31
+ your existing UnifyApps trace.
32
+
33
+ ## Install
34
+
35
+ ```bash
36
+ pip install unifyapps-guardrails
37
+ ```
38
+
39
+ Or, from a clone (editable):
40
+
41
+ ```bash
42
+ pip install -e .
43
+ ```
44
+
45
+ Stdlib + `opentelemetry-api` only — no models to download, no heavy deps.
46
+
47
+ ## Configure
48
+
49
+ | Env var | Purpose |
50
+ |---|---|
51
+ | `UNIFYAPPS_GUARDRAILS_URL` | URL of the exported inline-evaluate callable, with the **agent id as its last path segment** (like the OTLP endpoint) |
52
+ | `UNIFYAPPS_GUARDRAILS_API_KEY` | optional; sent as `Authorization: Bearer <key>` |
53
+
54
+ ## Usage
55
+
56
+ ```python
57
+ from unifyapps.guardrails import GovernanceGuard
58
+
59
+ # agent id comes from UNIFYAPPS_GUARDRAILS_URL's path — nothing to pass here
60
+ guard = GovernanceGuard()
61
+
62
+ # Before the LLM sees the user's message
63
+ d = guard.check_user_input(user_text)
64
+ if d.block:
65
+ return d.content # refusal message — don't call the LLM
66
+ user_text = d.content # masked/clean text to send to the LLM
67
+
68
+ # After the LLM answers, before the user sees it
69
+ d = guard.check_agent_output(reply)
70
+ return d.content # block -> refusal; else masked/clean text
71
+
72
+ # Before a tool runs (Blocked Tools matches the name; PII/Regex/... mask the arguments)
73
+ d = guard.check_tool_input("charge_card", {"amount": 10, "card": "4111111111111111"})
74
+ if d.block:
75
+ result = d.content # tool refusal — don't call the tool
76
+ else:
77
+ result = charge_card(**d.tool_value) # masked arguments
78
+
79
+ # After the tool returns, before the LLM sees its result
80
+ d = guard.check_tool_output("charge_card", result)
81
+ result = d.content if d.block else d.tool_value
82
+ ```
83
+
84
+ ### The decision
85
+
86
+ `evaluate` / `check_user_input` / `check_agent_output` / `check_tool_input` / `check_tool_output` return a `GovernanceDecision`:
87
+
88
+ | Field | Meaning |
89
+ |---|---|
90
+ | `block` | `True` if the content must be withheld |
91
+ | `content` | the text to **use**: masked/clean when `block=False`, the refusal message when `block=True` |
92
+ | `raw` | the full endpoint payload |
93
+ | `tool_value` | tool checks only: the tool arguments / result to **use** when `block=False` (masked, or your original object when nothing was masked); `None` when `block=True` |
94
+
95
+ Surfaces (see `Surface`): `user_input`, `agent_output`, `tool_input`, `tool_output`. A
96
+ tool check runs even with empty arguments, since Blocked Tools matches on the name. Tool
97
+ values are sent as JSON (dates, decimals and other objects as text); a value JSON cannot
98
+ hold (a circular reference, non-string keys) is checked as its text. When the platform
99
+ masks a value, `tool_value` is its JSON form: dates, decimals and objects come back as
100
+ strings and dict keys as strings; when nothing was masked it is your own object. A message
101
+ that is not text (a list of content parts) is checked as its JSON text. The guard **fails
102
+ open** — on timeout or endpoint error it returns the original text (and tool value) with
103
+ `block=False`, so a guardrail outage never drops a turn.
104
+
105
+ ### Observability
106
+
107
+ Each call is a `guardrail.evaluate` span. Inside a LangChain run (OpenInference
108
+ instrumentation) it is parented under the active run, so it travels in the agent's own
109
+ trace. A **blocked tool input** check outside the tool — the tool never runs — is recorded
110
+ as an OpenInference TOOL span (tool name, arguments, refusal), so the trace shows the
111
+ blocked call as a failed tool call. When the guard runs inside the tool, the framework's
112
+ own tool span records the call: raise on a block (see the LangGraph / OpenAI Agents
113
+ examples) so it shows as failed.
114
+
115
+ Mode is the agent's, not the code's: for an agent in **observe** mode the endpoint never
116
+ blocks or masks (every check returns the original value) and records nothing inline —
117
+ findings are flagged from the agent's traces instead. Running these guards against an
118
+ observe agent is safe but only adds latency.
119
+
120
+ ## Endpoint contract
121
+
122
+ ```
123
+ POST <UNIFYAPPS_GUARDRAILS_URL> # .../<agent-id> (id is the last path segment)
124
+ body -> { content, inputType, caseId }
125
+ 200 -> { block: bool, content: str }
126
+
127
+ # tool checks
128
+ body -> { content, inputType, caseId, toolName, tool_input | tool_output }
129
+ 200 -> { block: bool, content: str, toolInput, toolOutput }
130
+ ```
131
+
132
+ The **agent id is the last path segment of the URL**, not a body field — same shape as
133
+ the OTLP collector endpoint, so it is never passed twice. It is both the policy lookup
134
+ key and the incident scope; the exported callable maps that path segment to its
135
+ `agentId` input. `inputType` is the surface (`user_input` / `agent_output` / `tool_input` / `tool_output`); for a tool check `content` is the tool value as JSON text. `caseId`
136
+ is any stable per-conversation id (the client defaults to a random uuid) so the
137
+ resolver takes the chat branch.
138
+
139
+ ## Examples
140
+
141
+ Full input + output turns, one per framework, in [`examples/`](examples/):
142
+
143
+ | Framework | File |
144
+ |---|---|
145
+ | LangChain | [`examples/langchain_unify_guardrails.py`](examples/langchain_unify_guardrails.py) |
146
+ | LangGraph | [`examples/langgraph_unify_guardrails.py`](examples/langgraph_unify_guardrails.py) |
147
+ | OpenAI Agents SDK | [`examples/openai_agents_unify_guardrails.py`](examples/openai_agents_unify_guardrails.py) |
148
+
149
+ ## License
150
+
151
+ [Apache 2.0](LICENSE).
@@ -0,0 +1,132 @@
1
+ # unifyapps-guardrails
2
+
3
+ A thin client for **UnifyApps platform guardrails**. Checks are *not* run in this
4
+ process — they are config-driven `controls` (Denied Topics, Content Filter, PII,
5
+ Prompt Injection, Custom terms, Regex, Credentials, Blocked Tools, Custom LLM)
6
+ grouped into `policies` applied to an agent. This client calls the exported
7
+ `Governance | Inline Evaluate` endpoint, which resolves the agent's controls for a
8
+ given surface, runs only those, writes incidents itself, and returns one decision.
9
+
10
+ Add or remove a control in the UI and the same code enforces it — nothing about the
11
+ checks is hardcoded here. Every call emits an OpenTelemetry span so it nests inside
12
+ your existing UnifyApps trace.
13
+
14
+ ## Install
15
+
16
+ ```bash
17
+ pip install unifyapps-guardrails
18
+ ```
19
+
20
+ Or, from a clone (editable):
21
+
22
+ ```bash
23
+ pip install -e .
24
+ ```
25
+
26
+ Stdlib + `opentelemetry-api` only — no models to download, no heavy deps.
27
+
28
+ ## Configure
29
+
30
+ | Env var | Purpose |
31
+ |---|---|
32
+ | `UNIFYAPPS_GUARDRAILS_URL` | URL of the exported inline-evaluate callable, with the **agent id as its last path segment** (like the OTLP endpoint) |
33
+ | `UNIFYAPPS_GUARDRAILS_API_KEY` | optional; sent as `Authorization: Bearer <key>` |
34
+
35
+ ## Usage
36
+
37
+ ```python
38
+ from unifyapps.guardrails import GovernanceGuard
39
+
40
+ # agent id comes from UNIFYAPPS_GUARDRAILS_URL's path — nothing to pass here
41
+ guard = GovernanceGuard()
42
+
43
+ # Before the LLM sees the user's message
44
+ d = guard.check_user_input(user_text)
45
+ if d.block:
46
+ return d.content # refusal message — don't call the LLM
47
+ user_text = d.content # masked/clean text to send to the LLM
48
+
49
+ # After the LLM answers, before the user sees it
50
+ d = guard.check_agent_output(reply)
51
+ return d.content # block -> refusal; else masked/clean text
52
+
53
+ # Before a tool runs (Blocked Tools matches the name; PII/Regex/... mask the arguments)
54
+ d = guard.check_tool_input("charge_card", {"amount": 10, "card": "4111111111111111"})
55
+ if d.block:
56
+ result = d.content # tool refusal — don't call the tool
57
+ else:
58
+ result = charge_card(**d.tool_value) # masked arguments
59
+
60
+ # After the tool returns, before the LLM sees its result
61
+ d = guard.check_tool_output("charge_card", result)
62
+ result = d.content if d.block else d.tool_value
63
+ ```
64
+
65
+ ### The decision
66
+
67
+ `evaluate` / `check_user_input` / `check_agent_output` / `check_tool_input` / `check_tool_output` return a `GovernanceDecision`:
68
+
69
+ | Field | Meaning |
70
+ |---|---|
71
+ | `block` | `True` if the content must be withheld |
72
+ | `content` | the text to **use**: masked/clean when `block=False`, the refusal message when `block=True` |
73
+ | `raw` | the full endpoint payload |
74
+ | `tool_value` | tool checks only: the tool arguments / result to **use** when `block=False` (masked, or your original object when nothing was masked); `None` when `block=True` |
75
+
76
+ Surfaces (see `Surface`): `user_input`, `agent_output`, `tool_input`, `tool_output`. A
77
+ tool check runs even with empty arguments, since Blocked Tools matches on the name. Tool
78
+ values are sent as JSON (dates, decimals and other objects as text); a value JSON cannot
79
+ hold (a circular reference, non-string keys) is checked as its text. When the platform
80
+ masks a value, `tool_value` is its JSON form: dates, decimals and objects come back as
81
+ strings and dict keys as strings; when nothing was masked it is your own object. A message
82
+ that is not text (a list of content parts) is checked as its JSON text. The guard **fails
83
+ open** — on timeout or endpoint error it returns the original text (and tool value) with
84
+ `block=False`, so a guardrail outage never drops a turn.
85
+
86
+ ### Observability
87
+
88
+ Each call is a `guardrail.evaluate` span. Inside a LangChain run (OpenInference
89
+ instrumentation) it is parented under the active run, so it travels in the agent's own
90
+ trace. A **blocked tool input** check outside the tool — the tool never runs — is recorded
91
+ as an OpenInference TOOL span (tool name, arguments, refusal), so the trace shows the
92
+ blocked call as a failed tool call. When the guard runs inside the tool, the framework's
93
+ own tool span records the call: raise on a block (see the LangGraph / OpenAI Agents
94
+ examples) so it shows as failed.
95
+
96
+ Mode is the agent's, not the code's: for an agent in **observe** mode the endpoint never
97
+ blocks or masks (every check returns the original value) and records nothing inline —
98
+ findings are flagged from the agent's traces instead. Running these guards against an
99
+ observe agent is safe but only adds latency.
100
+
101
+ ## Endpoint contract
102
+
103
+ ```
104
+ POST <UNIFYAPPS_GUARDRAILS_URL> # .../<agent-id> (id is the last path segment)
105
+ body -> { content, inputType, caseId }
106
+ 200 -> { block: bool, content: str }
107
+
108
+ # tool checks
109
+ body -> { content, inputType, caseId, toolName, tool_input | tool_output }
110
+ 200 -> { block: bool, content: str, toolInput, toolOutput }
111
+ ```
112
+
113
+ The **agent id is the last path segment of the URL**, not a body field — same shape as
114
+ the OTLP collector endpoint, so it is never passed twice. It is both the policy lookup
115
+ key and the incident scope; the exported callable maps that path segment to its
116
+ `agentId` input. `inputType` is the surface (`user_input` / `agent_output` / `tool_input` / `tool_output`); for a tool check `content` is the tool value as JSON text. `caseId`
117
+ is any stable per-conversation id (the client defaults to a random uuid) so the
118
+ resolver takes the chat branch.
119
+
120
+ ## Examples
121
+
122
+ Full input + output turns, one per framework, in [`examples/`](examples/):
123
+
124
+ | Framework | File |
125
+ |---|---|
126
+ | LangChain | [`examples/langchain_unify_guardrails.py`](examples/langchain_unify_guardrails.py) |
127
+ | LangGraph | [`examples/langgraph_unify_guardrails.py`](examples/langgraph_unify_guardrails.py) |
128
+ | OpenAI Agents SDK | [`examples/openai_agents_unify_guardrails.py`](examples/openai_agents_unify_guardrails.py) |
129
+
130
+ ## License
131
+
132
+ [Apache 2.0](LICENSE).
@@ -0,0 +1,32 @@
1
+ [project]
2
+ name = "unifyapps-guardrails"
3
+ version = "0.2.0"
4
+ description = "Thin client for UnifyApps platform guardrails (config-driven controls/policies), traced to UnifyApps observability."
5
+ readme = "README.md"
6
+ requires-python = ">=3.9"
7
+ license = "Apache-2.0"
8
+ authors = [{ name = "UnifyApps" }]
9
+ keywords = ["unifyapps", "guardrails", "ai", "governance", "opentelemetry", "llm"]
10
+ classifiers = [
11
+ "Development Status :: 4 - Beta",
12
+ "Intended Audience :: Developers",
13
+ "Programming Language :: Python :: 3",
14
+ "Topic :: Scientific/Engineering :: Artificial Intelligence",
15
+ ]
16
+ # Checks run on the platform, not here. The client is stdlib + OpenTelemetry only.
17
+ dependencies = [
18
+ "opentelemetry-api>=1.20.0",
19
+ ]
20
+
21
+ [project.urls]
22
+ Homepage = "https://github.com/unify-apps/unifyapps-guardrails"
23
+ Repository = "https://github.com/unify-apps/unifyapps-guardrails"
24
+
25
+ [build-system]
26
+ requires = ["setuptools>=68"]
27
+ build-backend = "setuptools.build_meta"
28
+
29
+ # PEP 420 namespace package: ships unifyapps/guardrails/ and coexists with
30
+ # the pip-installed unifyapps-otel (which owns unifyapps/otel/).
31
+ [tool.setuptools.packages.find]
32
+ where = ["src"]
@@ -0,0 +1,4 @@
1
+ [egg_info]
2
+ tag_build =
3
+ tag_date = 0
4
+
@@ -0,0 +1,15 @@
1
+ """UnifyApps guardrails.
2
+
3
+ Detection lives on the platform (config-driven `controls`/`policies`), not here.
4
+ Use `GovernanceGuard` to call the exported inline-evaluate endpoint; it resolves the
5
+ agent's controls for a surface, runs only those, writes incidents itself, and returns
6
+ one decision (block / mask).
7
+ """
8
+
9
+ from .client import GovernanceDecision, GovernanceGuard, Surface
10
+
11
+ __all__ = [
12
+ "GovernanceGuard",
13
+ "GovernanceDecision",
14
+ "Surface",
15
+ ]