agentctrl 0.2.0__tar.gz → 0.2.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 (38) hide show
  1. agentctrl-0.2.1/.github/workflows/ci.yml +66 -0
  2. agentctrl-0.2.1/.gitignore +9 -0
  3. agentctrl-0.2.1/CHANGELOG.md +61 -0
  4. agentctrl-0.2.1/CONTRIBUTING.md +91 -0
  5. agentctrl-0.2.1/LICENSE +190 -0
  6. {agentctrl-0.2.0 → agentctrl-0.2.1}/PKG-INFO +7 -6
  7. {agentctrl-0.2.0 → agentctrl-0.2.1}/README.md +4 -4
  8. agentctrl-0.2.1/SECURITY.md +46 -0
  9. {agentctrl-0.2.0 → agentctrl-0.2.1}/examples/inbound_governance.py +14 -0
  10. {agentctrl-0.2.0 → agentctrl-0.2.1}/pyproject.toml +2 -2
  11. {agentctrl-0.2.0 → agentctrl-0.2.1}/src/agentctrl/__main__.py +1 -1
  12. {agentctrl-0.2.0 → agentctrl-0.2.1}/src/agentctrl/cli.py +1 -1
  13. {agentctrl-0.2.0 → agentctrl-0.2.1}/src/agentctrl/decorator.py +2 -0
  14. {agentctrl-0.2.0 → agentctrl-0.2.1}/src/agentctrl/risk_engine.py +13 -2
  15. {agentctrl-0.2.0 → agentctrl-0.2.1}/tests/test_decorator.py +3 -1
  16. {agentctrl-0.2.0 → agentctrl-0.2.1}/tests/test_parity_features.py +8 -4
  17. {agentctrl-0.2.0 → agentctrl-0.2.1}/tests/test_pipeline.py +1 -0
  18. {agentctrl-0.2.0 → agentctrl-0.2.1}/tests/test_risk_engine.py +39 -0
  19. {agentctrl-0.2.0 → agentctrl-0.2.1}/tests/test_v02_features.py +2 -1
  20. agentctrl-0.2.0/.gitignore +0 -76
  21. agentctrl-0.2.0/uv.lock +0 -4019
  22. {agentctrl-0.2.0 → agentctrl-0.2.1}/examples/bare_python.py +0 -0
  23. {agentctrl-0.2.0 → agentctrl-0.2.1}/examples/langchain_tool.py +0 -0
  24. {agentctrl-0.2.0 → agentctrl-0.2.1}/examples/openai_function_call.py +0 -0
  25. {agentctrl-0.2.0 → agentctrl-0.2.1}/src/agentctrl/__init__.py +0 -0
  26. {agentctrl-0.2.0 → agentctrl-0.2.1}/src/agentctrl/adapters/__init__.py +0 -0
  27. {agentctrl-0.2.0 → agentctrl-0.2.1}/src/agentctrl/adapters/crewai.py +0 -0
  28. {agentctrl-0.2.0 → agentctrl-0.2.1}/src/agentctrl/adapters/langchain.py +0 -0
  29. {agentctrl-0.2.0 → agentctrl-0.2.1}/src/agentctrl/adapters/openai_agents.py +0 -0
  30. {agentctrl-0.2.0 → agentctrl-0.2.1}/src/agentctrl/authority_graph.py +0 -0
  31. {agentctrl-0.2.0 → agentctrl-0.2.1}/src/agentctrl/conflict_detector.py +0 -0
  32. {agentctrl-0.2.0 → agentctrl-0.2.1}/src/agentctrl/policy_engine.py +0 -0
  33. {agentctrl-0.2.0 → agentctrl-0.2.1}/src/agentctrl/py.typed +0 -0
  34. {agentctrl-0.2.0 → agentctrl-0.2.1}/src/agentctrl/runtime_gateway.py +0 -0
  35. {agentctrl-0.2.0 → agentctrl-0.2.1}/src/agentctrl/types.py +0 -0
  36. {agentctrl-0.2.0 → agentctrl-0.2.1}/tests/test_authority_graph.py +0 -0
  37. {agentctrl-0.2.0 → agentctrl-0.2.1}/tests/test_boundary.py +0 -0
  38. {agentctrl-0.2.0 → agentctrl-0.2.1}/tests/test_policy_engine.py +0 -0
