agentrust-py 0.0.1a1__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.
- agentrust_py-0.0.1a1/CHANGELOG.md +81 -0
- agentrust_py-0.0.1a1/LICENSE +177 -0
- agentrust_py-0.0.1a1/PKG-INFO +193 -0
- agentrust_py-0.0.1a1/README.md +139 -0
- agentrust_py-0.0.1a1/agentrust/__init__.py +72 -0
- agentrust_py-0.0.1a1/agentrust_sdk/__init__.py +124 -0
- agentrust_py-0.0.1a1/agentrust_sdk/adapters/__init__.py +1 -0
- agentrust_py-0.0.1a1/agentrust_sdk/adapters/autogen.py +235 -0
- agentrust_py-0.0.1a1/agentrust_sdk/adapters/claude_agents.py +225 -0
- agentrust_py-0.0.1a1/agentrust_sdk/adapters/crewai.py +104 -0
- agentrust_py-0.0.1a1/agentrust_sdk/adapters/langgraph.py +115 -0
- agentrust_py-0.0.1a1/agentrust_sdk/adapters/mcp.py +193 -0
- agentrust_py-0.0.1a1/agentrust_sdk/adapters/openai_agents.py +263 -0
- agentrust_py-0.0.1a1/agentrust_sdk/auth.py +192 -0
- agentrust_py-0.0.1a1/agentrust_sdk/auto.py +397 -0
- agentrust_py-0.0.1a1/agentrust_sdk/autoload.py +95 -0
- agentrust_py-0.0.1a1/agentrust_sdk/cli.py +736 -0
- agentrust_py-0.0.1a1/agentrust_sdk/client.py +792 -0
- agentrust_py-0.0.1a1/agentrust_sdk/config.py +205 -0
- agentrust_py-0.0.1a1/agentrust_sdk/decorator.py +288 -0
- agentrust_py-0.0.1a1/agentrust_sdk/embedded.py +438 -0
- agentrust_py-0.0.1a1/agentrust_sdk/hooks.py +461 -0
- agentrust_py-0.0.1a1/agentrust_sdk/models.py +87 -0
- agentrust_py-0.0.1a1/agentrust_sdk/py.typed +0 -0
- agentrust_py-0.0.1a1/agentrust_sdk/queue_replay.py +204 -0
- agentrust_py-0.0.1a1/agentrust_sdk/tiers.py +180 -0
- agentrust_py-0.0.1a1/agentrust_sdk/version_negotiation.py +290 -0
- agentrust_py-0.0.1a1/agentrust_sdk/webhooks.py +782 -0
- agentrust_py-0.0.1a1/pyproject.toml +98 -0
- agentrust_py-0.0.1a1/tests/__init__.py +0 -0
- agentrust_py-0.0.1a1/tests/conftest.py +64 -0
- agentrust_py-0.0.1a1/tests/test_adapters.py +284 -0
- agentrust_py-0.0.1a1/tests/test_async_advanced.py +507 -0
- agentrust_py-0.0.1a1/tests/test_chaos.py +106 -0
- agentrust_py-0.0.1a1/tests/test_client.py +219 -0
- agentrust_py-0.0.1a1/tests/test_config.py +60 -0
- agentrust_py-0.0.1a1/tests/test_decorator.py +124 -0
- agentrust_py-0.0.1a1/tests/test_embedded.py +110 -0
- agentrust_py-0.0.1a1/tests/test_hooks.py +335 -0
- agentrust_py-0.0.1a1/tests/test_webhooks.py +849 -0
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
All notable changes to AgentTrust Edge are documented here.
|
|
4
|
+
|
|
5
|
+
Format: [Keep a Changelog](https://keepachangelog.com/en/1.1.0/)
|
|
6
|
+
Versioning: [Semantic Versioning](https://semver.org/spec/v2.0.0.html)
|
|
7
|
+
|
|
8
|
+
---
|
|
9
|
+
|
|
10
|
+
## [Unreleased]
|
|
11
|
+
|
|
12
|
+
### Added
|
|
13
|
+
- `AGENTRUST_ENABLED=false` kill-switch — `@harness` becomes identity function; clients return no-op response. Zero code or deployment change needed to disable.
|
|
14
|
+
- `AGENTRUST_FAILURE_MODE=open|closed|queue` — configurable gateway-unreachable behaviour.
|
|
15
|
+
- `open` (default): log and continue; agent runs unvalidated.
|
|
16
|
+
- `closed`: raise `GatewayUnavailableError`; agent is blocked.
|
|
17
|
+
- `queue`: buffer request to local SQLite (`AGENTRUST_QUEUE_DB`) for later replay.
|
|
18
|
+
- `AGENTRUST_TIMEOUT_SEC` and `AGENTRUST_RETRY_ATTEMPTS` / `AGENTRUST_RETRY_BACKOFF` env vars.
|
|
19
|
+
- Exponential-backoff retry via `tenacity` (optional dependency; enabled by `pip install agentrust-sdk[retry]`).
|
|
20
|
+
- `EmbeddedGateway` — zero-dependency in-process governance engine backed by SQLite. Start with `embed_gateway()`. No PostgreSQL, no Redis, no Docker required. Available via `pip install agentrust-sdk[embedded]`.
|
|
21
|
+
- `agentrust_sdk/config.py` — centralized SDK configuration (`SDK_CONFIG` singleton).
|
|
22
|
+
- OpenTelemetry instrumentation: `agentrust.validate` span, `agentrust.validation_latency_ms` histogram, `agentrust.validations_total` counter (soft dep; no error if `opentelemetry-sdk` not installed).
|
|
23
|
+
- SDK version negotiation: every validate request sends `sdk_version` + `sdk_min_gateway_version`; gateway returns `426 Upgrade Required` on incompatible version.
|
|
24
|
+
- `GatewayVersionError` and `GatewayUnavailableError` exception classes.
|
|
25
|
+
- `agentrust export [file]` CLI command — export local SQLite audit records to JSONL.
|
|
26
|
+
- `agentrust purge --confirm` CLI command — delete all local audit databases.
|
|
27
|
+
- `agentrust disable` CLI command — print rollback/kill-switch instructions.
|
|
28
|
+
- Full SDK test suite: `tests/test_config.py`, `test_client.py`, `test_decorator.py`, `test_embedded.py`, `test_chaos.py` (previously zero tests existed).
|
|
29
|
+
- `agentrust-sdk[full]` extra: installs embedded + retry + otel in one command.
|
|
30
|
+
- `agentrust-sdk[openai]` and `agentrust-sdk[langchain]` optional extras.
|
|
31
|
+
- ISO/IEC 42001 A.6.2: `AuditStore.mask_pii()` and `run_retention_maintenance()` for 90-day payload archival.
|
|
32
|
+
- `DELETE /v1/audit/executions/{envelope_id}/pii` — GDPR Art. 17 erasure endpoint.
|
|
33
|
+
- Migration `005_pii_masking.py` — adds `pii_masked_at` column + indexes to `executions`.
|
|
34
|
+
- Background `_retention_loop` in gateway runs every 6 hours to enforce 90-day hot-store policy.
|
|
35
|
+
- `ToolCall.tool_version` and `ToolCall.invoked_at` fields (ISO 42001 Clause 8.3.2).
|
|
36
|
+
- `ToolResult` Pydantic model replacing `list[Any]` in `ExecutionDetail.tool_results`.
|
|
37
|
+
- `docs/CRITIC_AUDIT_REPORT.md` — full plug-and-play readiness audit.
|
|
38
|
+
|
|
39
|
+
### Changed
|
|
40
|
+
- `pyproject.toml`: all dependency version pins now specify upper bounds (e.g. `httpx>=0.27.0,<1.0.0`) to prevent silent breakage on major upgrades.
|
|
41
|
+
- `pyproject.toml`: license changed from MIT to Apache-2.0 (open-core model alignment).
|
|
42
|
+
- SDK version bumped `2.0.0` → `2.1.0`.
|
|
43
|
+
- `AgentTrustClient` and `AsyncAgentTrustClient` now read defaults from `SDK_CONFIG`; explicit constructor args still override.
|
|
44
|
+
- Gateway `auth_enabled` setting documented to default `True` in production K8s ConfigMap.
|
|
45
|
+
- `judge_engine.py`: added missing `Field` import (was `NameError` at runtime).
|
|
46
|
+
|
|
47
|
+
### Fixed
|
|
48
|
+
- `judge_engine.py`: `_JudgeRawResponse` was missing `Field` import — fixed.
|
|
49
|
+
- Trust chain `child_risk_tier` was hardcoded `"medium"` at step 0; moved to step 4b after `risk_engine.score()`.
|
|
50
|
+
- SDK `auth.py` JWT tier read was always returning `Tier.FREE`; restored payload tier with security comment.
|
|
51
|
+
- Policy engine `fail-open` (returning `100.0`) changed to `fail-safe` (returning `0.0`).
|
|
52
|
+
|
|
53
|
+
---
|
|
54
|
+
|
|
55
|
+
## [2.0.0] — 2026-04-15
|
|
56
|
+
|
|
57
|
+
### Added
|
|
58
|
+
- Phase 5: Python SDK (`agentrust_sdk/`) with `@harness` decorator, tier-gated capability system, LangGraph + CrewAI adapters.
|
|
59
|
+
- Phase 5: Multi-agent trust chain support (`parent_envelope_id`).
|
|
60
|
+
- Phase 5: Redis sliding-window rate limiter.
|
|
61
|
+
- Phase 5: Kubernetes edge manifests (8 YAML files with ExternalSecrets, NetworkPolicy, TLS ingress).
|
|
62
|
+
- ISO/IEC 42001:2023 compliance: `governance_disclosure`, `confidence_rationale`, adversarial detection, Pydantic schema validation of judge responses, fail-safe policy engine.
|
|
63
|
+
- `docs/AIIA_TEMPLATE.md`, `docs/INCIDENT_RESPONSE.md`, `docs/DATA_GOVERNANCE.md`, `docs/INTENDED_USE.md`.
|
|
64
|
+
|
|
65
|
+
---
|
|
66
|
+
|
|
67
|
+
## [1.0.0] — 2026-01-20
|
|
68
|
+
|
|
69
|
+
### Added
|
|
70
|
+
- Phase 1–4: Full validation pipeline — schema, evidence, tool-trust, consistency, policy, golden-test.
|
|
71
|
+
- 7-signal confidence engine with configurable YAML weights.
|
|
72
|
+
- 4-factor risk engine.
|
|
73
|
+
- Decision engine with 5 outcomes.
|
|
74
|
+
- Append-only SHA-256 hash-chain audit ledger (PostgreSQL).
|
|
75
|
+
- LLM judge engine (Ollama + Claude backends) with Redis cache and circuit breaker.
|
|
76
|
+
- Human review queue (Redis + PostgreSQL).
|
|
77
|
+
- Alert engine + HMAC-signed webhook notifier.
|
|
78
|
+
- Analytics endpoint.
|
|
79
|
+
- JWT API key auth middleware.
|
|
80
|
+
- React dashboard skeleton.
|
|
81
|
+
- Docker Compose + full Alembic migration history.
|
|
@@ -0,0 +1,177 @@
|
|
|
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 made available under
|
|
36
|
+
the License, as indicated by a copyright notice that is included in
|
|
37
|
+
or attached to the work (an example is provided in the Appendix below).
|
|
38
|
+
|
|
39
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
|
40
|
+
form, that is based on (or derived from) the Work and for which the
|
|
41
|
+
editorial revisions, annotations, elaborations, or other transformations
|
|
42
|
+
represent, as a whole, an original work of authorship. For the purposes
|
|
43
|
+
of this License, Derivative Works shall not include works that remain
|
|
44
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
|
45
|
+
the Work and Derivative Works thereof.
|
|
46
|
+
|
|
47
|
+
"Contribution" shall mean, as submitted to the Licensor for inclusion
|
|
48
|
+
in the Work by the copyright owner or by an individual or Legal Entity
|
|
49
|
+
authorized to submit on behalf of the copyright owner. For the purposes
|
|
50
|
+
of this definition, "submit" means any form of electronic, verbal, or
|
|
51
|
+
written communication sent to the Licensor or its representatives,
|
|
52
|
+
including but not limited to communication on electronic mailing lists,
|
|
53
|
+
source code control systems, and issue tracking systems that are managed
|
|
54
|
+
by, or on behalf of, the Licensor for the purpose of developing and
|
|
55
|
+
discussing the Work, but excluding communication that is conspicuously
|
|
56
|
+
marked or designated in writing by the copyright owner as
|
|
57
|
+
"Not a Contribution."
|
|
58
|
+
|
|
59
|
+
"Contributor" shall mean Licensor and any Legal Entity on behalf of
|
|
60
|
+
whom a Contribution has been received by the Licensor and included
|
|
61
|
+
within the Work.
|
|
62
|
+
|
|
63
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
64
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
65
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
66
|
+
copyright license to reproduce, prepare Derivative Works of,
|
|
67
|
+
publicly display, publicly perform, sublicense, and distribute the
|
|
68
|
+
Work and such Derivative Works in Source or Object form.
|
|
69
|
+
|
|
70
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
|
71
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
72
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
73
|
+
(except as stated in this section) patent license to make, have made,
|
|
74
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
75
|
+
where such license applies only to those patent claims licensable
|
|
76
|
+
by such Contributor that are necessarily infringed by their
|
|
77
|
+
Contribution(s) alone or by the combined work.
|
|
78
|
+
|
|
79
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
|
80
|
+
Work or Derivative Works thereof in any medium, with or without
|
|
81
|
+
modifications, and in Source or Object form, provided that You
|
|
82
|
+
meet the following conditions:
|
|
83
|
+
|
|
84
|
+
(a) You must give any other recipients of the Work or Derivative
|
|
85
|
+
Works a copy of this License; and
|
|
86
|
+
|
|
87
|
+
(b) You must cause any modified files to carry prominent notices
|
|
88
|
+
stating that You changed the files; and
|
|
89
|
+
|
|
90
|
+
(c) You must retain, in the Source form of any Derivative Works
|
|
91
|
+
that You distribute, all copyright, patent, trademark, and
|
|
92
|
+
attribution notices from the Source form of the Work,
|
|
93
|
+
excluding those notices that do not pertain to any part of
|
|
94
|
+
the Derivative Works; and
|
|
95
|
+
|
|
96
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
|
97
|
+
distribution, You must include a readable copy of the
|
|
98
|
+
attribution notices contained within such NOTICE file, in
|
|
99
|
+
at least one of the following places: within a NOTICE text file
|
|
100
|
+
distributed as part of the Derivative Works; within the Source
|
|
101
|
+
form or documentation, if provided along with the Derivative
|
|
102
|
+
Works; or, within a display generated by the Derivative Works,
|
|
103
|
+
if and wherever such third-party notices normally appear. The
|
|
104
|
+
contents of the NOTICE file are for informational purposes only
|
|
105
|
+
and do not modify the License. You may add Your own attribution
|
|
106
|
+
notices within Derivative Works that You distribute, alongside
|
|
107
|
+
or as an addendum to the NOTICE text from the Work, provided
|
|
108
|
+
that such additional attribution notices cannot be construed
|
|
109
|
+
as modifying the License.
|
|
110
|
+
|
|
111
|
+
You may add Your own license statement for Your modifications and
|
|
112
|
+
may provide additional grant of rights to use, copy, modify, merge,
|
|
113
|
+
publish, distribute, sublicense, and/or sell copies of the Work,
|
|
114
|
+
and to permit persons to whom the Work is furnished to do so,
|
|
115
|
+
subject to the following conditions.
|
|
116
|
+
|
|
117
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
118
|
+
any Contribution intentionally submitted for inclusion in the Work
|
|
119
|
+
by You to the Licensor shall be under the terms and conditions of
|
|
120
|
+
this License, without any additional terms or conditions.
|
|
121
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
|
122
|
+
the terms of any separate license agreement you may have executed
|
|
123
|
+
with Licensor regarding such Contributions.
|
|
124
|
+
|
|
125
|
+
6. Trademarks. This License does not grant permission to use the trade
|
|
126
|
+
names, trademarks, service marks, or product names of the Licensor,
|
|
127
|
+
except as required for reasonable and customary use in describing the
|
|
128
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
|
129
|
+
|
|
130
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
131
|
+
agreed to in writing, Licensor provides the Work (and each
|
|
132
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
133
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
134
|
+
implied, including, without limitation, any warranties or conditions
|
|
135
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
136
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
137
|
+
appropriateness of using or reproducing the Work and assume any
|
|
138
|
+
risks associated with Your exercise of permissions under this License.
|
|
139
|
+
|
|
140
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
|
141
|
+
whether in tort (including negligence), contract, or otherwise,
|
|
142
|
+
unless required by applicable law (such as deliberate and grossly
|
|
143
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
|
144
|
+
liable to You for damages, including any direct, indirect, special,
|
|
145
|
+
incidental, or exemplary damages of any character arising as a
|
|
146
|
+
result of this License or out of the use or inability to use the
|
|
147
|
+
Work (including but not limited to damages for loss of goodwill,
|
|
148
|
+
work stoppage, computer failure or malfunction, or all other
|
|
149
|
+
commercial damages or losses), even if such Contributor has been
|
|
150
|
+
advised of the possibility of such damages.
|
|
151
|
+
|
|
152
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
|
153
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
|
154
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
155
|
+
or other liability obligations and/or rights consistent with this
|
|
156
|
+
License. However, in accepting such obligations, You may charge
|
|
157
|
+
such fees only on Your own behalf and on Your sole responsibility,
|
|
158
|
+
not on behalf of any other Contributor, and only if You agree to
|
|
159
|
+
indemnify, defend, and hold each Contributor harmless for any
|
|
160
|
+
liability incurred by, or claims asserted against, such Contributor
|
|
161
|
+
by reason of your accepting any such warranty or additional liability.
|
|
162
|
+
|
|
163
|
+
END OF TERMS AND CONDITIONS
|
|
164
|
+
|
|
165
|
+
Copyright 2024 AgentTrust, Inc.
|
|
166
|
+
|
|
167
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
168
|
+
you may not use this file except in compliance with the License.
|
|
169
|
+
You may obtain a copy of the License at
|
|
170
|
+
|
|
171
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
172
|
+
|
|
173
|
+
Unless required by applicable law or agreed to in writing, software
|
|
174
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
175
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
176
|
+
See the License for the specific language governing permissions and
|
|
177
|
+
limitations under the License.
|
|
@@ -0,0 +1,193 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: agentrust-py
|
|
3
|
+
Version: 0.0.1a1
|
|
4
|
+
Summary: AgentTrust Edge — the AI Agent Harness. One decorator, full trust enforcement.
|
|
5
|
+
Project-URL: Homepage, https://agentrust.io
|
|
6
|
+
Project-URL: Documentation, https://docs.agentrust.io
|
|
7
|
+
Project-URL: Repository, https://github.com/agentrust/agentrust
|
|
8
|
+
Project-URL: Changelog, https://github.com/agentrust/agentrust/blob/main/CHANGELOG.md
|
|
9
|
+
License: Apache-2.0
|
|
10
|
+
License-File: LICENSE
|
|
11
|
+
Keywords: agents,ai,audit,compliance,governance,llm,safety,trust
|
|
12
|
+
Classifier: Development Status :: 3 - Alpha
|
|
13
|
+
Classifier: Intended Audience :: Developers
|
|
14
|
+
Classifier: License :: OSI Approved :: Apache Software License
|
|
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: Topic :: Scientific/Engineering :: Artificial Intelligence
|
|
20
|
+
Classifier: Topic :: Software Development :: Libraries :: Python Modules
|
|
21
|
+
Classifier: Typing :: Typed
|
|
22
|
+
Requires-Python: >=3.10
|
|
23
|
+
Requires-Dist: httpx<1.0.0,>=0.27.0
|
|
24
|
+
Requires-Dist: pydantic<3.0.0,>=2.0.0
|
|
25
|
+
Requires-Dist: pyyaml<7.0,>=6.0.3
|
|
26
|
+
Provides-Extra: autoload
|
|
27
|
+
Provides-Extra: crewai
|
|
28
|
+
Requires-Dist: crewai<1.0.0,>=0.80.0; extra == 'crewai'
|
|
29
|
+
Provides-Extra: dev
|
|
30
|
+
Requires-Dist: fastapi>=0.137.1; extra == 'dev'
|
|
31
|
+
Requires-Dist: httpx<1.0.0,>=0.27.0; extra == 'dev'
|
|
32
|
+
Requires-Dist: pytest-asyncio>=0.24.0; extra == 'dev'
|
|
33
|
+
Requires-Dist: pytest>=9.1.0; extra == 'dev'
|
|
34
|
+
Requires-Dist: respx>=0.21.0; extra == 'dev'
|
|
35
|
+
Requires-Dist: tenacity>=8.2.0; extra == 'dev'
|
|
36
|
+
Requires-Dist: uvicorn>=0.29.0; extra == 'dev'
|
|
37
|
+
Provides-Extra: embedded
|
|
38
|
+
Requires-Dist: fastapi<1.0.0,>=0.137.1; extra == 'embedded'
|
|
39
|
+
Requires-Dist: uvicorn<1.0.0,>=0.29.0; extra == 'embedded'
|
|
40
|
+
Provides-Extra: full
|
|
41
|
+
Requires-Dist: agentrust-sdk[embedded,otel,retry]; extra == 'full'
|
|
42
|
+
Provides-Extra: langchain
|
|
43
|
+
Requires-Dist: langchain<1.0.0,>=0.2.0; extra == 'langchain'
|
|
44
|
+
Provides-Extra: langgraph
|
|
45
|
+
Requires-Dist: langgraph<1.0.0,>=0.2.0; extra == 'langgraph'
|
|
46
|
+
Provides-Extra: openai
|
|
47
|
+
Requires-Dist: openai<3.0.0,>=2.41.1; extra == 'openai'
|
|
48
|
+
Provides-Extra: otel
|
|
49
|
+
Requires-Dist: opentelemetry-api>=1.20.0; extra == 'otel'
|
|
50
|
+
Requires-Dist: opentelemetry-sdk>=1.20.0; extra == 'otel'
|
|
51
|
+
Provides-Extra: retry
|
|
52
|
+
Requires-Dist: tenacity<10.0.0,>=8.2.0; extra == 'retry'
|
|
53
|
+
Description-Content-Type: text/markdown
|
|
54
|
+
|
|
55
|
+
# agentrust-py
|
|
56
|
+
|
|
57
|
+
[](https://pypi.org/project/agentrust-py/)
|
|
58
|
+
[](https://github.com/agentrust/agentrust/blob/main/LICENSE)
|
|
59
|
+
[](https://pypi.org/project/agentrust-py/)
|
|
60
|
+
|
|
61
|
+
Python SDK for [AgentTrust Edge](https://github.com/agentrust/agentrust) — runtime AI agent governance with zero-config startup and env-only rollback.
|
|
62
|
+
|
|
63
|
+
---
|
|
64
|
+
|
|
65
|
+
## Install
|
|
66
|
+
|
|
67
|
+
```bash
|
|
68
|
+
pip install "agentrust-py[embedded,retry]"
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
---
|
|
72
|
+
|
|
73
|
+
## 30-second quickstart
|
|
74
|
+
|
|
75
|
+
```python
|
|
76
|
+
from agentrust_sdk import harness, embed_gateway
|
|
77
|
+
|
|
78
|
+
# Optional: start an in-process SQLite gateway (dev / air-gap)
|
|
79
|
+
embed_gateway()
|
|
80
|
+
|
|
81
|
+
@harness
|
|
82
|
+
def my_agent(user: str, input: str) -> dict:
|
|
83
|
+
"""Decorated agent. Governance happens automatically after each call."""
|
|
84
|
+
return {"answer": "42"}
|
|
85
|
+
|
|
86
|
+
result = my_agent(user="alice", input="What is the meaning of life?")
|
|
87
|
+
print(result) # {"answer": "42"} — or BlockedError if policy rejects it
|
|
88
|
+
```
|
|
89
|
+
|
|
90
|
+
> **Note on imports:** The PyPI package name is `agentrust-py`; the Python module is `agentrust_sdk`.
|
|
91
|
+
> All imports use `from agentrust_sdk import ...`.
|
|
92
|
+
|
|
93
|
+
---
|
|
94
|
+
|
|
95
|
+
## Rollback (no code change, no image rebuild)
|
|
96
|
+
|
|
97
|
+
```bash
|
|
98
|
+
export AGENTRUST_ENABLED=false
|
|
99
|
+
# restart process — @harness becomes a no-op identity wrapper
|
|
100
|
+
```
|
|
101
|
+
|
|
102
|
+
---
|
|
103
|
+
|
|
104
|
+
## Configuration
|
|
105
|
+
|
|
106
|
+
Every tunable is an env var — no config file required for basic usage.
|
|
107
|
+
|
|
108
|
+
| Variable | Default | Purpose |
|
|
109
|
+
|----------|---------|---------|
|
|
110
|
+
| `AGENTRUST_ENABLED` | `true` | Master kill-switch |
|
|
111
|
+
| `AGENTRUST_GATEWAY_URL` | `http://localhost:8000` | Gateway URL |
|
|
112
|
+
| `AGENTRUST_FAILURE_MODE` | `open` | `open` \| `closed` \| `queue` |
|
|
113
|
+
| `AGENTRUST_TIMEOUT_SEC` | `10` | Request timeout |
|
|
114
|
+
| `AGENTRUST_RETRY_ATTEMPTS` | `3` | Retries (needs `[retry]`) |
|
|
115
|
+
| `AGENTRUST_KEY` | — | API key |
|
|
116
|
+
|
|
117
|
+
---
|
|
118
|
+
|
|
119
|
+
## Deployment ladder (env-only)
|
|
120
|
+
|
|
121
|
+
```bash
|
|
122
|
+
# Dev — embedded SQLite, no external services
|
|
123
|
+
AGENTRUST_ENABLED=true
|
|
124
|
+
# (call embed_gateway() at startup)
|
|
125
|
+
|
|
126
|
+
# Staging — remote gateway, fail safe
|
|
127
|
+
AGENTRUST_GATEWAY_URL=https://agentrust-staging.internal:8000
|
|
128
|
+
AGENTRUST_KEY=at_...
|
|
129
|
+
AGENTRUST_FAILURE_MODE=closed
|
|
130
|
+
|
|
131
|
+
# Production
|
|
132
|
+
AGENTRUST_GATEWAY_URL=https://agentrust.internal:8000
|
|
133
|
+
AGENTRUST_FAILURE_MODE=open
|
|
134
|
+
AGENTRUST_RETRY_ATTEMPTS=5
|
|
135
|
+
```
|
|
136
|
+
|
|
137
|
+
App code is **identical** across all three environments.
|
|
138
|
+
|
|
139
|
+
---
|
|
140
|
+
|
|
141
|
+
## Failure modes
|
|
142
|
+
|
|
143
|
+
| Mode | Gateway unreachable behaviour |
|
|
144
|
+
|------|------------------------------|
|
|
145
|
+
| `open` (default) | Log warning, return approve response — agent continues |
|
|
146
|
+
| `closed` | Raise `GatewayUnavailableError` — agent is blocked |
|
|
147
|
+
| `queue` | Write request to local SQLite buffer; return approve response |
|
|
148
|
+
|
|
149
|
+
> **Queue mode note:** The local buffer is written but not automatically replayed in the current release.
|
|
150
|
+
> Use `agentrust export` to inspect buffered records. A background drain/replay worker is on the roadmap.
|
|
151
|
+
|
|
152
|
+
---
|
|
153
|
+
|
|
154
|
+
## Extras
|
|
155
|
+
|
|
156
|
+
| Extra | Installs |
|
|
157
|
+
|-------|---------|
|
|
158
|
+
| `embedded` | `uvicorn`, `fastapi` — in-process gateway via `embed_gateway()` |
|
|
159
|
+
| `retry` | `tenacity` — exponential backoff |
|
|
160
|
+
| `otel` | `opentelemetry-sdk`, `opentelemetry-api` — traces + metrics |
|
|
161
|
+
| `langgraph` | LangGraph `AgentTrustNode` adapter |
|
|
162
|
+
| `crewai` | CrewAI `AgentTrustCallback` adapter |
|
|
163
|
+
| `full` | All of the above |
|
|
164
|
+
|
|
165
|
+
---
|
|
166
|
+
|
|
167
|
+
## Tiers
|
|
168
|
+
|
|
169
|
+
| Tier | Capabilities |
|
|
170
|
+
|------|-------------|
|
|
171
|
+
| OSS | Local schema validation, no API key |
|
|
172
|
+
| Free | Evidence, tool trust, auto-decision, local audit |
|
|
173
|
+
| Developer | Confidence scoring, risk engine, built-in policies |
|
|
174
|
+
| Team | Framework adapters, custom policies, analytics, review queue |
|
|
175
|
+
| Enterprise | LLM judge, trust chain, SSO, self-hosted, SOC2 export |
|
|
176
|
+
|
|
177
|
+
---
|
|
178
|
+
|
|
179
|
+
## CLI
|
|
180
|
+
|
|
181
|
+
```bash
|
|
182
|
+
agentrust init # create ~/.agentrust/config.yaml
|
|
183
|
+
agentrust status # tier + gateway reachability
|
|
184
|
+
agentrust export ./out.jsonl
|
|
185
|
+
agentrust purge --confirm
|
|
186
|
+
agentrust disable
|
|
187
|
+
```
|
|
188
|
+
|
|
189
|
+
---
|
|
190
|
+
|
|
191
|
+
## License
|
|
192
|
+
|
|
193
|
+
Apache-2.0. Framework adapters and enterprise features require a paid subscription.
|
|
@@ -0,0 +1,139 @@
|
|
|
1
|
+
# agentrust-py
|
|
2
|
+
|
|
3
|
+
[](https://pypi.org/project/agentrust-py/)
|
|
4
|
+
[](https://github.com/agentrust/agentrust/blob/main/LICENSE)
|
|
5
|
+
[](https://pypi.org/project/agentrust-py/)
|
|
6
|
+
|
|
7
|
+
Python SDK for [AgentTrust Edge](https://github.com/agentrust/agentrust) — runtime AI agent governance with zero-config startup and env-only rollback.
|
|
8
|
+
|
|
9
|
+
---
|
|
10
|
+
|
|
11
|
+
## Install
|
|
12
|
+
|
|
13
|
+
```bash
|
|
14
|
+
pip install "agentrust-py[embedded,retry]"
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
---
|
|
18
|
+
|
|
19
|
+
## 30-second quickstart
|
|
20
|
+
|
|
21
|
+
```python
|
|
22
|
+
from agentrust_sdk import harness, embed_gateway
|
|
23
|
+
|
|
24
|
+
# Optional: start an in-process SQLite gateway (dev / air-gap)
|
|
25
|
+
embed_gateway()
|
|
26
|
+
|
|
27
|
+
@harness
|
|
28
|
+
def my_agent(user: str, input: str) -> dict:
|
|
29
|
+
"""Decorated agent. Governance happens automatically after each call."""
|
|
30
|
+
return {"answer": "42"}
|
|
31
|
+
|
|
32
|
+
result = my_agent(user="alice", input="What is the meaning of life?")
|
|
33
|
+
print(result) # {"answer": "42"} — or BlockedError if policy rejects it
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
> **Note on imports:** The PyPI package name is `agentrust-py`; the Python module is `agentrust_sdk`.
|
|
37
|
+
> All imports use `from agentrust_sdk import ...`.
|
|
38
|
+
|
|
39
|
+
---
|
|
40
|
+
|
|
41
|
+
## Rollback (no code change, no image rebuild)
|
|
42
|
+
|
|
43
|
+
```bash
|
|
44
|
+
export AGENTRUST_ENABLED=false
|
|
45
|
+
# restart process — @harness becomes a no-op identity wrapper
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
---
|
|
49
|
+
|
|
50
|
+
## Configuration
|
|
51
|
+
|
|
52
|
+
Every tunable is an env var — no config file required for basic usage.
|
|
53
|
+
|
|
54
|
+
| Variable | Default | Purpose |
|
|
55
|
+
|----------|---------|---------|
|
|
56
|
+
| `AGENTRUST_ENABLED` | `true` | Master kill-switch |
|
|
57
|
+
| `AGENTRUST_GATEWAY_URL` | `http://localhost:8000` | Gateway URL |
|
|
58
|
+
| `AGENTRUST_FAILURE_MODE` | `open` | `open` \| `closed` \| `queue` |
|
|
59
|
+
| `AGENTRUST_TIMEOUT_SEC` | `10` | Request timeout |
|
|
60
|
+
| `AGENTRUST_RETRY_ATTEMPTS` | `3` | Retries (needs `[retry]`) |
|
|
61
|
+
| `AGENTRUST_KEY` | — | API key |
|
|
62
|
+
|
|
63
|
+
---
|
|
64
|
+
|
|
65
|
+
## Deployment ladder (env-only)
|
|
66
|
+
|
|
67
|
+
```bash
|
|
68
|
+
# Dev — embedded SQLite, no external services
|
|
69
|
+
AGENTRUST_ENABLED=true
|
|
70
|
+
# (call embed_gateway() at startup)
|
|
71
|
+
|
|
72
|
+
# Staging — remote gateway, fail safe
|
|
73
|
+
AGENTRUST_GATEWAY_URL=https://agentrust-staging.internal:8000
|
|
74
|
+
AGENTRUST_KEY=at_...
|
|
75
|
+
AGENTRUST_FAILURE_MODE=closed
|
|
76
|
+
|
|
77
|
+
# Production
|
|
78
|
+
AGENTRUST_GATEWAY_URL=https://agentrust.internal:8000
|
|
79
|
+
AGENTRUST_FAILURE_MODE=open
|
|
80
|
+
AGENTRUST_RETRY_ATTEMPTS=5
|
|
81
|
+
```
|
|
82
|
+
|
|
83
|
+
App code is **identical** across all three environments.
|
|
84
|
+
|
|
85
|
+
---
|
|
86
|
+
|
|
87
|
+
## Failure modes
|
|
88
|
+
|
|
89
|
+
| Mode | Gateway unreachable behaviour |
|
|
90
|
+
|------|------------------------------|
|
|
91
|
+
| `open` (default) | Log warning, return approve response — agent continues |
|
|
92
|
+
| `closed` | Raise `GatewayUnavailableError` — agent is blocked |
|
|
93
|
+
| `queue` | Write request to local SQLite buffer; return approve response |
|
|
94
|
+
|
|
95
|
+
> **Queue mode note:** The local buffer is written but not automatically replayed in the current release.
|
|
96
|
+
> Use `agentrust export` to inspect buffered records. A background drain/replay worker is on the roadmap.
|
|
97
|
+
|
|
98
|
+
---
|
|
99
|
+
|
|
100
|
+
## Extras
|
|
101
|
+
|
|
102
|
+
| Extra | Installs |
|
|
103
|
+
|-------|---------|
|
|
104
|
+
| `embedded` | `uvicorn`, `fastapi` — in-process gateway via `embed_gateway()` |
|
|
105
|
+
| `retry` | `tenacity` — exponential backoff |
|
|
106
|
+
| `otel` | `opentelemetry-sdk`, `opentelemetry-api` — traces + metrics |
|
|
107
|
+
| `langgraph` | LangGraph `AgentTrustNode` adapter |
|
|
108
|
+
| `crewai` | CrewAI `AgentTrustCallback` adapter |
|
|
109
|
+
| `full` | All of the above |
|
|
110
|
+
|
|
111
|
+
---
|
|
112
|
+
|
|
113
|
+
## Tiers
|
|
114
|
+
|
|
115
|
+
| Tier | Capabilities |
|
|
116
|
+
|------|-------------|
|
|
117
|
+
| OSS | Local schema validation, no API key |
|
|
118
|
+
| Free | Evidence, tool trust, auto-decision, local audit |
|
|
119
|
+
| Developer | Confidence scoring, risk engine, built-in policies |
|
|
120
|
+
| Team | Framework adapters, custom policies, analytics, review queue |
|
|
121
|
+
| Enterprise | LLM judge, trust chain, SSO, self-hosted, SOC2 export |
|
|
122
|
+
|
|
123
|
+
---
|
|
124
|
+
|
|
125
|
+
## CLI
|
|
126
|
+
|
|
127
|
+
```bash
|
|
128
|
+
agentrust init # create ~/.agentrust/config.yaml
|
|
129
|
+
agentrust status # tier + gateway reachability
|
|
130
|
+
agentrust export ./out.jsonl
|
|
131
|
+
agentrust purge --confirm
|
|
132
|
+
agentrust disable
|
|
133
|
+
```
|
|
134
|
+
|
|
135
|
+
---
|
|
136
|
+
|
|
137
|
+
## License
|
|
138
|
+
|
|
139
|
+
Apache-2.0. Framework adapters and enterprise features require a paid subscription.
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
"""
|
|
2
|
+
agentrust — top-level import alias for agentrust_sdk.
|
|
3
|
+
|
|
4
|
+
Allows the documented import style::
|
|
5
|
+
|
|
6
|
+
from agentrust import harness
|
|
7
|
+
from agentrust import AgentTrustClient
|
|
8
|
+
|
|
9
|
+
instead of the package-internal name ``agentrust_sdk``.
|
|
10
|
+
Both names resolve to the same objects; this shim adds zero overhead.
|
|
11
|
+
"""
|
|
12
|
+
from agentrust_sdk import ( # noqa: F401
|
|
13
|
+
harness,
|
|
14
|
+
validate,
|
|
15
|
+
AgentTrustClient,
|
|
16
|
+
AsyncAgentTrustClient,
|
|
17
|
+
embed_gateway,
|
|
18
|
+
EmbeddedGateway,
|
|
19
|
+
SDK_CONFIG,
|
|
20
|
+
BlockedError,
|
|
21
|
+
TierGateError,
|
|
22
|
+
GatewayUnavailableError,
|
|
23
|
+
GatewayVersionError,
|
|
24
|
+
resolve_key,
|
|
25
|
+
save_key_to_config,
|
|
26
|
+
Tier,
|
|
27
|
+
Capability,
|
|
28
|
+
is_allowed,
|
|
29
|
+
allowed_capabilities,
|
|
30
|
+
CAPABILITY_MIN_TIER,
|
|
31
|
+
ValidateRequest,
|
|
32
|
+
ValidateResponse,
|
|
33
|
+
ValidationResult,
|
|
34
|
+
RiskResult,
|
|
35
|
+
DecisionResult,
|
|
36
|
+
ToolCall,
|
|
37
|
+
drain_queue,
|
|
38
|
+
auto_instrument,
|
|
39
|
+
auto_wrap,
|
|
40
|
+
)
|
|
41
|
+
from agentrust_sdk import __version__ # noqa: F401
|
|
42
|
+
|
|
43
|
+
__all__ = [
|
|
44
|
+
"harness",
|
|
45
|
+
"validate",
|
|
46
|
+
"AgentTrustClient",
|
|
47
|
+
"AsyncAgentTrustClient",
|
|
48
|
+
"embed_gateway",
|
|
49
|
+
"EmbeddedGateway",
|
|
50
|
+
"SDK_CONFIG",
|
|
51
|
+
"BlockedError",
|
|
52
|
+
"TierGateError",
|
|
53
|
+
"GatewayUnavailableError",
|
|
54
|
+
"GatewayVersionError",
|
|
55
|
+
"resolve_key",
|
|
56
|
+
"save_key_to_config",
|
|
57
|
+
"Tier",
|
|
58
|
+
"Capability",
|
|
59
|
+
"is_allowed",
|
|
60
|
+
"allowed_capabilities",
|
|
61
|
+
"CAPABILITY_MIN_TIER",
|
|
62
|
+
"ValidateRequest",
|
|
63
|
+
"ValidateResponse",
|
|
64
|
+
"ValidationResult",
|
|
65
|
+
"RiskResult",
|
|
66
|
+
"DecisionResult",
|
|
67
|
+
"ToolCall",
|
|
68
|
+
"drain_queue",
|
|
69
|
+
"auto_instrument",
|
|
70
|
+
"auto_wrap",
|
|
71
|
+
"__version__",
|
|
72
|
+
]
|