agentcontainment 0.1.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.
- agentcontainment-0.1.0/LICENSE +87 -0
- agentcontainment-0.1.0/PKG-INFO +364 -0
- agentcontainment-0.1.0/README.md +337 -0
- agentcontainment-0.1.0/pyproject.toml +56 -0
- agentcontainment-0.1.0/setup.cfg +4 -0
- agentcontainment-0.1.0/src/agent_containment/__init__.py +31 -0
- agentcontainment-0.1.0/src/agent_containment/agent_tree.py +102 -0
- agentcontainment-0.1.0/src/agent_containment/attack_harness.py +44 -0
- agentcontainment-0.1.0/src/agent_containment/audit.py +94 -0
- agentcontainment-0.1.0/src/agent_containment/blast_radius.py +17 -0
- agentcontainment-0.1.0/src/agent_containment/bootstrap.py +33 -0
- agentcontainment-0.1.0/src/agent_containment/cgroup_enforcer.py +154 -0
- agentcontainment-0.1.0/src/agent_containment/cilium_enforcer.py +338 -0
- agentcontainment-0.1.0/src/agent_containment/client.py +90 -0
- agentcontainment-0.1.0/src/agent_containment/containment.py +209 -0
- agentcontainment-0.1.0/src/agent_containment/control.py +660 -0
- agentcontainment-0.1.0/src/agent_containment/credentials.py +41 -0
- agentcontainment-0.1.0/src/agent_containment/daemon.py +56 -0
- agentcontainment-0.1.0/src/agent_containment/dprovenancekit_adapter.py +113 -0
- agentcontainment-0.1.0/src/agent_containment/egress.py +91 -0
- agentcontainment-0.1.0/src/agent_containment/egress_enforcement.py +170 -0
- agentcontainment-0.1.0/src/agent_containment/enforcer.py +90 -0
- agentcontainment-0.1.0/src/agent_containment/evidence_chain.py +180 -0
- agentcontainment-0.1.0/src/agent_containment/gateway.py +72 -0
- agentcontainment-0.1.0/src/agent_containment/governance_event.py +51 -0
- agentcontainment-0.1.0/src/agent_containment/incident.py +47 -0
- agentcontainment-0.1.0/src/agent_containment/incident_evidence.py +110 -0
- agentcontainment-0.1.0/src/agent_containment/incident_state.py +247 -0
- agentcontainment-0.1.0/src/agent_containment/linux_supervisor.py +87 -0
- agentcontainment-0.1.0/src/agent_containment/models.py +27 -0
- agentcontainment-0.1.0/src/agent_containment/policy.py +71 -0
- agentcontainment-0.1.0/src/agent_containment/process.py +28 -0
- agentcontainment-0.1.0/src/agent_containment/provenance.py +94 -0
- agentcontainment-0.1.0/src/agent_containment/regression.py +175 -0
- agentcontainment-0.1.0/src/agent_containment/regression_replay.py +74 -0
- agentcontainment-0.1.0/src/agent_containment/review.py +38 -0
- agentcontainment-0.1.0/src/agent_containment/runtime.py +149 -0
- agentcontainment-0.1.0/src/agent_containment/runtime_fence.py +102 -0
- agentcontainment-0.1.0/src/agent_containment/transport.py +281 -0
- agentcontainment-0.1.0/src/agent_containment/verification_signal.py +103 -0
- agentcontainment-0.1.0/src/agent_containment/warden_observation.py +79 -0
- agentcontainment-0.1.0/src/agent_containment/warden_observer.py +43 -0
- agentcontainment-0.1.0/src/agentcontainment.egg-info/PKG-INFO +364 -0
- agentcontainment-0.1.0/src/agentcontainment.egg-info/SOURCES.txt +85 -0
- agentcontainment-0.1.0/src/agentcontainment.egg-info/dependency_links.txt +1 -0
- agentcontainment-0.1.0/src/agentcontainment.egg-info/top_level.txt +1 -0
- agentcontainment-0.1.0/tests/test_adversarial.py +96 -0
- agentcontainment-0.1.0/tests/test_adversarial_evidence.py +83 -0
- agentcontainment-0.1.0/tests/test_agent_tree.py +62 -0
- agentcontainment-0.1.0/tests/test_agent_tree_races.py +75 -0
- agentcontainment-0.1.0/tests/test_audit.py +76 -0
- agentcontainment-0.1.0/tests/test_bootstrap.py +21 -0
- agentcontainment-0.1.0/tests/test_cgroup_enforcer.py +63 -0
- agentcontainment-0.1.0/tests/test_cilium_enforcer.py +194 -0
- agentcontainment-0.1.0/tests/test_client.py +47 -0
- agentcontainment-0.1.0/tests/test_containment.py +67 -0
- agentcontainment-0.1.0/tests/test_containment_races.py +82 -0
- agentcontainment-0.1.0/tests/test_control.py +208 -0
- agentcontainment-0.1.0/tests/test_controller_restart_boundary.py +62 -0
- agentcontainment-0.1.0/tests/test_credential_containment.py +81 -0
- agentcontainment-0.1.0/tests/test_credentials.py +32 -0
- agentcontainment-0.1.0/tests/test_dprovenancekit_adapter.py +118 -0
- agentcontainment-0.1.0/tests/test_durable_restart_fence.py +98 -0
- agentcontainment-0.1.0/tests/test_ebpf_artifacts.py +21 -0
- agentcontainment-0.1.0/tests/test_egress.py +102 -0
- agentcontainment-0.1.0/tests/test_egress_enforcement.py +64 -0
- agentcontainment-0.1.0/tests/test_enforcement_latency.py +40 -0
- agentcontainment-0.1.0/tests/test_enforcer_boundary.py +105 -0
- agentcontainment-0.1.0/tests/test_escape_resistance.py +148 -0
- agentcontainment-0.1.0/tests/test_evidence_chain.py +106 -0
- agentcontainment-0.1.0/tests/test_failure_injection.py +107 -0
- agentcontainment-0.1.0/tests/test_governance_events.py +71 -0
- agentcontainment-0.1.0/tests/test_incident.py +24 -0
- agentcontainment-0.1.0/tests/test_incident_evidence.py +86 -0
- agentcontainment-0.1.0/tests/test_incident_recovery.py +52 -0
- agentcontainment-0.1.0/tests/test_incident_state.py +52 -0
- agentcontainment-0.1.0/tests/test_linux_supervisor.py +26 -0
- agentcontainment-0.1.0/tests/test_policy.py +49 -0
- agentcontainment-0.1.0/tests/test_process_containment.py +12 -0
- agentcontainment-0.1.0/tests/test_provenance.py +39 -0
- agentcontainment-0.1.0/tests/test_recovery_adversarial.py +84 -0
- agentcontainment-0.1.0/tests/test_regression.py +86 -0
- agentcontainment-0.1.0/tests/test_regression_replay.py +40 -0
- agentcontainment-0.1.0/tests/test_service_recovery.py +376 -0
- agentcontainment-0.1.0/tests/test_transport.py +304 -0
- agentcontainment-0.1.0/tests/test_verification_signal.py +288 -0
- agentcontainment-0.1.0/tests/test_warden_observation.py +180 -0
|
@@ -0,0 +1,87 @@
|
|
|
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, and distribution as defined by Sections 1 through 9 of this document.
|
|
10
|
+
|
|
11
|
+
"Licensor" shall mean the copyright owner or entity authorized by the copyright owner that is granting the License.
|
|
12
|
+
|
|
13
|
+
"Legal Entity" shall mean the union of the acting entity and all other entities that control, are controlled by, or are under common control with that entity. For the purposes of this definition, "control" means (i) the power, direct or indirect, to cause the direction or management of such entity, or (ii) ownership of fifty percent (50%) or more of the outstanding shares, or (iii) beneficial ownership of fifty percent (50%) or more of the outstanding shares, or (iv) beneficial ownership of fifty percent (50%) or more of the outstanding shares.
|
|
14
|
+
|
|
15
|
+
"You" (or "Your") shall mean an individual or Legal Entity exercising permissions granted by this License.
|
|
16
|
+
|
|
17
|
+
"Source" form shall mean the preferred form for making modifications, including but not limited to software source code, documentation source, and configuration files.
|
|
18
|
+
|
|
19
|
+
"Object" form shall mean any form resulting from mechanical transformation or translation of a Source form, including but not limited to compiled object code, generated documentation, and conversions to other media types.
|
|
20
|
+
|
|
21
|
+
"Work" shall mean the work of authorship, whether in Source or Object form, made available under the License, as indicated by a copyright notice that is included in or attached to the work.
|
|
22
|
+
|
|
23
|
+
"Derivative Works" shall mean any work, whether in Source or Object form, that is based on (or derived from) the Work and for which the editorial revisions, annotations, elaborations, or other modifications represent, as a whole, an original work of authorship.
|
|
24
|
+
|
|
25
|
+
"Contribution" shall mean any work of authorship, including the original version of the Work and any modifications or additions to that Work or Derivative Works thereof, that is intentionally submitted to Licensor for inclusion in the Work by the copyright owner or by an individual or Legal Entity authorized to submit on behalf of the copyright owner.
|
|
26
|
+
|
|
27
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity on behalf of whom a Contribution has been received by Licensor and subsequently incorporated within the Work.
|
|
28
|
+
|
|
29
|
+
2. Grant of Copyright License.
|
|
30
|
+
|
|
31
|
+
Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable copyright license to reproduce, prepare Derivative Works of, publicly display, publicly perform, sublicense, and distribute the Work and such Derivative Works in Source or Object form.
|
|
32
|
+
|
|
33
|
+
3. Grant of Patent License.
|
|
34
|
+
|
|
35
|
+
Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable (except as stated in this section) patent license to make, have made, use, offer to sell, sell, import, and otherwise transfer the Work.
|
|
36
|
+
|
|
37
|
+
4. Redistribution.
|
|
38
|
+
|
|
39
|
+
You may reproduce and distribute copies of the Work or Derivative Works thereof in any medium, with or without modifications, provided that You meet the following conditions:
|
|
40
|
+
|
|
41
|
+
(a) You must give any other recipients of the Work or Derivative Works a copy of this License; and
|
|
42
|
+
|
|
43
|
+
(b) You must cause any modified files to carry prominent notices stating that You changed the files; and
|
|
44
|
+
|
|
45
|
+
(c) You must retain, in the Source form of any Derivative Works that You distribute, all copyright, patent, trademark, and attribution notices from the Source form of the Work, excluding those notices that do not pertain to any part of the Derivative Works; and
|
|
46
|
+
|
|
47
|
+
(d) If the Work includes a "NOTICE" text file as part of its distribution, then any Derivative Works that You distribute must include a readable copy of the attribution notices contained within such NOTICE file, excluding those notices that do not pertain to any part of the Derivative Works, in at least one of the following places: within a NOTICE text file distributed as part of the Derivative Works; within the Source form or documentation, if provided along with the Derivative Works; or within a display generated by the Derivative Works, if and wherever such third-party notices normally appear.
|
|
48
|
+
|
|
49
|
+
(e) You may add Your own copyright statement to Your modifications and may provide additional or different license terms and conditions for use, reproduction, or distribution of Your modifications, provided Your use, reproduction, and distribution of the Work otherwise complies with the conditions stated in this License.
|
|
50
|
+
|
|
51
|
+
5. Submission of Contributions.
|
|
52
|
+
|
|
53
|
+
Unless You explicitly state otherwise, any Contribution intentionally submitted for inclusion in the Work by You to the Licensor shall be under the terms and conditions of this License, without any additional terms or conditions.
|
|
54
|
+
|
|
55
|
+
6. Trademarks.
|
|
56
|
+
|
|
57
|
+
This License does not grant permission to use the trade names, trademarks, service marks, or product names of the Licensor, except as required for reasonable and customary use in describing the origin of the Work and reproducing the content of the NOTICE file.
|
|
58
|
+
|
|
59
|
+
7. Disclaimer of Warranty.
|
|
60
|
+
|
|
61
|
+
Unless required by applicable law or agreed to in writing, Licensor provides the Work (and each Contributor provides its Contributions) on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
62
|
+
|
|
63
|
+
8. Limitation of Liability.
|
|
64
|
+
|
|
65
|
+
In no event and under no legal theory, whether in tort (including negligence), contract, or otherwise, unless required by applicable law shall any Contributor be liable to You for damages arising from this License or out of the use or inability to use the Work.
|
|
66
|
+
|
|
67
|
+
9. Accepting Warranty or Additional Liability.
|
|
68
|
+
|
|
69
|
+
While redistributing the Work or Derivative Works thereof, You may choose to offer, and charge a fee for, acceptance of support, warranty, indemnity, or other liability obligations and/or rights consistent with this License. However, in accepting such obligations, You may act only on Your own behalf and on Your sole responsibility, not on behalf of any other Contributor.
|
|
70
|
+
|
|
71
|
+
END OF TERMS AND CONDITIONS
|
|
72
|
+
|
|
73
|
+
APPENDIX: How to apply the Apache License to your work.
|
|
74
|
+
|
|
75
|
+
Copyright 2026 Danny / Therealdk8890
|
|
76
|
+
|
|
77
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
78
|
+
you may not use this file except in compliance with the License.
|
|
79
|
+
You may obtain a copy of the License at
|
|
80
|
+
|
|
81
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
82
|
+
|
|
83
|
+
Unless required by applicable law or agreed to in writing, software
|
|
84
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
85
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
86
|
+
See the License for the specific language governing permissions and
|
|
87
|
+
limitations under the License.
|
|
@@ -0,0 +1,364 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: agentcontainment
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: Controller-owned authorization and independently verifiable containment for AI agents
|
|
5
|
+
Author: Daniel Kissel
|
|
6
|
+
License: Apache-2.0
|
|
7
|
+
Project-URL: Homepage, https://github.com/Therealdk8890/AgentContainment
|
|
8
|
+
Project-URL: Repository, https://github.com/Therealdk8890/AgentContainment
|
|
9
|
+
Project-URL: Issues, https://github.com/Therealdk8890/AgentContainment/issues
|
|
10
|
+
Keywords: ai-agents,agent-security,agent-containment,ai-safety,runtime-security,authorization,policy-enforcement,ebpf,cgroups,cilium,governance
|
|
11
|
+
Classifier: Development Status :: 3 - Alpha
|
|
12
|
+
Classifier: Intended Audience :: Developers
|
|
13
|
+
Classifier: Intended Audience :: Information Technology
|
|
14
|
+
Classifier: License :: OSI Approved :: Apache Software License
|
|
15
|
+
Classifier: Operating System :: POSIX :: Linux
|
|
16
|
+
Classifier: Programming Language :: Python :: 3
|
|
17
|
+
Classifier: Programming Language :: Python :: 3 :: Only
|
|
18
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
19
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
20
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
21
|
+
Classifier: Topic :: Security
|
|
22
|
+
Classifier: Topic :: Software Development :: Libraries :: Python Modules
|
|
23
|
+
Requires-Python: >=3.11
|
|
24
|
+
Description-Content-Type: text/markdown
|
|
25
|
+
License-File: LICENSE
|
|
26
|
+
Dynamic: license-file
|
|
27
|
+
|
|
28
|
+
# AgentContainment
|
|
29
|
+
|
|
30
|
+
**Control and enforcement layer for an AI agent governance stack.**
|
|
31
|
+
|
|
32
|
+
AgentContainment provides the control side of a broader agent-governance loop: authorize actions, detect policy violations, halt compromised runs, revoke authority, contain blast radius, verify external enforcement, and preserve verifiable incident evidence.
|
|
33
|
+
|
|
34
|
+
Paired with provenance and claim-verification layers such as DProvenanceKit and ClaimProofKit, it forms a closed governance loop:
|
|
35
|
+
|
|
36
|
+
`Observe → Prove → Authorize → Enforce → Contain → Recover → Regression`
|
|
37
|
+
|
|
38
|
+
The architectural goal is not a collection of unrelated security libraries. It is a composable governance stack in which DProvenanceKit explains **what happened**, AgentContainment enforces **what was allowed**, ClaimProofKit verifies **what is supported by evidence**, and incidents become durable inputs to **future regression tests**. It is intentionally provider-neutral: platform enforcement can be supplied by cgroup v2/eBPF, Cilium, Tetragon, or another independently verifiable enforcement system.
|
|
39
|
+
|
|
40
|
+
**Keywords:** AI agent security, agent containment, autonomous agent security, AI runtime security, agent security control plane, AI agent firewall, agent firewall, AI agent sandbox, agent sandboxing, AI guardrails, agent governance, AI safety, runtime enforcement, action authorization, policy enforcement, kill switch, incident response, blast radius containment, enforcement verification, Cilium, CiliumNetworkPolicy, Kubernetes network policy, Tetragon, eBPF, Linux cgroups, cgroup v2, zero trust, defense in depth, tamper-evident audit, security engineering, open source AI security.
|
|
41
|
+
|
|
42
|
+
## Governance stack
|
|
43
|
+
|
|
44
|
+
```text
|
|
45
|
+
AI GOVERNANCE STACK
|
|
46
|
+
|
|
|
47
|
+
+------------+------------+
|
|
48
|
+
| |
|
|
49
|
+
PROVENANCE / PROOF CONTROL / ENFORCEMENT
|
|
50
|
+
DProvenanceKit AgentContainment
|
|
51
|
+
| |
|
|
52
|
+
What happened? What is allowed?
|
|
53
|
+
Evidence Halt / revoke
|
|
54
|
+
Regression Contain / recover
|
|
55
|
+
| |
|
|
56
|
+
+------------+------------+
|
|
57
|
+
|
|
|
58
|
+
GOVERNANCE LOOP
|
|
59
|
+
|
|
|
60
|
+
Incident → Evidence
|
|
61
|
+
|
|
|
62
|
+
Regression gate
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
The integration point is intentional:
|
|
66
|
+
|
|
67
|
+
- **Provenance** records the action, decision, evidence, and resulting incident state.
|
|
68
|
+
- **Containment** can consume provenance-linked incident context while retaining independent authority to halt the runtime.
|
|
69
|
+
- **Recovery** remains controller-authorized rather than agent-authorized.
|
|
70
|
+
- **Incidents** can be converted into deterministic regression cases so a previously observed failure becomes a future release gate.
|
|
71
|
+
|
|
72
|
+
See [`docs/GOVERNANCE_PLATFORM.md`](docs/GOVERNANCE_PLATFORM.md) for the platform architecture and implementation roadmap.
|
|
73
|
+
|
|
74
|
+
### Governance integration contract
|
|
75
|
+
|
|
76
|
+
The open-source stack is intentionally modular:
|
|
77
|
+
|
|
78
|
+
```text
|
|
79
|
+
GOVERNANCE CONTRACT
|
|
80
|
+
│
|
|
81
|
+
+-----------+-----------+
|
|
82
|
+
▼ ▼ ▼
|
|
83
|
+
DProvenanceKit AgentContainment ClaimProofKit
|
|
84
|
+
PROVE CONTROL VERIFY
|
|
85
|
+
\ │ /
|
|
86
|
+
\ │ /
|
|
87
|
+
+------ regression ------+
|
|
88
|
+
```
|
|
89
|
+
|
|
90
|
+
AgentContainment emits controller-owned `GovernanceEvent` records and can
|
|
91
|
+
export incidents as `RegressionFixture` cases. Downstream provenance and
|
|
92
|
+
claim-verification systems can attach evidence and support decisions without
|
|
93
|
+
becoming the containment or recovery authority.
|
|
94
|
+
|
|
95
|
+
|
|
96
|
+
|
|
97
|
+
## Why this is interesting
|
|
98
|
+
|
|
99
|
+
This project is deliberately trying to solve a harder problem than **“put guardrails around the agent.”**
|
|
100
|
+
|
|
101
|
+
The interesting boundary is what happens when the agent itself is no longer trustworthy.
|
|
102
|
+
|
|
103
|
+
An agent can request an action. A verification layer can determine whether the supporting claim is acceptable. A controller can make the authorization decision. An external mechanism can enforce containment at the host or network boundary. Independent evidence can then show what actually happened.
|
|
104
|
+
|
|
105
|
+
That gives the stack a concrete chain:
|
|
106
|
+
|
|
107
|
+
```text
|
|
108
|
+
ACTION
|
|
109
|
+
↓
|
|
110
|
+
CLAIM VERIFICATION
|
|
111
|
+
↓
|
|
112
|
+
AUTHORIZATION
|
|
113
|
+
↓
|
|
114
|
+
EXTERNAL ENFORCEMENT
|
|
115
|
+
↓
|
|
116
|
+
INDEPENDENT VERIFICATION
|
|
117
|
+
↓
|
|
118
|
+
PROVENANCE / EVIDENCE
|
|
119
|
+
↓
|
|
120
|
+
WARDEN OBSERVATION
|
|
121
|
+
```
|
|
122
|
+
|
|
123
|
+
The important part is that **no step is allowed to quietly impersonate another step**.
|
|
124
|
+
|
|
125
|
+
- **ClaimProofKit** answers: *Is the action supported by acceptable claims?*
|
|
126
|
+
- **AgentContainment** answers: *Was the action authorized, and what happens when containment is required?*
|
|
127
|
+
- **The external enforcer** answers: *Was the boundary actually applied?*
|
|
128
|
+
- **DProvenanceKit** answers: *Can the decision and resulting state be reconstructed and proved?*
|
|
129
|
+
- **Warden** answers: *Can an operator see the chain without being given authority to change it?*
|
|
130
|
+
|
|
131
|
+
Milestone 7 also moved the project beyond a purely simulated enforcement story: the trusted CI path exercises the Linux/eBPF containment boundary on a real Linux host and independently verifies the pinned enforcement link and post-containment behavior.
|
|
132
|
+
|
|
133
|
+
That does **not** make the system production-ready. It makes the engineering question more interesting: the project is now testing the boundary between an agent's intent, a controller's authority, an external enforcement mechanism, and independently reconstructable evidence.
|
|
134
|
+
|
|
135
|
+
> **Don't ask the agent to obey the boundary. Put the boundary outside the agent — then prove the boundary was actually enforced.**
|
|
136
|
+
|
|
137
|
+
## Installation
|
|
138
|
+
|
|
139
|
+
|
|
140
|
+
AgentContainment is packaged as a standard Python distribution. The first public PyPI release is planned after release validation; until then, install the current development version directly from GitHub:
|
|
141
|
+
|
|
142
|
+
```bash
|
|
143
|
+
python3 -m venv .venv
|
|
144
|
+
source .venv/bin/activate
|
|
145
|
+
python -m pip install "git+https://github.com/Therealdk8890/AgentContainment.git"
|
|
146
|
+
```
|
|
147
|
+
|
|
148
|
+
After the first PyPI release, the intended installation path will be:
|
|
149
|
+
|
|
150
|
+
```bash
|
|
151
|
+
python -m pip install agentcontainment
|
|
152
|
+
```
|
|
153
|
+
|
|
154
|
+
The core package has no third-party runtime dependencies. Linux-specific enforcement providers may require host capabilities and external tools such as eBPF/libbpf or Cilium/Kubernetes; those are deployment requirements rather than core Python dependencies.
|
|
155
|
+
## Core model
|
|
156
|
+
|
|
157
|
+
`Detect → Prove → Halt → Contain → Map → Recover`
|
|
158
|
+
|
|
159
|
+
The containment plane is designed to sit **outside the agent's trust boundary**. An agent must not control its own kill switch, containment policy, credentials, or incident evidence.
|
|
160
|
+
|
|
161
|
+
## Why AgentContainment
|
|
162
|
+
|
|
163
|
+
Traditional agent guardrails often operate inside the application or framework executing the agent. AgentContainment is designed around a different security boundary:
|
|
164
|
+
|
|
165
|
+
> **The agent requests an action. The controller decides whether it is allowed. The enforcement layer can then stop the runtime and its network egress independently of the agent.**
|
|
166
|
+
|
|
167
|
+
This separation is intended to remain useful when an agent is compromised, misbehaving, or attempting to bypass its normal tool wrapper.
|
|
168
|
+
|
|
169
|
+
### cgroup v2 provider
|
|
170
|
+
|
|
171
|
+
The optional `CgroupV2Enforcer` adapts a dedicated Linux cgroup v2 workload boundary to the provider-neutral enforcement interface. It uses `cgroup.kill` for containment and verifies state through `cgroup.events`. Configured cgroups are identity-bound using filesystem metadata so a deleted-and-recreated path is not silently accepted as the original workload boundary. An empty cgroup is treated as evidence that the current workload has exited; the AgentContainment durable admission fence remains the controller-owned authority that prevents recovery without explicit authorization.
|
|
172
|
+
|
|
173
|
+
This adapter is a Linux enforcement integration, not a claim that the Python control plane alone provides kernel-level isolation. Production deployments should provision and protect the cgroup hierarchy outside the agent trust boundary and validate the privileged integration on the target host.
|
|
174
|
+
|
|
175
|
+
### Cilium provider
|
|
176
|
+
|
|
177
|
+
The optional `CiliumNetworkPolicyEnforcer` integrates the same provider contract with Kubernetes/Cilium. It creates a namespace-scoped `CiliumNetworkPolicy` for the configured workload selector and denies ingress and egress. It does not add a Kubernetes client dependency to the core library; the adapter invokes `kubectl` without a shell and verifies the live policy object before reporting containment. Release deletes the policy and verifies that it is absent. The enforcer also queries matching `CiliumEndpoint` resources and requires realized policy enforcement for both ingress and egress before certifying containment. A Kubernetes policy object alone is therefore not treated as sufficient proof of enforcement. Production deployments should still pair this with Cilium health checks and an independent process-containment mechanism.
|
|
178
|
+
|
|
179
|
+
## Enforcement layers
|
|
180
|
+
|
|
181
|
+
AgentContainment uses defense in depth:
|
|
182
|
+
|
|
183
|
+
1. **Action authorization** — deterministic policy decisions before tool execution.
|
|
184
|
+
2. **Stateful policy** — controller-owned action history can detect sequences where individually permitted actions become dangerous collectively.
|
|
185
|
+
3. **Epoch fencing** — containment invalidates outstanding execution and egress leases.
|
|
186
|
+
4. **Capability revocation** — application-level authority is revoked during containment.
|
|
187
|
+
5. **Process containment** — Linux cgroup v2 can terminate the contained cgroup with `cgroup.kill`.
|
|
188
|
+
6. **Kernel egress enforcement** — the Linux eBPF integration can attach a cgroup egress program that drops outbound packets.
|
|
189
|
+
7. **Tamper-evident evidence** — controller-owned audit events are recorded in a hash chain.
|
|
190
|
+
|
|
191
|
+
No single layer is treated as sufficient.
|
|
192
|
+
|
|
193
|
+
## Provider-neutral enforcement architecture
|
|
194
|
+
|
|
195
|
+
AgentContainment owns the **containment decision, durable admission fence, recovery authority, and enforcement verification state**. It does not require a particular kernel or network security product.
|
|
196
|
+
|
|
197
|
+
The enforcement boundary is intentionally pluggable:
|
|
198
|
+
|
|
199
|
+
```text
|
|
200
|
+
AgentContainment
|
|
201
|
+
control plane / recovery authority
|
|
202
|
+
|
|
|
203
|
+
containment decision
|
|
204
|
+
v
|
|
205
|
+
+-----------+-----------+
|
|
206
|
+
| | |
|
|
207
|
+
Cilium Tetragon cgroup/eBPF
|
|
208
|
+
network runtime process/
|
|
209
|
+
enforcement enforcement egress
|
|
210
|
+
| | |
|
|
211
|
+
+-----------+-----------+
|
|
212
|
+
v
|
|
213
|
+
OS / network
|
|
214
|
+
|
|
|
215
|
+
v
|
|
216
|
+
Verification
|
|
217
|
+
```
|
|
218
|
+
|
|
219
|
+
The controller follows:
|
|
220
|
+
|
|
221
|
+
```text
|
|
222
|
+
REQUEST CONTAINMENT → ENFORCE → VERIFY → CERTIFY CONTAINED
|
|
223
|
+
```
|
|
224
|
+
|
|
225
|
+
A provider is not considered successfully enforced merely because a command or API request was accepted. Providers return an explicit status such as `ENFORCED`, `VERIFICATION_FAILED`, `DEGRADED`, or `NOT_CONFIGURED`.
|
|
226
|
+
|
|
227
|
+
Cilium and Tetragon are **optional integration targets, not dependencies of the core library**. AgentContainment is not intended to replace either project's kernel-level enforcement or telemetry capabilities. Its role is to provide an agent-level safety state machine and independent recovery boundary above those mechanisms.
|
|
228
|
+
|
|
229
|
+
For the current provider API, see `src/agent_containment/enforcer.py`.
|
|
230
|
+
|
|
231
|
+
## Stateful policy enforcement
|
|
232
|
+
|
|
233
|
+
Policies can reason about action sequences rather than only individual actions.
|
|
234
|
+
|
|
235
|
+
```python
|
|
236
|
+
from agent_containment.policy import PolicyEngine, SequenceRule
|
|
237
|
+
|
|
238
|
+
policy = PolicyEngine(sequence_rules=[
|
|
239
|
+
SequenceRule(
|
|
240
|
+
"prevent-download-upload-delete",
|
|
241
|
+
("download_file", "upload_file", "delete_file"),
|
|
242
|
+
)
|
|
243
|
+
])
|
|
244
|
+
```
|
|
245
|
+
|
|
246
|
+
The controller can therefore allow:
|
|
247
|
+
|
|
248
|
+
```text
|
|
249
|
+
download_file → ALLOW
|
|
250
|
+
upload_file → ALLOW
|
|
251
|
+
```
|
|
252
|
+
|
|
253
|
+
while halting the third action when the complete sequence is observed:
|
|
254
|
+
|
|
255
|
+
```text
|
|
256
|
+
delete_file → HALT
|
|
257
|
+
```
|
|
258
|
+
|
|
259
|
+
The policy history is maintained by the controller rather than being supplied by the agent.
|
|
260
|
+
|
|
261
|
+
## Standalone control plane
|
|
262
|
+
|
|
263
|
+
The repository includes a Unix-domain control transport and client for separating the agent from the controller process.
|
|
264
|
+
|
|
265
|
+
```text
|
|
266
|
+
Agent
|
|
267
|
+
|
|
|
268
|
+
| Unix domain socket
|
|
269
|
+
v
|
|
270
|
+
agentcontainmentd
|
|
271
|
+
|
|
|
272
|
+
+-- peer credential authorization
|
|
273
|
+
+-- action policy
|
|
274
|
+
+-- stateful policy history
|
|
275
|
+
+-- containment authority
|
|
276
|
+
+-- audit/evidence
|
|
277
|
+
|
|
|
278
|
+
v
|
|
279
|
+
OS enforcement boundary
|
|
280
|
+
|
|
|
281
|
+
+-- cgroup v2
|
|
282
|
+
+-- eBPF cgroup egress enforcement
|
|
283
|
+
```
|
|
284
|
+
|
|
285
|
+
The daemon exposes a deliberately narrow control protocol for registration, authorization, status, containment, reports, and snapshots.
|
|
286
|
+
|
|
287
|
+
## OS-level containment
|
|
288
|
+
|
|
289
|
+
On Linux, production deployments can place an agent and its descendants in a dedicated cgroup v2. Containment can then:
|
|
290
|
+
|
|
291
|
+
- invalidate application and egress leases;
|
|
292
|
+
- revoke application capabilities;
|
|
293
|
+
- activate the eBPF egress blocker;
|
|
294
|
+
- terminate the contained cgroup;
|
|
295
|
+
- preserve controller-owned evidence and telemetry paths.
|
|
296
|
+
|
|
297
|
+
The strongest guarantees depend on deployment privileges, cgroup configuration, kernel support, and correct isolation. AgentContainment does **not** claim that completed external side effects can be reversed.
|
|
298
|
+
|
|
299
|
+
See `docs/OS_LEVEL_CONTAINMENT.md` and `docs/EGRESS_CONTAINMENT.md` for the security model and limitations.
|
|
300
|
+
|
|
301
|
+
## Audit evidence
|
|
302
|
+
|
|
303
|
+
The controller can maintain a JSONL hash chain linking each event to the previous event. Verification detects edits, deletion, and reordering of the recorded chain.
|
|
304
|
+
|
|
305
|
+
This is **tamper-evident**, not immutable storage: an attacker with authority to rewrite both the audit file and its trusted reference can rewrite the evidence. External anchoring is a future hardening layer.
|
|
306
|
+
|
|
307
|
+
## Agent hierarchy
|
|
308
|
+
|
|
309
|
+
`AgentTree` models parent/child agents and propagates containment through currently registered descendants. Child capabilities are attenuated to the intersection requested by the child and held by the parent.
|
|
310
|
+
|
|
311
|
+
This provides a foundation for multi-agent containment without assuming that every child has the same authority as its parent.
|
|
312
|
+
|
|
313
|
+
## Milestone 8 — Warden observation
|
|
314
|
+
|
|
315
|
+
Milestone 7 established real-host Linux/eBPF containment and independent enforcement verification. Milestone 8 adds the observability boundary above that control path.
|
|
316
|
+
|
|
317
|
+
**Warden gets eyes, not hands.** Warden observes and displays the governance chain; it does not authorize actions, contain agents, release containment, mutate enforcement state, or approve recovery.
|
|
318
|
+
|
|
319
|
+
```text
|
|
320
|
+
ACTION
|
|
321
|
+
↓
|
|
322
|
+
CLAIM VERIFICATION
|
|
323
|
+
↓
|
|
324
|
+
AUTHORIZATION
|
|
325
|
+
↓
|
|
326
|
+
EXTERNAL ENFORCEMENT
|
|
327
|
+
↓
|
|
328
|
+
EVIDENCE
|
|
329
|
+
↓
|
|
330
|
+
WARDEN OBSERVATION
|
|
331
|
+
```
|
|
332
|
+
|
|
333
|
+
The security invariant is:
|
|
334
|
+
|
|
335
|
+
> **Warden observation must be incapable of changing authorization or containment state.**
|
|
336
|
+
|
|
337
|
+
The provider-neutral observation contract is implemented by `WardenObservation`. See [`docs/MILESTONE_8_WARDEN.md`](docs/MILESTONE_8_WARDEN.md) for the acceptance criterion and integration plan.
|
|
338
|
+
|
|
339
|
+
## Status
|
|
340
|
+
|
|
341
|
+
**Early research/prototype, with real-host enforcement proof established for the current Linux/eBPF path.** The project is currently focused on deterministic authorization, stateful action policy, runtime fencing, provider-neutral enforcement verification, containment, child-agent propagation, OS-level Linux enforcement, incident evidence, and the Milestone 8 observation boundary. Cilium/Tetragon remain optional integrations rather than core dependencies.
|
|
342
|
+
|
|
343
|
+
The project should not yet be treated as a production security boundary without validating the host deployment, privilege model, identity binding, policy coverage, and kernel enforcement configuration.
|
|
344
|
+
|
|
345
|
+
## Repository layout
|
|
346
|
+
|
|
347
|
+
- `src/agent_containment/` — core library and controller components
|
|
348
|
+
- `ebpf/` — Linux eBPF enforcement program and controller
|
|
349
|
+
- `policies/` — example policy
|
|
350
|
+
- `demo/` — controlled rogue-agent demonstration
|
|
351
|
+
- `tests/` — security and behavior tests
|
|
352
|
+
- `tests/integration/` — opt-in privileged Linux integration tests
|
|
353
|
+
- `docs/` — architecture, threat model, and containment notes
|
|
354
|
+
- `scripts/` — build and development helpers
|
|
355
|
+
|
|
356
|
+
## Safety
|
|
357
|
+
|
|
358
|
+
The demo uses a simulated environment. It does not execute destructive actions against real infrastructure.
|
|
359
|
+
|
|
360
|
+
Privileged integration tests are opt-in and intended for isolated Linux environments.
|
|
361
|
+
|
|
362
|
+
## License
|
|
363
|
+
|
|
364
|
+
Apache-2.0
|