agent-hypervisor 2.0.0__py3-none-any.whl

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 (47) hide show
  1. agent_hypervisor-2.0.0.dist-info/METADATA +412 -0
  2. agent_hypervisor-2.0.0.dist-info/RECORD +47 -0
  3. agent_hypervisor-2.0.0.dist-info/WHEEL +4 -0
  4. agent_hypervisor-2.0.0.dist-info/licenses/LICENSE +21 -0
  5. hypervisor/__init__.py +169 -0
  6. hypervisor/audit/__init__.py +1 -0
  7. hypervisor/audit/commitment.py +77 -0
  8. hypervisor/audit/delta.py +160 -0
  9. hypervisor/audit/gc.py +141 -0
  10. hypervisor/core.py +298 -0
  11. hypervisor/integrations/__init__.py +8 -0
  12. hypervisor/integrations/cmvk_adapter.py +250 -0
  13. hypervisor/integrations/iatp_adapter.py +253 -0
  14. hypervisor/integrations/nexus_adapter.py +220 -0
  15. hypervisor/liability/__init__.py +139 -0
  16. hypervisor/liability/attribution.py +207 -0
  17. hypervisor/liability/ledger.py +177 -0
  18. hypervisor/liability/quarantine.py +177 -0
  19. hypervisor/liability/slashing.py +147 -0
  20. hypervisor/liability/vouching.py +234 -0
  21. hypervisor/models.py +132 -0
  22. hypervisor/observability/__init__.py +15 -0
  23. hypervisor/observability/causal_trace.py +68 -0
  24. hypervisor/observability/event_bus.py +219 -0
  25. hypervisor/reversibility/__init__.py +1 -0
  26. hypervisor/reversibility/registry.py +107 -0
  27. hypervisor/rings/__init__.py +13 -0
  28. hypervisor/rings/breach_detector.py +218 -0
  29. hypervisor/rings/classifier.py +77 -0
  30. hypervisor/rings/elevation.py +211 -0
  31. hypervisor/rings/enforcer.py +137 -0
  32. hypervisor/saga/__init__.py +16 -0
  33. hypervisor/saga/checkpoint.py +163 -0
  34. hypervisor/saga/dsl.py +238 -0
  35. hypervisor/saga/fan_out.py +192 -0
  36. hypervisor/saga/orchestrator.py +222 -0
  37. hypervisor/saga/state_machine.py +156 -0
  38. hypervisor/security/__init__.py +11 -0
  39. hypervisor/security/kill_switch.py +180 -0
  40. hypervisor/security/rate_limiter.py +176 -0
  41. hypervisor/session/__init__.py +191 -0
  42. hypervisor/session/intent_locks.py +215 -0
  43. hypervisor/session/isolation.py +59 -0
  44. hypervisor/session/sso.py +216 -0
  45. hypervisor/session/vector_clock.py +165 -0
  46. hypervisor/verification/__init__.py +1 -0
  47. hypervisor/verification/history.py +161 -0