@@ -0,0 +1,66 @@
1
+ name: CI
2
+
3
+ on:
4
+ push:
5
+ branches: [main]
6
+ pull_request:
7
+ branches: [main]
8
+
9
+ jobs:
10
+ test:
11
+ runs-on: ubuntu-latest
12
+ strategy:
13
+ matrix:
14
+ python-version: ["3.11", "3.12", "3.13"]
15
+
16
+ steps:
17
+ - uses: actions/checkout@v4
18
+
19
+ - name: Install uv
20
+ uses: astral-sh/setup-uv@v4
21
+
22
+ - name: Set up Python ${{ matrix.python-version }}
23
+ run: uv python install ${{ matrix.python-version }}
24
+
25
+ - name: Install dependencies
26
+ run: uv sync --extra dev --extra authority-graph
27
+
28
+ - name: Run tests
29
+ run: uv run pytest tests/ -v
30
+
31
+ lint:
32
+ runs-on: ubuntu-latest
33
+ steps:
34
+ - uses: actions/checkout@v4
35
+
36
+ - name: Install uv
37
+ uses: astral-sh/setup-uv@v4
38
+
39
+ - name: Set up Python
40
+ run: uv python install 3.13
41
+
42
+ - name: Install dependencies
43
+ run: uv sync --extra dev
44
+
45
+ - name: Lint with ruff
46
+ run: uv run ruff check src/
47
+
48
+ build:
49
+ runs-on: ubuntu-latest
50
+ steps:
51
+ - uses: actions/checkout@v4
52
+
53
+ - name: Install uv
54
+ uses: astral-sh/setup-uv@v4
55
+
56
+ - name: Set up Python
57
+ run: uv python install 3.13
58
+
59
+ - name: Build package
60
+ run: uvx hatch build
61
+
62
+ - name: Verify wheel contents
63
+ run: |
64
+ uv venv /tmp/verify-venv
65
+ uv pip install dist/*.whl --python /tmp/verify-venv/bin/python
66
+ /tmp/verify-venv/bin/python -c "from agentctrl import RuntimeGateway; print('Import OK')"
@@ -0,0 +1,9 @@
1
+ __pycache__/
2
+ *.py[cod]
3
+ *.egg-info/
4
+ dist/
5
+ build/
6
+ .venv/
7
+ .pytest_cache/
8
+ *.lock
9
+ .ruff_cache/
@@ -0,0 +1,61 @@
1
+ # Changelog
2
+
3
+ All notable changes to `agentctrl` will be documented in this file.
4
+
5
+ Format follows [Keep a Changelog](https://keepachangelog.com/en/1.1.0/). This project uses [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
6
+
7
+ ---
8
+
9
+ ## [0.2.1] — 2026-04-11
10
+
11
+ ### Added
12
+ - **Bidirectional trust calibration.** New agents (< 5 governed actions) receive a +0.35 risk surcharge, pushing routine actions into ESCALATE territory. Proven agents (50+ actions, >90% success rate) receive up to 15% risk discount.
13
+ - `trust_context` parameter on the `@governed` decorator — pass `{"total_actions": N, "success_rate": R}` to influence trust calibration.
14
+ - 2 new tests: `test_new_agent_premium`, `test_new_agent_premium_bypassed_after_threshold`.
15
+ - Apache-2.0 license header on `examples/inbound_governance.py`.
16
+ - `CONTRIBUTING.md` — library-scoped contribution guide.
17
+ - `SECURITY.md` — vulnerability reporting and security model.
18
+ - This `CHANGELOG.md`.
19
+
20
+ ### Changed
21
+ - Risk scoring dimensions documented as 13 (was incorrectly stated as 9 in README).
22
+ - Test count updated to 76 (was 74 before trust calibration tests).
23
+
24
+ ### Fixed
25
+ - README: "nine factors" corrected to "13 dimensions" to match actual `score()` implementation.
26
+
27
+ ---
28
+
29
+ ## [0.2.0] — 2026-04-10
30
+
31
+ ### Added
32
+ - CLI: `agentctrl demo`, `agentctrl validate`, `agentctrl init`.
33
+ - JSONL audit logging via `PipelineHooks`.
34
+ - `RuntimeDecisionRecord` — subscriptable (`record["decision"]`) and attribute-accessible (`record.decision`).
35
+ - Inbound governance example (`examples/inbound_governance.py`).
36
+ - Instance isolation — multiple `RuntimeGateway` instances with independent config.
37
+ - 76 tests (up from initial release).
38
+
39
+ ### Changed
40
+ - Core pipeline tightened: fail-closed invariant enforced at three levels.
41
+ - Trust calibration discount for proven agents (50+ actions, >90% success).
42
+ - Consequence class floors (irreversible actions never score LOW).
43
+ - Factor interaction multiplier (3+ concurrent factors trigger compounding).
44
+
45
+ ---
46
+
47
+ ## [0.1.0] — 2026-04-07
48
+
49
+ ### Added
50
+ - Initial release.
51
+ - 5-stage governance pipeline: Kill Switch → Rate Limiter → Policy Engine → Authority Graph → Risk Engine.
52
+ - `RuntimeGateway` — the main entry point.
53
+ - `PolicyEngine` — AND/OR groups, 14 operators, temporal conditions.
54
+ - `AuthorityGraphEngine` — NetworkX delegation, SoD, decay, time-bound edges.
55
+ - `RiskEngine` — factor-based scoring with configurable weights.
56
+ - `ConflictDetector` — resource contention checking.
57
+ - `@governed` decorator for enforcement.
58
+ - SDK adapters: LangChain, OpenAI Agents SDK, CrewAI.
59
+ - 4 runnable examples.
60
+ - Zero required dependencies.
61
+ - Apache-2.0 license.
@@ -0,0 +1,91 @@
1
+ # Contributing to agentctrl
2
+
3
+ Thanks for your interest in contributing to `agentctrl` — the institutional governance layer for AI agents.
4
+
5
+ ---
6
+
7
+ ## Quick Start
8
+
9
+ ```bash
10
+ git clone https://github.com/moeintel/AgentCTRL.git
11
+ cd AgentCTRL
12
+ pip install -e ".[dev,all]"
13
+ python -m pytest tests/ -v
14
+ ```
15
+
16
+ ---
17
+
18
+ ## Development Setup
19
+
20
+ **Requirements:** Python 3.11+
21
+
22
+ ```bash
23
+ pip install -e ".[dev,all]"
24
+ ```
25
+
26
+ This installs the library in editable mode with all optional dependencies (networkx, langchain-core, openai-agents, crewai) and dev tools (pytest, pytest-asyncio, ruff).
27
+
28
+ ---
29
+
30
+ ## Running Tests
31
+
32
+ ```bash
33
+ python -m pytest tests/ -v
34
+ ```
35
+
36
+ All 76 tests should pass. No external services required — everything runs in-process.
37
+
38
+ ---
39
+
40
+ ## Linting
41
+
42
+ ```bash
43
+ ruff check src/ tests/
44
+ ```
45
+
46
+ ---
47
+
48
+ ## Making Changes
49
+
50
+ ### Before you start
51
+
52
+ 1. Check existing issues and discussions to avoid duplicate work.
53
+ 2. For larger changes, open an issue first to discuss the approach.
54
+
55
+ ### Guidelines
56
+
57
+ - **Keep the library self-contained.** Zero required dependencies. No imports from external packages in the core library (adapters are the exception — they use lazy imports).
58
+ - **Write tests.** Every new feature or bug fix should include tests.
59
+ - **Preserve the fail-closed invariant.** Any error in the governance pipeline must produce BLOCK, never silent ALLOW.
60
+ - **Type hints everywhere.** The library is PEP 561 typed.
61
+
62
+ ### Pull request process
63
+
64
+ 1. Fork the repository
65
+ 2. Create a feature branch (`git checkout -b my-feature`)
66
+ 3. Make your changes
67
+ 4. Ensure all tests pass
68
+ 5. Ensure linting passes
69
+ 6. Submit a pull request with a clear description of what and why
70
+
71
+ ---
72
+
73
+ ## Areas Where Contributions Are Welcome
74
+
75
+ - **More tests** — edge cases for policy engine, authority graph, risk scoring
76
+ - **Integration examples** — additional `examples/` scripts showing `agentctrl` with different agent frameworks
77
+ - **Documentation** — usage guides, tutorials, integration walkthroughs
78
+ - **Bug reports** — especially around edge cases in policy evaluation or authority resolution
79
+ - **Adapter coverage** — new framework adapters in `src/agentctrl/adapters/`
80
+
81
+ ---
82
+
83
+ ## Code of Conduct
84
+
85
+ Be respectful, constructive, and professional. We're building governance infrastructure — the bar for quality and honesty is high.
86
+
87
+ ---
88
+
89
+ ## Questions?
90
+
91
+ Open an issue on [GitHub](https://github.com/moeintel/AgentCTRL/issues).
@@ -0,0 +1,190 @@
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 the 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 the 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 any 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
+ Copyright 2026 MoeIntel
179
+
180
+ Licensed under the Apache License, Version 2.0 (the "License");
181
+ you may not use this file except in compliance with the License.
182
+ You may obtain a copy of the License at
183
+
184
+ http://www.apache.org/licenses/LICENSE-2.0
185
+
186
+ Unless required by applicable law or agreed to in writing, software
187
+ distributed under the License is distributed on an "AS IS" BASIS,
188
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
189
+ See the License for the specific language governing permissions and
190
+ limitations under the License.
@@ -1,12 +1,13 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: agentctrl
3
- Version: 0.2.0
3
+ Version: 0.2.1
4
4
  Summary: Institutional control layer for AI agent actions — authority, policy, risk, and audit before execution.
5
- Project-URL: Homepage, https://moeintel.com
5
+ Project-URL: Homepage, https://moeintel.ai
6
6
  Project-URL: Repository, https://github.com/moeintel/AgentCTRL
7
7
  Project-URL: Issues, https://github.com/moeintel/AgentCTRL/issues
8
8
  Author: MoeIntel
9
9
  License-Expression: Apache-2.0
10
+ License-File: LICENSE
10
11
  Keywords: ai-agents,authority,crewai,governance,langchain,openai,policy-engine,risk-scoring
11
12
  Classifier: Development Status :: 3 - Alpha
12
13
  Classifier: Intended Audience :: Developers
@@ -116,7 +117,7 @@ Those are institutional controls. They existed for human employees. They need to
116
117
  - **Fail-closed.** Any pipeline error produces BLOCK, never silent approval.
117
118
  - **Structural enforcement.** Policies are operator-based rule matching, not prompt instructions. Authority is graph traversal. Risk is weighted factor scoring. None of this is prompt engineering.
118
119
 
119
- > **Status:** 74 tests passing. Published on [PyPI](https://pypi.org/project/agentctrl/).
120
+ > **Status:** 76 tests passing. Published on [PyPI](https://pypi.org/project/agentctrl/).
120
121
 
121
122
  ---
122
123
 
@@ -359,7 +360,7 @@ Authority is opt-in. When no graph is configured, the authority check passes. Co
359
360
 
360
361
  ### Risk Scoring
361
362
 
362
- Deterministic factor-based scoring. Nine factors: high-value transaction, novel vendor, off-hours activity, data sensitivity, rate pressure, velocity, behavioral anomaly, cumulative exposure, input confidence. Plus consequence class floors (irreversible actions never score LOW) and trust calibration discounts (agents with 50+ governed actions and >90% success rate earn up to 15% reduction).
363
+ Deterministic factor-based scoring across 13 dimensions: base action risk, high-value transaction, novel vendor, off-hours activity, data sensitivity, rate pressure, velocity, behavioral anomaly, cumulative exposure, input confidence, trust calibration (agents with 50+ governed actions and >90% success rate earn up to 15% reduction), factor interaction (3+ concurrent factors trigger compounding), and consequence class floors (irreversible actions never score LOW).
363
364
 
364
365
  ### Conflict Detection
365
366
 
@@ -440,7 +441,7 @@ result = await gateway.validate(proposal)
440
441
  python -m pytest tests/ -v
441
442
  ```
442
443
 
443
- 74 tests covering: pipeline stages, fail-closed behavior, policy evaluation (AND/OR groups, 14 operators, temporal conditions), authority graph (delegation, SoD, limits, decay), risk scoring (9 factors, trust calibration, consequence class), conflict detection, `@governed` decorator, CLI, demo, audit logging, subscriptable record, empty authority default, instance isolation, and library boundary.
444
+ 76 tests covering: pipeline stages, fail-closed behavior, policy evaluation (AND/OR groups, 14 operators, temporal conditions), authority graph (delegation, SoD, limits, decay), risk scoring (13 dimensions, trust calibration, consequence class), conflict detection, `@governed` decorator, CLI, demo, audit logging, subscriptable record, empty authority default, instance isolation, and library boundary.
444
445
 
445
446
  ## Requirements
446
447
 
@@ -455,4 +456,4 @@ python -m pytest tests/ -v
455
456
 
456
457
  ---
457
458
 
458
- Built by [MoeIntel](https://moeintel.com). Created by [Mohammad Abu Jafar](https://github.com/moeadnan). [GitHub](https://github.com/moeintel/AgentCTRL)
459
+ Built by [MoeIntel](https://moeintel.ai). Created by [Mohammad Abu Jafar](https://github.com/moeadnan). [GitHub](https://github.com/moeintel/AgentCTRL)
@@ -76,7 +76,7 @@ Those are institutional controls. They existed for human employees. They need to
76
76
  - **Fail-closed.** Any pipeline error produces BLOCK, never silent approval.
77
77
  - **Structural enforcement.** Policies are operator-based rule matching, not prompt instructions. Authority is graph traversal. Risk is weighted factor scoring. None of this is prompt engineering.
78
78
 
79
- > **Status:** 74 tests passing. Published on [PyPI](https://pypi.org/project/agentctrl/).
79
+ > **Status:** 76 tests passing. Published on [PyPI](https://pypi.org/project/agentctrl/).
80
80
 
81
81
  ---
82
82
 
@@ -319,7 +319,7 @@ Authority is opt-in. When no graph is configured, the authority check passes. Co
319
319
 
320
320
  ### Risk Scoring
321
321
 
322
- Deterministic factor-based scoring. Nine factors: high-value transaction, novel vendor, off-hours activity, data sensitivity, rate pressure, velocity, behavioral anomaly, cumulative exposure, input confidence. Plus consequence class floors (irreversible actions never score LOW) and trust calibration discounts (agents with 50+ governed actions and >90% success rate earn up to 15% reduction).
322
+ Deterministic factor-based scoring across 13 dimensions: base action risk, high-value transaction, novel vendor, off-hours activity, data sensitivity, rate pressure, velocity, behavioral anomaly, cumulative exposure, input confidence, trust calibration (agents with 50+ governed actions and >90% success rate earn up to 15% reduction), factor interaction (3+ concurrent factors trigger compounding), and consequence class floors (irreversible actions never score LOW).
323
323
 
324
324
  ### Conflict Detection
325
325
 
@@ -400,7 +400,7 @@ result = await gateway.validate(proposal)
400
400
  python -m pytest tests/ -v
401
401
  ```
402
402
 
403
- 74 tests covering: pipeline stages, fail-closed behavior, policy evaluation (AND/OR groups, 14 operators, temporal conditions), authority graph (delegation, SoD, limits, decay), risk scoring (9 factors, trust calibration, consequence class), conflict detection, `@governed` decorator, CLI, demo, audit logging, subscriptable record, empty authority default, instance isolation, and library boundary.
403
+ 76 tests covering: pipeline stages, fail-closed behavior, policy evaluation (AND/OR groups, 14 operators, temporal conditions), authority graph (delegation, SoD, limits, decay), risk scoring (13 dimensions, trust calibration, consequence class), conflict detection, `@governed` decorator, CLI, demo, audit logging, subscriptable record, empty authority default, instance isolation, and library boundary.
404
404
 
405
405
  ## Requirements
406
406
 
@@ -415,4 +415,4 @@ python -m pytest tests/ -v
415
415
 
416
416
  ---
417
417
 
418
- Built by [MoeIntel](https://moeintel.com). Created by [Mohammad Abu Jafar](https://github.com/moeadnan). [GitHub](https://github.com/moeintel/AgentCTRL)
418
+ Built by [MoeIntel](https://moeintel.ai). Created by [Mohammad Abu Jafar](https://github.com/moeadnan). [GitHub](https://github.com/moeintel/AgentCTRL)
@@ -0,0 +1,46 @@
1
+ # Security Policy
2
+
3
+ ## Reporting a Vulnerability
4
+
5
+ If you discover a security vulnerability in `agentctrl`, please report it responsibly.
6
+
7
+ **Do not open a public GitHub issue for security vulnerabilities.**
8
+
9
+ Instead, use [GitHub's private security advisory feature](https://github.com/moeintel/AgentCTRL/security/advisories/new) or email **security@moeintel.ai**.
10
+
11
+ Include:
12
+ - Description of the vulnerability
13
+ - Steps to reproduce
14
+ - Potential impact
15
+ - Suggested fix (if you have one)
16
+
17
+ We will acknowledge receipt within 48 hours and provide a fix or mitigation plan within 7 days for critical issues.
18
+
19
+ ---
20
+
21
+ ## Security Model
22
+
23
+ `agentctrl` is a governance enforcement library. It evaluates agent actions against policies, authority graphs, and risk scores, then returns ALLOW / ESCALATE / BLOCK decisions.
24
+
25
+ ### What agentctrl enforces
26
+
27
+ - **Fail-closed design.** Any error in the governance pipeline produces BLOCK, never ALLOW. Three independent layers enforce this (gateway catch, stage-level catch, top-level catch).
28
+ - **Deterministic evaluation.** Policy matching, authority resolution, and risk scoring are all deterministic — no LLM calls, no prompt engineering, no probabilistic behavior.
29
+ - **Structural enforcement.** Policies use operator-based rule matching. Authority is graph traversal. Risk is weighted factor scoring. None of this is prompt-based.
30
+
31
+ ### What agentctrl does NOT enforce
32
+
33
+ - **Caller identity verification.** `agent_id` is a self-declared string. The library does not verify that the caller actually is that agent. Your application is responsible for identity.
34
+ - **Bypass prevention.** If a tool is called directly without going through `RuntimeGateway` or `@governed`, agentctrl has no visibility. Governance only covers actions routed through the library.
35
+ - **Persistence.** The library is stateless by default. Rate limiting uses in-memory counters that reset on restart. For durable state, integrate with your own storage.
36
+
37
+ ---
38
+
39
+ ## Supported Versions
40
+
41
+ | Version | Supported |
42
+ |---------|-----------|
43
+ | 0.2.x | Yes |
44
+ | < 0.2 | No |
45
+
46
+ Security fixes will be applied to the latest release.
@@ -1,3 +1,17 @@
1
+ # Copyright 2026 MoeIntel
2
+ #
3
+ # Licensed under the Apache License, Version 2.0 (the "License");
4
+ # you may not use this file except in compliance with the License.
5
+ # You may obtain a copy of the License at
6
+ #
7
+ # http://www.apache.org/licenses/LICENSE-2.0
8
+ #
9
+ # Unless required by applicable law or agreed to in writing, software
10
+ # distributed under the License is distributed on an "AS IS" BASIS,
11
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
+ # See the License for the specific language governing permissions and
13
+ # limitations under the License.
14
+
1
15
  """Inbound governance — controlling what external agents can do in YOUR system.
2
16
 
3
17
  This example shows how to use agentctrl to govern actions initiated by external
@@ -4,7 +4,7 @@ build-backend = "hatchling.build"
4
4
 
5
5
  [project]
6
6
  name = "agentctrl"
7
- version = "0.2.0"
7
+ version = "0.2.1"
8
8
  description = "Institutional control layer for AI agent actions — authority, policy, risk, and audit before execution."
9
9
  readme = "README.md"
10
10
  license = "Apache-2.0"
@@ -40,7 +40,7 @@ classifiers = [
40
40
  agentctrl = "agentctrl.cli:main"
41
41
 
42
42
  [project.urls]
43
- Homepage = "https://moeintel.com"
43
+ Homepage = "https://moeintel.ai"
44
44
  Repository = "https://github.com/moeintel/AgentCTRL"
45
45
  Issues = "https://github.com/moeintel/AgentCTRL/issues"
46
46
 
@@ -233,7 +233,7 @@ def _print_footer(results: list):
233
233
  print(f" {DIM}5 stages × {len(results)} proposals = every action evaluated through:{RESET}")
234
234
  print(f" {DIM}autonomy → policy → authority → risk → conflict{RESET}")
235
235
  print()
236
- print(f" {WHITE}pip install agentctrl{RESET} {DIM}·{RESET} {WHITE}github.com/moeintel/agentctrl{RESET}")
236
+ print(f" {WHITE}pip install agentctrl{RESET} {DIM}·{RESET} {WHITE}github.com/moeintel/AgentCTRL{RESET}")
237
237
  print()
238
238
 
239
239
 
@@ -155,7 +155,7 @@ def cmd_init(args):
155
155
  print()
156
156
  print("Quick start:")
157
157
  print(f' agentctrl validate --policies {target / "policies.json"} \\')
158
- print(f' \'{{"agent_id": "analyst", "action_type": "invoice.approve", "action_params": {{"amount": 6000}}}}\'')
158
+ print(' \'{"agent_id": "analyst", "action_type": "invoice.approve", "action_params": {"amount": 6000}}\'')
159
159
  else:
160
160
  print("No files created (all already exist).")
161
161
 
@@ -27,6 +27,7 @@ def governed(
27
27
  agent_id: str,
28
28
  autonomy_level: int = 2,
29
29
  action_type: str | None = None,
30
+ trust_context: dict | None = None,
30
31
  ):
31
32
  """Decorator that wraps an async function with governance evaluation.
32
33
 
@@ -53,6 +54,7 @@ def governed(
53
54
  action_type=resolved_action_type,
54
55
  action_params=action_params,
55
56
  autonomy_level=autonomy_level,
57
+ trust_context=trust_context,
56
58
  )
57
59
 
58
60
  result = await gateway.validate(proposal)
@@ -198,11 +198,22 @@ class RiskEngine:
198
198
  "value": f"Daily exposure: ${daily_exposure:,.0f} (threshold: ${exp_threshold:,.0f})",
199
199
  })
200
200
 
201
- # Trust calibration — agents with demonstrated reliability get a risk discount.
201
+ # Trust calibration — bidirectional risk adjustment based on agent track record.
202
+ # New agents (< new_agent_threshold actions) receive a risk surcharge.
203
+ # Proven agents (50+ actions, >90% success) receive a risk discount.
202
204
  trust_ctx = getattr(proposal, "trust_context", None) or {}
203
205
  trust_total_actions = trust_ctx.get("total_actions", 0)
204
206
  trust_success_rate = trust_ctx.get("success_rate", 0.0)
205
- if trust_total_actions >= 50 and trust_success_rate > 0.90:
207
+ new_agent_threshold = self._factors.get("new_agent_premium", {}).get("threshold", 5)
208
+ new_agent_weight = self._factors.get("new_agent_premium", {}).get("weight", 0.35)
209
+ if trust_total_actions < new_agent_threshold:
210
+ total += new_agent_weight
211
+ factors.append({
212
+ "factor": "trust_calibration",
213
+ "contribution": round(new_agent_weight, 3),
214
+ "value": f"New agent — {trust_total_actions} prior actions (threshold: {new_agent_threshold})",
215
+ })
216
+ elif trust_total_actions >= 50 and trust_success_rate > 0.90:
206
217
  trust_discount = min(0.15, (trust_success_rate - 0.90) * 1.5)
207
218
  total = max(0.01, total - trust_discount)
208
219
  factors.append({
@@ -26,7 +26,9 @@ async def test_governed_execute_happy_path():
26
26
 
27
27
  gateway = RuntimeGateway()
28
28
 
29
- @governed(gateway=gateway, agent_id="ap_analyst", autonomy_level=2, action_type="invoice.approve")
29
+ @governed(gateway=gateway, agent_id="ap_analyst", autonomy_level=2,
30
+ action_type="invoice.approve",
31
+ trust_context={"total_actions": 10, "success_rate": 0.95})
30
32
  async def approve_invoice(amount: float):
31
33
  return {"ok": True, "amount": amount}
32
34