@@ -0,0 +1,412 @@
1
+ Metadata-Version: 2.4
2
+ Name: agent-hypervisor
3
+ Version: 2.0.0
4
+ Summary: Agent Hypervisor — Runtime supervisor for multi-agent Shared Sessions with Execution Rings, Joint Liability, Saga Orchestration, and Merkle audit trails
5
+ Project-URL: Homepage, https://github.com/imran-siddique/agent-hypervisor
6
+ Project-URL: Repository, https://github.com/imran-siddique/agent-hypervisor
7
+ Project-URL: Documentation, https://github.com/imran-siddique/agent-hypervisor#readme
8
+ Project-URL: Bug Tracker, https://github.com/imran-siddique/agent-hypervisor/issues
9
+ Project-URL: Agent OS, https://github.com/imran-siddique/agent-os
10
+ Project-URL: Agent Mesh, https://github.com/imran-siddique/agent-mesh
11
+ Project-URL: Agent SRE, https://github.com/imran-siddique/agent-sre
12
+ Author-email: Imran Siddique <imran.siddique@microsoft.com>
13
+ License-Expression: MIT
14
+ License-File: LICENSE
15
+ Keywords: agents,ai,audit,execution-rings,governance,hypervisor,liability,merkle,multi-agent,safety,saga,shared-sessions,trust
16
+ Classifier: Development Status :: 4 - Beta
17
+ Classifier: Intended Audience :: Developers
18
+ Classifier: Intended Audience :: Science/Research
19
+ Classifier: Programming Language :: Python :: 3
20
+ Classifier: Programming Language :: Python :: 3.11
21
+ Classifier: Programming Language :: Python :: 3.12
22
+ Classifier: Programming Language :: Python :: 3.13
23
+ Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
24
+ Classifier: Topic :: Software Development :: Libraries :: Python Modules
25
+ Classifier: Typing :: Typed
26
+ Requires-Python: >=3.11
27
+ Requires-Dist: pydantic>=2.0.0
28
+ Provides-Extra: blockchain
29
+ Requires-Dist: web3>=6.0.0; extra == 'blockchain'
30
+ Provides-Extra: dev
31
+ Requires-Dist: hypothesis>=6.0.0; extra == 'dev'
32
+ Requires-Dist: mypy>=1.8.0; extra == 'dev'
33
+ Requires-Dist: pytest-asyncio>=0.23.0; extra == 'dev'
34
+ Requires-Dist: pytest-cov>=4.0.0; extra == 'dev'
35
+ Requires-Dist: pytest>=8.0.0; extra == 'dev'
36
+ Requires-Dist: ruff>=0.4.0; extra == 'dev'
37
+ Provides-Extra: full
38
+ Requires-Dist: structlog>=24.1.0; extra == 'full'
39
+ Provides-Extra: nexus
40
+ Requires-Dist: structlog>=24.1.0; extra == 'nexus'
41
+ Description-Content-Type: text/markdown
42
+
43
+ <div align="center">
44
+
45
+ # Agent Hypervisor
46
+
47
+ **Runtime supervisor for multi-agent Shared Sessions with Execution Rings, Joint Liability, and Saga Orchestration**
48
+
49
+ [![GitHub Stars](https://img.shields.io/github/stars/imran-siddique/agent-hypervisor?style=social)](https://github.com/imran-siddique/agent-hypervisor/stargazers)
50
+ [![Sponsor](https://img.shields.io/badge/sponsor-%E2%9D%A4%EF%B8%8F-ff69b4)](https://github.com/sponsors/imran-siddique)
51
+ [![CI](https://github.com/imran-siddique/agent-hypervisor/actions/workflows/ci.yml/badge.svg)](https://github.com/imran-siddique/agent-hypervisor/actions)
52
+ [![Tests](https://img.shields.io/badge/tests-326%20passing-brightgreen)](https://github.com/imran-siddique/agent-hypervisor)
53
+ [![Benchmark](https://img.shields.io/badge/latency-268%CE%BCs%20pipeline-orange)](benchmarks/)
54
+ [![Python](https://img.shields.io/badge/python-3.11%2B-blue)](https://pypi.org/project/agent-hypervisor/)
55
+ [![License](https://img.shields.io/badge/license-MIT-green)](LICENSE)
56
+ [![Discussions](https://img.shields.io/github/discussions/imran-siddique/agent-hypervisor)](https://github.com/imran-siddique/agent-hypervisor/discussions)
57
+
58
+ > :star: **If this project helps you, please star it!** It helps others discover Agent Hypervisor.
59
+
60
+ > :link: **Part of the Agent Governance Ecosystem** -- Works with [Agent OS](https://github.com/imran-siddique/agent-os) (kernel), [AgentMesh](https://github.com/imran-siddique/agent-mesh) (trust network), and [Agent SRE](https://github.com/imran-siddique/agent-sre) (reliability)
61
+
62
+ [Quick Start](#quick-start) | [Why a Hypervisor?](#why-a-hypervisor) | [Features](#key-features) | [Performance](#performance) | [Modules](#modules) | [Ecosystem](#ecosystem)
63
+
64
+ </div>
65
+
66
+ ### Integrated Into Major AI Frameworks
67
+
68
+ <p align="center">
69
+ <a href="https://github.com/langgenius/dify-plugins/pull/2060"><img src="https://img.shields.io/badge/Dify-65K_%E2%AD%90_Merged-success?style=flat-square" alt="Dify"></a>
70
+ <a href="https://github.com/run-llama/llama_index/pull/20644"><img src="https://img.shields.io/badge/LlamaIndex-47K_%E2%AD%90_Merged-success?style=flat-square" alt="LlamaIndex"></a>
71
+ <a href="https://github.com/nicepkg/awesome-github-copilot/pull/26"><img src="https://img.shields.io/badge/Awesome_Copilot-21.6K_%E2%AD%90_Merged-success?style=flat-square" alt="Awesome Copilot"></a>
72
+ <a href="https://github.com/microsoft/agent-lightning/pull/478"><img src="https://img.shields.io/badge/Agent--Lightning-15K_%E2%AD%90_Merged-success?style=flat-square" alt="Agent-Lightning"></a>
73
+ <img src="https://img.shields.io/badge/Open_PRs-25+-blue?style=flat-square" alt="Open PRs">
74
+ <img src="https://img.shields.io/badge/Framework_Issues-94+-blue?style=flat-square" alt="Issues">
75
+ </p>
76
+
77
+ ## Quick Start
78
+
79
+ ```bash
80
+ pip install agent-hypervisor
81
+ ```
82
+
83
+ ```python
84
+ from hypervisor import Hypervisor, SessionConfig, ConsistencyMode
85
+
86
+ hv = Hypervisor()
87
+ session = await hv.create_session(
88
+ config=SessionConfig(enable_audit=True),
89
+ creator_did="did:mesh:admin",
90
+ )
91
+ ring = await hv.join_session(session.sso.session_id, "did:mesh:agent-1", sigma_raw=0.85)
92
+ # → RING_2_STANDARD (trusted agent)
93
+ ```
94
+
95
+ ## Why a Hypervisor?
96
+
97
+ Just as OS hypervisors isolate virtual machines and enforce resource boundaries, the **Agent Hypervisor** isolates AI agent sessions and enforces **governance boundaries**:
98
+
99
+ | OS Hypervisor | Agent Hypervisor |
100
+ |---------------|-----------------|
101
+ | CPU rings (Ring 0–3) | **Execution Rings** — privilege levels based on trust score (σ_eff) |
102
+ | Process isolation | **Session isolation** — VFS namespacing, DID-bound identity |
103
+ | Memory protection | **Liability protection** — bonded reputation, collateral slashing |
104
+ | System calls | **Saga transactions** — multi-step operations with automatic rollback |
105
+ | Audit logs | **Merkle-chained delta audit** — tamper-evident forensic trail |
106
+
107
+ ## Architecture
108
+
109
+ ```
110
+ ┌──────────────────────────────────────────────────────────────┐
111
+ │ AGENT HYPERVISOR │
112
+ │ │
113
+ │ ┌─────────────┐ ┌──────────────┐ ┌────────────────────────┐ │
114
+ │ │ Session │ │ Ring │ │ Semantic Saga │ │
115
+ │ │ Manager │ │ Enforcer │ │ Orchestrator │ │
116
+ │ │ │ │ │ │ ┌──────────────────┐ │ │
117
+ │ │ SSO + VFS │ │ Ring 0–3 │ │ │ Timeout + Retry │ │ │
118
+ │ │ Lifecycle │ │ σ_eff gates │ │ │ Compensation │ │ │
119
+ │ └──────┬──────┘ └──────┬───────┘ │ │ Escalation │ │ │
120
+ │ │ │ │ └──────────────────┘ │ │
121
+ │ ┌──────┴──────┐ ┌──────┴───────┐ └────────────┬───────────┘ │
122
+ │ │ Liability │ │ Reversibility│ │ │
123
+ │ │ Engine │ │ Registry │ ┌─────────────┴──────────┐ │
124
+ │ │ │ │ │ │ Delta Audit Engine │ │
125
+ │ │ Vouch + │ │ Execute/ │ │ │ │
126
+ │ │ Bond + │ │ Undo API │ │ Merkle Chain + GC │ │
127
+ │ │ Slash │ │ Mapping │ │ Blockchain Commit │ │
128
+ │ └─────────────┘ └──────────────┘ └────────────────────────┘ │
129
+ └──────────────────────────────────────────────────────────────┘
130
+ │ │ │
131
+ ┌────────┴────────────────┴────────────────────┴───────────────┐
132
+ │ AGENT-OS KERNEL LAYER │
133
+ │ ┌────────┐ ┌──────┐ ┌──────┐ ┌─────┐ ┌──────────┐ │
134
+ │ │ IATP │ │ CMVK │ │Nexus │ │CaaS │ │ SCAK │ │
135
+ │ └────────┘ └──────┘ └──────┘ └─────┘ └──────────┘ │
136
+ └──────────────────────────────────────────────────────────────┘
137
+ ```
138
+
139
+ ## Key Features
140
+
141
+ ### 🔐 Execution Rings (Hardware-Inspired Privilege Model)
142
+
143
+ ```
144
+ Ring 0 (Root) — Hypervisor config & slashing — requires SRE Witness
145
+ Ring 1 (Privileged) — Non-reversible actions — requires σ_eff > 0.95 + consensus
146
+ Ring 2 (Standard) — Reversible actions — requires σ_eff > 0.60
147
+ Ring 3 (Sandbox) — Read-only / research — default for unknown agents
148
+ ```
149
+
150
+ Agents are automatically assigned to rings based on their effective trust score. Ring demotion happens in real-time if trust drops.
151
+
152
+ **v2.0:** Dynamic ring elevation (sudo with TTL), ring breach detection with circuit breakers, ring inheritance for spawned agents.
153
+
154
+ ### 🤝 Joint Liability (Trust as Collateral)
155
+
156
+ High-trust agents can **vouch** for low-trust agents by bonding a percentage of their reputation:
157
+
158
+ ```
159
+ σ_eff = σ_low + (ω × σ_high_bonded)
160
+ ```
161
+
162
+ If the vouchee violates intent, **both agents are penalized** — the voucher's collateral is slashed. Max exposure limits (default: 80% of σ) prevent over-bonding.
163
+
164
+ **v2.0:** Shapley-value fault attribution (proportional blame, not binary), quarantine-before-terminate, persistent liability ledger for admission decisions.
165
+
166
+ ### 🔄 Semantic Saga Orchestrator
167
+
168
+ Multi-step agent transactions with:
169
+ - **Timeout enforcement** — steps that hang are automatically cancelled
170
+ - **Retry with backoff** — transient failures retry with exponential delay
171
+ - **Reverse-order compensation** — on failure, all committed steps are undone
172
+ - **Escalation** — if compensation fails, Joint Liability slashing is triggered
173
+
174
+ **v2.0:** Parallel fan-out (ALL/MAJORITY/ANY policies), semantic checkpoints for partial replay, declarative YAML/dict DSL.
175
+
176
+ ### 🔒 Session Consistency (NEW in v2.0)
177
+
178
+ - **Vector clocks** — causal consistency for shared VFS state
179
+ - **Intent locks** — READ/WRITE/EXCLUSIVE with deadlock detection
180
+ - **Isolation levels** — SNAPSHOT, READ_COMMITTED, SERIALIZABLE per saga
181
+
182
+ ### 🛡️ Security (NEW in v2.0)
183
+
184
+ - **Rate limiting** — token bucket per agent per ring (sandbox: 5 rps, root: 100 rps)
185
+ - **Kill switch** — graceful termination with saga step handoff to substitute agents
186
+
187
+ ### 📡 Observability (NEW in v2.0)
188
+
189
+ - **Structured event bus** — every hypervisor action emits typed events
190
+ - **Causal trace IDs** — distributed tracing with full delegation tree encoding
191
+
192
+ ### 📋 Delta Audit Engine
193
+
194
+ Forensic-grade audit trails using:
195
+ - **Semantic diffs** — captures what changed, not full snapshots
196
+ - **Merkle chaining** — each delta references its parent hash (tamper-evident)
197
+ - **Blockchain commitment** — Summary Hash anchored on-chain at session end
198
+ - **Garbage collection** — ephemeral data purged, forensic artifacts retained
199
+
200
+ ## Performance
201
+
202
+ | Operation | Mean Latency | Throughput |
203
+ |-----------|-------------|------------|
204
+ | Ring computation | **0.3μs** | 3.75M ops/s |
205
+ | Delta audit capture | **27μs** | 26K ops/s |
206
+ | Session lifecycle | **54μs** | 15.7K ops/s |
207
+ | 3-step saga | **151μs** | 5.3K ops/s |
208
+ | **Full governance pipeline** | **268μs** | **2,983 ops/s** |
209
+
210
+ > Full pipeline = session create + agent join + 3 audit deltas + saga step + terminate with Merkle root
211
+
212
+ ## Installation
213
+
214
+ ```bash
215
+ pip install agent-hypervisor
216
+ ```
217
+
218
+ ## Quick Start
219
+
220
+ ```python
221
+ from hypervisor import Hypervisor, SessionConfig, ConsistencyMode
222
+
223
+ hv = Hypervisor()
224
+
225
+ # Create a shared session
226
+ session = await hv.create_session(
227
+ config=SessionConfig(
228
+ consistency_mode=ConsistencyMode.EVENTUAL,
229
+ max_participants=5,
230
+ min_sigma_eff=0.60,
231
+ ),
232
+ creator_did="did:mesh:admin",
233
+ )
234
+
235
+ # Agents join via IATP handshake — ring assigned by trust score
236
+ ring = await hv.join_session(
237
+ session.sso.session_id,
238
+ agent_did="did:mesh:agent-alpha",
239
+ sigma_raw=0.85,
240
+ )
241
+ # → ExecutionRing.RING_2_STANDARD
242
+
243
+ # Activate and execute
244
+ await hv.activate_session(session.sso.session_id)
245
+
246
+ # Multi-step saga with automatic compensation
247
+ saga = session.saga.create_saga(session.sso.session_id)
248
+ step = session.saga.add_step(
249
+ saga.saga_id, "draft_email", "did:mesh:agent-alpha",
250
+ execute_api="/api/draft", undo_api="/api/undo-draft",
251
+ timeout_seconds=30, max_retries=2,
252
+ )
253
+ result = await session.saga.execute_step(
254
+ saga.saga_id, step.step_id, executor=draft_email
255
+ )
256
+
257
+ # Terminate — returns Merkle root Summary Hash
258
+ merkle_root = await hv.terminate_session(session.sso.session_id)
259
+ ```
260
+
261
+ ## Modules
262
+
263
+ | Module | Description | Tests |
264
+ |--------|-------------|-------|
265
+ | `hypervisor.session` | Shared Session Object lifecycle + VFS | 52 |
266
+ | `hypervisor.rings` | 4-ring privilege + elevation + breach detection | 34 |
267
+ | `hypervisor.liability` | Vouching, slashing, attribution, quarantine, ledger | 39 |
268
+ | `hypervisor.reversibility` | Execute/Undo API registry | 4 |
269
+ | `hypervisor.saga` | Saga orchestrator + fan-out + checkpoints + DSL | 41 |
270
+ | `hypervisor.audit` | Delta engine, Merkle chain, GC, commitment | 10 |
271
+ | `hypervisor.verification` | DID transaction history verification | 4 |
272
+ | `hypervisor.observability` | Event bus, causal trace IDs | 22 |
273
+ | `hypervisor.security` | Rate limiter, kill switch | 16 |
274
+ | `hypervisor.integrations` | Nexus, CMVK, IATP cross-module adapters | -- |
275
+ | **Integration** | End-to-end lifecycle, edge cases, security | **24** |
276
+ | **Scenarios** | Cross-module governance pipelines (7 suites) | **18** |
277
+ | **Total** | | **326** |
278
+
279
+ ## Test Suite
280
+
281
+ ```bash
282
+ # Run all tests
283
+ pytest tests/ -v
284
+
285
+ # Run only integration tests
286
+ pytest tests/integration/ -v
287
+
288
+ # Run benchmarks
289
+ python benchmarks/bench_hypervisor.py
290
+ ```
291
+
292
+ ## Cross-Module Integrations
293
+
294
+ The Hypervisor integrates with other Agent-OS modules via adapters in `hypervisor.integrations`:
295
+
296
+ ### Nexus Adapter — Trust-Scored Ring Assignment
297
+
298
+ ```python
299
+ from hypervisor.integrations.nexus_adapter import NexusAdapter
300
+ from nexus.reputation import ReputationEngine
301
+
302
+ nexus = NexusAdapter(scorer=ReputationEngine())
303
+ sigma = nexus.resolve_sigma("did:mesh:agent-1", history=agent_history)
304
+ # → 0.82 (Nexus 820/1000 normalized)
305
+
306
+ ring = await hv.join_session(session_id, "did:mesh:agent-1", sigma_raw=sigma)
307
+ # → RING_2_STANDARD
308
+
309
+ # Report slashing back to Nexus for persistent reputation loss
310
+ nexus.report_slash("did:mesh:agent-1", reason="Behavioral drift", severity="high")
311
+ ```
312
+
313
+ ### CMVK Adapter — Behavioral Drift Detection
314
+
315
+ ```python
316
+ from hypervisor.integrations.cmvk_adapter import CMVKAdapter
317
+
318
+ cmvk = CMVKAdapter(verifier=cmvk_engine)
319
+ result = cmvk.check_behavioral_drift(
320
+ agent_did="did:mesh:agent-1",
321
+ session_id=session_id,
322
+ claimed_embedding=manifest_vector,
323
+ observed_embedding=output_vector,
324
+ )
325
+
326
+ if result.should_slash:
327
+ hv.slashing.slash(...) # Trigger liability cascade
328
+ ```
329
+
330
+ ### IATP Adapter — Capability Manifest Parsing
331
+
332
+ ```python
333
+ from hypervisor.integrations.iatp_adapter import IATPAdapter
334
+
335
+ iatp = IATPAdapter()
336
+ analysis = iatp.analyze_manifest(manifest) # or analyze_manifest_dict(dict)
337
+ # → ManifestAnalysis with ring_hint, sigma_hint, actions, reversibility flags
338
+
339
+ ring = await hv.join_session(
340
+ session_id, analysis.agent_did,
341
+ actions=analysis.actions, sigma_raw=analysis.sigma_hint,
342
+ )
343
+ ```
344
+
345
+ ## Ecosystem
346
+
347
+ Agent Hypervisor is part of the **Agent Governance Ecosystem** — four specialized repos that work together:
348
+
349
+ `
350
+ ┌─────────────────────────────────────────────────────────────┐
351
+ │ Agent Governance Ecosystem │
352
+ │ │
353
+ │ ┌──────────────┐ ┌──────────────┐ ┌──────────────────┐ │
354
+ │ │ Agent OS │ │ Agent Mesh │ │ Agent SRE │ │
355
+ │ │ Governance │ │ Trust │ │ Reliability │ │
356
+ │ │ Kernel │ │ Network │ │ Platform │ │
357
+ │ └──────┬───────┘ └──────┬───────┘ └───────┬──────────┘ │
358
+ │ │ │ │ │
359
+ │ └─────────┬───────┴───────────┬───────┘ │
360
+ │ │ │ │
361
+ │ ┌────────┴───────────────────┴────────┐ │
362
+ │ │ Agent Hypervisor │ │
363
+ │ │ Runtime supervisor for all agents │ │
364
+ │ └──────────────────────────────────────┘ │
365
+ └─────────────────────────────────────────────────────────────┘
366
+ `
367
+
368
+ | Repo | Role | Stars |
369
+ |------|------|-------|
370
+ | [Agent OS](https://github.com/imran-siddique/agent-os) | Policy enforcement kernel | 1,500+ tests |
371
+ | [Agent Mesh](https://github.com/imran-siddique/agent-mesh) | Cryptographic trust network | 1,400+ tests |
372
+ | [Agent SRE](https://github.com/imran-siddique/agent-sre) | SLO, chaos, cost guardrails | 1,070+ tests |
373
+ | **Agent Hypervisor** | Session isolation & governance runtime | 326 tests |
374
+
375
+ ## Frequently Asked Questions
376
+
377
+ **Why use a hypervisor for AI agents?**
378
+ Just as OS hypervisors isolate virtual machines and enforce resource boundaries, an agent hypervisor isolates AI agent sessions and enforces governance boundaries. Without isolation, a misbehaving agent in a shared session can corrupt state, escalate privileges, or cascade failures across the entire system.
379
+
380
+ **How do Execution Rings differ from traditional access control?**
381
+ Traditional access control is static and binary (allowed/denied). Execution Rings are dynamic and graduated -- agents earn ring privileges based on their trust score, can request temporary elevation with TTL (like `sudo`), and are automatically demoted when trust drops. Ring breach detection catches anomalous behavior before damage occurs.
382
+
383
+ **What happens when a multi-agent saga fails?**
384
+ The Saga Orchestrator triggers reverse-order compensation for all committed steps. For parallel fan-out sagas, the failure policy determines the response: ALL_MUST_SUCCEED compensates if any branch fails, MAJORITY allows minority failures, and ANY succeeds if at least one branch completes. Semantic checkpoints enable partial replay without re-running completed effects.
385
+
386
+ **How does Shapley-value fault attribution work?**
387
+ When a saga fails, the hypervisor traces the causal DAG and assigns proportional blame: 50% weight to direct cause, 30% to enabling factors, 20% to temporal proximity. This prevents unfairly penalizing agents that merely contributed to but didn't directly cause a failure.
388
+
389
+ ## Contributing
390
+
391
+ We welcome contributions! Please see our [Contributing Guide](CONTRIBUTING.md) for details.
392
+
393
+ - :bug: [Report a Bug](https://github.com/imran-siddique/agent-hypervisor/issues/new?labels=bug)
394
+ - :bulb: [Request a Feature](https://github.com/imran-siddique/agent-hypervisor/issues/new?labels=enhancement)
395
+ - :speech_balloon: [Join Discussions](https://github.com/imran-siddique/agent-hypervisor/discussions)
396
+ - Look for issues labeled [`good first issue`](https://github.com/imran-siddique/agent-hypervisor/labels/good%20first%20issue) to get started
397
+
398
+ ## License
399
+
400
+ MIT -- see [LICENSE](LICENSE).
401
+
402
+ ---
403
+
404
+ <div align="center">
405
+
406
+ **[Agent OS](https://github.com/imran-siddique/agent-os)** | **[AgentMesh](https://github.com/imran-siddique/agent-mesh)** | **[Agent SRE](https://github.com/imran-siddique/agent-sre)** | **[Agent Hypervisor](https://github.com/imran-siddique/agent-hypervisor)**
407
+
408
+ *Built with :heart: for the AI agent governance community*
409
+
410
+ If Agent Hypervisor helps your work, please consider giving it a :star:
411
+
412
+ </div>
@@ -0,0 +1,47 @@
1
+ hypervisor/__init__.py,sha256=twcdt4sicx6yqGmbQ4yYGf6nSxcgS3PV-ThdoxscCFQ,5519
2
+ hypervisor/core.py,sha256=hMx2OSXCKkmh-581snSdXiIgvPXQk6vLV_GPIJA_Sgo,10813
3
+ hypervisor/models.py,sha256=SjozGdcdxHQz5pt_FFwdOIi11A_Tr9juN0nEllZhoRs,3979
4
+ hypervisor/audit/__init__.py,sha256=iAg9-m_phte0upsc9aavMJxSwJOXkCVWs1pPdAjVALg,62
5
+ hypervisor/audit/commitment.py,sha256=3RwAAzb_UIlWpcyZWUW7joSvEL3D2z5kIQokbPh_I5k,2483
6
+ hypervisor/audit/delta.py,sha256=pR6qc24FghdwFKQvpkh1Y0jM3AdQGSdXU75wADxAJ9A,4872
7
+ hypervisor/audit/gc.py,sha256=fsBD9Ae_TkxZ4WVrWbSjJAXqZ4o9TSKIS_P9j_5YnyQ,4751
8
+ hypervisor/integrations/__init__.py,sha256=SKxvdR6sK6YrxTKbHDMlD6w4-75sMlc8X-_-eM10iM4,281
9
+ hypervisor/integrations/cmvk_adapter.py,sha256=BdNoNCZ67BSUwg-Ku1LTKdIueQh7oqZI0IJnji7D7g4,7953
10
+ hypervisor/integrations/iatp_adapter.py,sha256=NJZ7UN9WFoSejeS6sQpa_lTtGcnw327WPvWcG7-qDWA,8938
11
+ hypervisor/integrations/nexus_adapter.py,sha256=f7JrpRwBG_b_RvDqXjeJXrV6Dhln_fSfniuvVsu5JYY,6853
12
+ hypervisor/liability/__init__.py,sha256=c1uPMCXK8oaqCYXIWVauUOnLH1SGb9AGynKZQ8daImQ,4444
13
+ hypervisor/liability/attribution.py,sha256=RCzTqnUoiQYftwesip0-MpQzni6XGXKnX-ymGG4IyEg,7449
14
+ hypervisor/liability/ledger.py,sha256=_tY94mCIVRIJQdj3ammfssEvbC8GbUmIqZkquoFK2N8,6075
15
+ hypervisor/liability/quarantine.py,sha256=TBL35uwhxxJJYBNfBHxEcnLFOTaKnbI58kV-2STTEOA,6092
16
+ hypervisor/liability/slashing.py,sha256=wcfgBDzsc-YvLpXeVcctpZulHCeaD7L2v1II3VrWR5E,4824
17
+ hypervisor/liability/vouching.py,sha256=Daw6hlKNQvJSHjL-xkKxdQJeNcR1glfYDAJkcdQKfIQ,8488
18
+ hypervisor/observability/__init__.py,sha256=URFdmUeCTh1tifgqVED6sCW-oUaDQzrgRH_nqne7fvg,365
19
+ hypervisor/observability/causal_trace.py,sha256=kwtAzHomEM6xwtDx3isJ_LzHgN-QxCO8qbkJ1By7cN4,2290
20
+ hypervisor/observability/event_bus.py,sha256=sKZZWo95aeq59r25PcHTn5C6kcJe2Yq2J_2DN4Vb0gA,7626
21
+ hypervisor/reversibility/__init__.py,sha256=LiPyIMyZLD4QGvUtliTxq13q3hkrqgabFBPQZMWtrJw,33
22
+ hypervisor/reversibility/registry.py,sha256=HEWFtMmjSkJMlbs4WQZqpLcWOoOE12dolgck7PS-7fY,3686
23
+ hypervisor/rings/__init__.py,sha256=lHlnA4TLBPyLQDu0fDGbGE7FsuBeKAuj5UTVfL7C3r0,454
24
+ hypervisor/rings/breach_detector.py,sha256=OWxzj-5e0uNl9gTpvDwvBIV-9GYyMrcX1B_og45QU60,7563
25
+ hypervisor/rings/classifier.py,sha256=aYPMhB12vGlrtrIITc9EBjdwjv7zc3PQL0NFqS7z_s0,2572
26
+ hypervisor/rings/elevation.py,sha256=yF1GPeuBu15q-FgOOCygtByNs15wF7JQp5FrNiw_8Mk,7676
27
+ hypervisor/rings/enforcer.py,sha256=tufNV1rBIQ5vr6E7__Jogp5UTyR6EnYrpRuUtf9ktq4,4811
28
+ hypervisor/saga/__init__.py,sha256=2SSBPHiIqs_JeQ7Ie585IybMBnd4ptM6ufyYBE7oUtI,514
29
+ hypervisor/saga/checkpoint.py,sha256=aOtcTsotGEbGmaCMzAJPd0uFX39be3zhs9Zig0-IMx4,5511
30
+ hypervisor/saga/dsl.py,sha256=ASowPySVgtFG6xSsXct10MBxwyA2_mWbSiVdnAQ97QA,7867
31
+ hypervisor/saga/fan_out.py,sha256=ZC1JeoIKI2cGulu1uj6EHCzNy5v8zjIUHOsFCAsZS2g,6381
32
+ hypervisor/saga/orchestrator.py,sha256=yDAMWo4qnz8LdDoaa8mIjXdnq1hKLc9LYB_DCCX_MLA,7407
33
+ hypervisor/saga/state_machine.py,sha256=GL7-2PRD6nMNSdSe-pJhXiaqHx7Fst1D_R94GcKuUYs,5186
34
+ hypervisor/security/__init__.py,sha256=vJ2XzQzl8qHsgUiJj-qIrZZLct29KZTs1PWvyh0XPJ8,336
35
+ hypervisor/security/kill_switch.py,sha256=F5EbnejjJFGuvvS6RYBLJ_NYPvMjXQhboziMmVPqqHM,5429
36
+ hypervisor/security/rate_limiter.py,sha256=3rwH17hKlonHZgOnESfe8NyNu4V9x-_iankhG5I1g3o,5505
37
+ hypervisor/session/__init__.py,sha256=Rw_fg051sxnu2c9cFCmRxkSDnY37zXx_57-ZrUfGOVk,7090
38
+ hypervisor/session/intent_locks.py,sha256=_XBGz-xXsip9RldMIOzOhsi_Ay6eYRBngBjDxREF2i4,7587
39
+ hypervisor/session/isolation.py,sha256=b-cYsJAM02avNaW26a-FAH9LEzaN_0GAzHwnKj9VUHQ,1886
40
+ hypervisor/session/sso.py,sha256=6RMDHONJuWgxLnSB7DNVvk9RM5uFWRLCZzRQa7O6qcE,8479
41
+ hypervisor/session/vector_clock.py,sha256=wgbjv5H0ADNuxgHay0sg1hlwib8F99Vxl6f-nke1lgk,6103
42
+ hypervisor/verification/__init__.py,sha256=eRLu8pan4WDFtzH3LAec3JmXFTfox2UAohdDMkqmjLI,32
43
+ hypervisor/verification/history.py,sha256=oFV2JP0tFRIelPx0iXWelj7oVZp5Sf-FAW2cw9S93AY,5482
44
+ agent_hypervisor-2.0.0.dist-info/METADATA,sha256=bTi4efeAiujY9ABohiojhKF8vlLuX-OnRWa08v-aVTU,21346
45
+ agent_hypervisor-2.0.0.dist-info/WHEEL,sha256=WLgqFyCfm_KASv4WHyYy0P3pM_m7J5L9k2skdKLirC8,87
46
+ agent_hypervisor-2.0.0.dist-info/licenses/LICENSE,sha256=f63WV0JQV3G7HARoFf-08d0nw_7e_ZgmTHH4I1B0Zy4,1092
47
+ agent_hypervisor-2.0.0.dist-info/RECORD,,
@@ -0,0 +1,4 @@
1
+ Wheel-Version: 1.0
2
+ Generator: hatchling 1.28.0
3
+ Root-Is-Purelib: true
4
+ Tag: py3-none-any
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Imran Siddique
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
hypervisor/__init__.py ADDED
@@ -0,0 +1,169 @@
1
+ """
2
+ Agent Hypervisor v2.0
3
+
4
+ Runtime supervisor for multi-agent Shared Sessions. Enforces a strict security
5
+ model based on Verified Intent, Joint Liability scoring, hardware-inspired
6
+ Execution Rings, and delta-based forensic audit trails.
7
+
8
+ The Hypervisor composes existing Agent-OS modules (IATP, CMVK, Nexus, CaaS, SCAK)
9
+ into a unified governance runtime for multi-agent collaboration.
10
+
11
+ Core Components:
12
+ - SessionManager: Shared Session Object (SSO) lifecycle
13
+ - LiabilityEngine: Vouching, bonding, and collateral slashing
14
+ - RingEnforcer: 4-ring privilege model (Ring 0-3)
15
+ - ReversibilityRegistry: Execute/Undo API mapping
16
+ - SagaOrchestrator: Semantic saga with reverse-order compensation
17
+ - DeltaAuditEngine: Merkle-chained semantic diffs
18
+
19
+ v2.0 Additions:
20
+ - Observability: Structured event bus with causal trace IDs
21
+ - Dynamic Rings: Time-bounded elevation (sudo with TTL), breach detection
22
+ - Liability: Shapley-value fault attribution, quarantine, persistent ledger
23
+ - Saga: Parallel fan-out with failure policies, semantic checkpoints, DSL
24
+ - Session: Vector clocks, intent locks, isolation levels
25
+ - Security: Per-agent rate limiting, kill switch with saga handoff
26
+
27
+ Usage:
28
+ >>> from hypervisor import Hypervisor, SessionConfig, ConsistencyMode
29
+ >>> hv = Hypervisor()
30
+ >>> session = await hv.create_session(
31
+ ... config=SessionConfig(consistency_mode=ConsistencyMode.EVENTUAL)
32
+ ... )
33
+
34
+ Version: 2.0.0
35
+ """
36
+
37
+ __version__ = "2.0.0"
38
+
39
+ # Core models
40
+ from hypervisor.models import (
41
+ ConsistencyMode,
42
+ ExecutionRing,
43
+ ReversibilityLevel,
44
+ SessionConfig,
45
+ SessionState,
46
+ )
47
+
48
+ # Session management
49
+ from hypervisor.session import SharedSessionObject
50
+ from hypervisor.session.sso import SessionVFS, VFSEdit, VFSPermissionError
51
+ from hypervisor.session.vector_clock import VectorClock, VectorClockManager, CausalViolationError
52
+ from hypervisor.session.intent_locks import IntentLockManager, LockIntent, LockContentionError, DeadlockError
53
+ from hypervisor.session.isolation import IsolationLevel
54
+
55
+ # Liability engine
56
+ from hypervisor.liability.vouching import VouchRecord, VouchingEngine
57
+ from hypervisor.liability.slashing import SlashingEngine
58
+ from hypervisor.liability import LiabilityMatrix
59
+ from hypervisor.liability.attribution import CausalAttributor, AttributionResult
60
+ from hypervisor.liability.quarantine import QuarantineManager, QuarantineReason
61
+ from hypervisor.liability.ledger import LiabilityLedger, LedgerEntryType
62
+
63
+ # Execution rings
64
+ from hypervisor.rings.enforcer import RingEnforcer
65
+ from hypervisor.rings.classifier import ActionClassifier
66
+ from hypervisor.rings.elevation import RingElevationManager, RingElevation
67
+ from hypervisor.rings.breach_detector import RingBreachDetector, BreachSeverity
68
+
69
+ # Reversibility
70
+ from hypervisor.reversibility.registry import ReversibilityRegistry
71
+
72
+ # Saga
73
+ from hypervisor.saga.orchestrator import SagaOrchestrator, SagaTimeoutError
74
+ from hypervisor.saga.state_machine import SagaState, StepState
75
+ from hypervisor.saga.fan_out import FanOutOrchestrator, FanOutPolicy
76
+ from hypervisor.saga.checkpoint import CheckpointManager, SemanticCheckpoint
77
+ from hypervisor.saga.dsl import SagaDSLParser, SagaDefinition
78
+
79
+ # Audit
80
+ from hypervisor.audit.delta import DeltaEngine
81
+ from hypervisor.audit.commitment import CommitmentEngine
82
+ from hypervisor.audit.gc import EphemeralGC
83
+
84
+ # Verification
85
+ from hypervisor.verification.history import TransactionHistoryVerifier
86
+
87
+ # Observability
88
+ from hypervisor.observability.event_bus import HypervisorEventBus, EventType, HypervisorEvent
89
+ from hypervisor.observability.causal_trace import CausalTraceId
90
+
91
+ # Security
92
+ from hypervisor.security.rate_limiter import AgentRateLimiter, RateLimitExceeded
93
+ from hypervisor.security.kill_switch import KillSwitch, KillResult
94
+
95
+ # Top-level orchestrator
96
+ from hypervisor.core import Hypervisor
97
+
98
+ __all__ = [
99
+ # Version
100
+ "__version__",
101
+ # Core
102
+ "Hypervisor",
103
+ # Models
104
+ "ConsistencyMode",
105
+ "ExecutionRing",
106
+ "ReversibilityLevel",
107
+ "SessionConfig",
108
+ "SessionState",
109
+ # Session
110
+ "SharedSessionObject",
111
+ "SessionVFS",
112
+ "VFSEdit",
113
+ "VFSPermissionError",
114
+ "VectorClock",
115
+ "VectorClockManager",
116
+ "CausalViolationError",
117
+ "IntentLockManager",
118
+ "LockIntent",
119
+ "LockContentionError",
120
+ "DeadlockError",
121
+ "IsolationLevel",
122
+ # Liability
123
+ "VouchRecord",
124
+ "VouchingEngine",
125
+ "SlashingEngine",
126
+ "LiabilityMatrix",
127
+ "CausalAttributor",
128
+ "AttributionResult",
129
+ "QuarantineManager",
130
+ "QuarantineReason",
131
+ "LiabilityLedger",
132
+ "LedgerEntryType",
133
+ # Rings
134
+ "RingEnforcer",
135
+ "ActionClassifier",
136
+ "RingElevationManager",
137
+ "RingElevation",
138
+ "RingBreachDetector",
139
+ "BreachSeverity",
140
+ # Reversibility
141
+ "ReversibilityRegistry",
142
+ # Saga
143
+ "SagaOrchestrator",
144
+ "SagaTimeoutError",
145
+ "SagaState",
146
+ "StepState",
147
+ "FanOutOrchestrator",
148
+ "FanOutPolicy",
149
+ "CheckpointManager",
150
+ "SemanticCheckpoint",
151
+ "SagaDSLParser",
152
+ "SagaDefinition",
153
+ # Audit
154
+ "DeltaEngine",
155
+ "CommitmentEngine",
156
+ "EphemeralGC",
157
+ # Verification
158
+ "TransactionHistoryVerifier",
159
+ # Observability
160
+ "HypervisorEventBus",
161
+ "EventType",
162
+ "HypervisorEvent",
163
+ "CausalTraceId",
164
+ # Security
165
+ "AgentRateLimiter",
166
+ "RateLimitExceeded",
167
+ "KillSwitch",
168
+ "KillResult",
169
+ ]
@@ -0,0 +1 @@
1
+ """Audit subpackage — delta engine, commitment, and GC."""