agent-hypervisor 2.0.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.
- agent_hypervisor-2.0.0/.github/FUNDING.yml +1 -0
- agent_hypervisor-2.0.0/.github/workflows/ci.yml +48 -0
- agent_hypervisor-2.0.0/.gitignore +22 -0
- agent_hypervisor-2.0.0/CHANGELOG.md +58 -0
- agent_hypervisor-2.0.0/CONTRIBUTING.md +67 -0
- agent_hypervisor-2.0.0/LICENSE +21 -0
- agent_hypervisor-2.0.0/PKG-INFO +412 -0
- agent_hypervisor-2.0.0/README.md +370 -0
- agent_hypervisor-2.0.0/benchmarks/bench_hypervisor.py +308 -0
- agent_hypervisor-2.0.0/benchmarks/results/BENCHMARKS.md +31 -0
- agent_hypervisor-2.0.0/benchmarks/results/benchmarks.json +103 -0
- agent_hypervisor-2.0.0/examples/demo.py +386 -0
- agent_hypervisor-2.0.0/pyproject.toml +89 -0
- agent_hypervisor-2.0.0/src/hypervisor/__init__.py +169 -0
- agent_hypervisor-2.0.0/src/hypervisor/audit/__init__.py +1 -0
- agent_hypervisor-2.0.0/src/hypervisor/audit/commitment.py +77 -0
- agent_hypervisor-2.0.0/src/hypervisor/audit/delta.py +160 -0
- agent_hypervisor-2.0.0/src/hypervisor/audit/gc.py +141 -0
- agent_hypervisor-2.0.0/src/hypervisor/core.py +298 -0
- agent_hypervisor-2.0.0/src/hypervisor/integrations/__init__.py +8 -0
- agent_hypervisor-2.0.0/src/hypervisor/integrations/cmvk_adapter.py +250 -0
- agent_hypervisor-2.0.0/src/hypervisor/integrations/iatp_adapter.py +253 -0
- agent_hypervisor-2.0.0/src/hypervisor/integrations/nexus_adapter.py +220 -0
- agent_hypervisor-2.0.0/src/hypervisor/liability/__init__.py +139 -0
- agent_hypervisor-2.0.0/src/hypervisor/liability/attribution.py +207 -0
- agent_hypervisor-2.0.0/src/hypervisor/liability/ledger.py +177 -0
- agent_hypervisor-2.0.0/src/hypervisor/liability/quarantine.py +177 -0
- agent_hypervisor-2.0.0/src/hypervisor/liability/slashing.py +147 -0
- agent_hypervisor-2.0.0/src/hypervisor/liability/vouching.py +234 -0
- agent_hypervisor-2.0.0/src/hypervisor/models.py +132 -0
- agent_hypervisor-2.0.0/src/hypervisor/observability/__init__.py +15 -0
- agent_hypervisor-2.0.0/src/hypervisor/observability/causal_trace.py +68 -0
- agent_hypervisor-2.0.0/src/hypervisor/observability/event_bus.py +219 -0
- agent_hypervisor-2.0.0/src/hypervisor/reversibility/__init__.py +1 -0
- agent_hypervisor-2.0.0/src/hypervisor/reversibility/registry.py +107 -0
- agent_hypervisor-2.0.0/src/hypervisor/rings/__init__.py +13 -0
- agent_hypervisor-2.0.0/src/hypervisor/rings/breach_detector.py +218 -0
- agent_hypervisor-2.0.0/src/hypervisor/rings/classifier.py +77 -0
- agent_hypervisor-2.0.0/src/hypervisor/rings/elevation.py +211 -0
- agent_hypervisor-2.0.0/src/hypervisor/rings/enforcer.py +137 -0
- agent_hypervisor-2.0.0/src/hypervisor/saga/__init__.py +16 -0
- agent_hypervisor-2.0.0/src/hypervisor/saga/checkpoint.py +163 -0
- agent_hypervisor-2.0.0/src/hypervisor/saga/dsl.py +238 -0
- agent_hypervisor-2.0.0/src/hypervisor/saga/fan_out.py +192 -0
- agent_hypervisor-2.0.0/src/hypervisor/saga/orchestrator.py +222 -0
- agent_hypervisor-2.0.0/src/hypervisor/saga/state_machine.py +156 -0
- agent_hypervisor-2.0.0/src/hypervisor/security/__init__.py +11 -0
- agent_hypervisor-2.0.0/src/hypervisor/security/kill_switch.py +180 -0
- agent_hypervisor-2.0.0/src/hypervisor/security/rate_limiter.py +176 -0
- agent_hypervisor-2.0.0/src/hypervisor/session/__init__.py +191 -0
- agent_hypervisor-2.0.0/src/hypervisor/session/intent_locks.py +215 -0
- agent_hypervisor-2.0.0/src/hypervisor/session/isolation.py +59 -0
- agent_hypervisor-2.0.0/src/hypervisor/session/sso.py +216 -0
- agent_hypervisor-2.0.0/src/hypervisor/session/vector_clock.py +165 -0
- agent_hypervisor-2.0.0/src/hypervisor/verification/__init__.py +1 -0
- agent_hypervisor-2.0.0/src/hypervisor/verification/history.py +161 -0
- agent_hypervisor-2.0.0/tests/__init__.py +0 -0
- agent_hypervisor-2.0.0/tests/integration/__init__.py +0 -0
- agent_hypervisor-2.0.0/tests/integration/test_hypervisor_e2e.py +538 -0
- agent_hypervisor-2.0.0/tests/integration/test_scenarios.py +1051 -0
- agent_hypervisor-2.0.0/tests/unit/__init__.py +0 -0
- agent_hypervisor-2.0.0/tests/unit/test_audit.py +96 -0
- agent_hypervisor-2.0.0/tests/unit/test_liability.py +110 -0
- agent_hypervisor-2.0.0/tests/unit/test_liability_improvements.py +293 -0
- agent_hypervisor-2.0.0/tests/unit/test_models.py +97 -0
- agent_hypervisor-2.0.0/tests/unit/test_observability.py +215 -0
- agent_hypervisor-2.0.0/tests/unit/test_ring_improvements.py +283 -0
- agent_hypervisor-2.0.0/tests/unit/test_rings.py +121 -0
- agent_hypervisor-2.0.0/tests/unit/test_saga.py +162 -0
- agent_hypervisor-2.0.0/tests/unit/test_saga_improvements.py +365 -0
- agent_hypervisor-2.0.0/tests/unit/test_session.py +98 -0
- agent_hypervisor-2.0.0/tests/unit/test_session_security.py +356 -0
- agent_hypervisor-2.0.0/tests/unit/test_slashing.py +86 -0
- agent_hypervisor-2.0.0/tests/unit/test_vfs_substrate.py +452 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
github: [imran-siddique]
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
name: CI
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
push:
|
|
5
|
+
branches: [master]
|
|
6
|
+
pull_request:
|
|
7
|
+
branches: [master]
|
|
8
|
+
|
|
9
|
+
permissions:
|
|
10
|
+
contents: read
|
|
11
|
+
|
|
12
|
+
jobs:
|
|
13
|
+
test:
|
|
14
|
+
runs-on: ${{ matrix.os }}
|
|
15
|
+
strategy:
|
|
16
|
+
matrix:
|
|
17
|
+
os: [ubuntu-latest, windows-latest]
|
|
18
|
+
python-version: ["3.11", "3.12", "3.13"]
|
|
19
|
+
|
|
20
|
+
steps:
|
|
21
|
+
- uses: actions/checkout@v4
|
|
22
|
+
|
|
23
|
+
- name: Set up Python ${{ matrix.python-version }}
|
|
24
|
+
uses: actions/setup-python@v5
|
|
25
|
+
with:
|
|
26
|
+
python-version: ${{ matrix.python-version }}
|
|
27
|
+
|
|
28
|
+
- name: Install dependencies
|
|
29
|
+
run: |
|
|
30
|
+
python -m pip install --upgrade pip
|
|
31
|
+
pip install -e ".[dev]"
|
|
32
|
+
|
|
33
|
+
- name: Lint with ruff
|
|
34
|
+
run: ruff check src/ tests/
|
|
35
|
+
|
|
36
|
+
- name: Run tests
|
|
37
|
+
run: python -m pytest tests/ -v --tb=short
|
|
38
|
+
|
|
39
|
+
type-check:
|
|
40
|
+
runs-on: ubuntu-latest
|
|
41
|
+
steps:
|
|
42
|
+
- uses: actions/checkout@v4
|
|
43
|
+
- uses: actions/setup-python@v5
|
|
44
|
+
with:
|
|
45
|
+
python-version: "3.12"
|
|
46
|
+
- run: |
|
|
47
|
+
pip install -e ".[dev]"
|
|
48
|
+
mypy src/hypervisor/ --ignore-missing-imports
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
__pycache__/
|
|
2
|
+
*.py[cod]
|
|
3
|
+
*$py.class
|
|
4
|
+
*.so
|
|
5
|
+
*.egg-info/
|
|
6
|
+
dist/
|
|
7
|
+
build/
|
|
8
|
+
.eggs/
|
|
9
|
+
*.egg
|
|
10
|
+
.pytest_cache/
|
|
11
|
+
.mypy_cache/
|
|
12
|
+
.ruff_cache/
|
|
13
|
+
.coverage
|
|
14
|
+
htmlcov/
|
|
15
|
+
*.log
|
|
16
|
+
.env
|
|
17
|
+
.venv/
|
|
18
|
+
venv/
|
|
19
|
+
*.swp
|
|
20
|
+
*.swo
|
|
21
|
+
.DS_Store
|
|
22
|
+
Thumbs.db
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
All notable changes to Agent Hypervisor will be documented in this file.
|
|
4
|
+
|
|
5
|
+
## [2.0.0] — 2026-02-20
|
|
6
|
+
|
|
7
|
+
### Added — Observability
|
|
8
|
+
- **Structured Event Bus** (`observability/event_bus.py`) — append-only event store with typed events, pub/sub, and multi-index queries (by type, agent, session, time range)
|
|
9
|
+
- **Causal Trace IDs** (`observability/causal_trace.py`) — distributed tracing with full spawn/delegation tree encoding (not just correlation IDs)
|
|
10
|
+
|
|
11
|
+
### Added — Ring Improvements
|
|
12
|
+
- **Dynamic Ring Elevation** (`rings/elevation.py`) — time-bounded privilege escalation (like `sudo` with TTL), auto-expiry, manual revocation
|
|
13
|
+
- **Ring Inheritance** — child agents inherit parent ring - 1 (prevents privilege escalation via spawning)
|
|
14
|
+
- **Ring Breach Detector** (`rings/breach_detector.py`) — sliding window anomaly scoring for ring call patterns, circuit breaker on HIGH/CRITICAL severity
|
|
15
|
+
|
|
16
|
+
### Added — Liability Improvements
|
|
17
|
+
- **Causal Attribution** (`liability/attribution.py`) — Shapley-value inspired proportional fault scoring (replaces binary guilty/not-guilty)
|
|
18
|
+
- **Quarantine Manager** (`liability/quarantine.py`) — read-only isolation before termination, forensic data preservation, auto-release with timeout
|
|
19
|
+
- **Persistent Liability Ledger** (`liability/ledger.py`) — per-agent historical risk scoring, admission decisions (admit/probation/deny)
|
|
20
|
+
|
|
21
|
+
### Added — Saga Improvements
|
|
22
|
+
- **Parallel Fan-Out** (`saga/fan_out.py`) — concurrent branch execution with `ALL_MUST_SUCCEED`, `MAJORITY_MUST_SUCCEED`, `ANY_MUST_SUCCEED` policies
|
|
23
|
+
- **Semantic Checkpoints** (`saga/checkpoint.py`) — capture what goal was achieved (not just state), enabling partial replay without re-running completed effects
|
|
24
|
+
- **Declarative Saga DSL** (`saga/dsl.py`) — define saga topology via dict/YAML with validation, fan-out support, and SagaStep conversion
|
|
25
|
+
|
|
26
|
+
### Added — Session Improvements
|
|
27
|
+
- **Vector Clocks** (`session/vector_clock.py`) — causal consistency enforcement, stale-write rejection, automatic merge on read
|
|
28
|
+
- **Intent Locks** (`session/intent_locks.py`) — READ/WRITE/EXCLUSIVE lock declarations with contention detection and deadlock prevention (wait-for graph)
|
|
29
|
+
- **Isolation Levels** (`session/isolation.py`) — SNAPSHOT, READ_COMMITTED, SERIALIZABLE per saga (low-stakes sagas skip coordination cost)
|
|
30
|
+
|
|
31
|
+
### Added — Security
|
|
32
|
+
- **Agent Rate Limiter** (`security/rate_limiter.py`) — token bucket per agent per ring, configurable limits, automatic refill
|
|
33
|
+
- **Kill Switch** (`security/kill_switch.py`) — graceful agent termination with in-flight saga step handoff to substitute agents
|
|
34
|
+
|
|
35
|
+
### Changed
|
|
36
|
+
- Package version bumped to 2.0.0
|
|
37
|
+
- 58 public exports (up from 28)
|
|
38
|
+
- **326 tests** (up from 184)
|
|
39
|
+
|
|
40
|
+
## [1.0.0] — 2026-02-20
|
|
41
|
+
|
|
42
|
+
### Added
|
|
43
|
+
- **Core Hypervisor** orchestrator with session lifecycle management
|
|
44
|
+
- **Shared Session Object (SSO)** with VFS, snapshots, and consistency modes
|
|
45
|
+
- **4-Ring Execution Model** (Ring 0 Root → Ring 3 Sandbox) based on σ_eff trust scores
|
|
46
|
+
- **Joint Liability Engine** with vouching, bonding, and proportional slashing
|
|
47
|
+
- **Saga Orchestrator** with step timeouts, retries, and reverse-order compensation
|
|
48
|
+
- **Merkle-Chained Audit** with delta capture, commitment engine, and ephemeral GC
|
|
49
|
+
- **Reversibility Registry** for execute/undo API mapping with 4 reversibility levels
|
|
50
|
+
- **Transaction History Verifier** for DID-based trust verification
|
|
51
|
+
- **Integration Adapters** (Protocol-based, zero hard dependencies):
|
|
52
|
+
- Nexus adapter — trust score resolution and caching
|
|
53
|
+
- CMVK adapter — behavioral drift detection with severity thresholds
|
|
54
|
+
- IATP adapter — capability manifest parsing and trust hints
|
|
55
|
+
- **184 tests** (unit, integration, and scenario tests)
|
|
56
|
+
- **Performance benchmarks** (268μs full pipeline)
|
|
57
|
+
- **Interactive demo** (`examples/demo.py`) showcasing all 5 subsystems
|
|
58
|
+
- Extracted from [Agent OS](https://github.com/imran-siddique/agent-os) as standalone package
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
# Contributing to Agent Hypervisor
|
|
2
|
+
|
|
3
|
+
Thank you for your interest in contributing! We welcome contributions of all kinds.
|
|
4
|
+
|
|
5
|
+
## Getting Started
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
git clone https://github.com/imran-siddique/agent-hypervisor.git
|
|
9
|
+
cd agent-hypervisor
|
|
10
|
+
pip install -e ".[dev]"
|
|
11
|
+
python -m pytest tests/ -v
|
|
12
|
+
```
|
|
13
|
+
|
|
14
|
+
## Development Workflow
|
|
15
|
+
|
|
16
|
+
1. Fork the repository
|
|
17
|
+
2. Create a feature branch (`git checkout -b feat/my-feature`)
|
|
18
|
+
3. Make your changes
|
|
19
|
+
4. Run tests: `python -m pytest tests/ -v`
|
|
20
|
+
5. Run linting: `ruff check src/ tests/`
|
|
21
|
+
6. Commit with [conventional commits](https://www.conventionalcommits.org/): `feat:`, `fix:`, `docs:`, etc.
|
|
22
|
+
7. Open a Pull Request
|
|
23
|
+
|
|
24
|
+
## Architecture
|
|
25
|
+
|
|
26
|
+
The hypervisor is organized into 7 subsystems + integration adapters:
|
|
27
|
+
|
|
28
|
+
| Module | Purpose |
|
|
29
|
+
|--------|---------|
|
|
30
|
+
| `session/` | Shared Session Object (SSO) lifecycle |
|
|
31
|
+
| `rings/` | 4-ring execution privilege model |
|
|
32
|
+
| `liability/` | Vouching, bonding, collateral slashing |
|
|
33
|
+
| `reversibility/` | Execute/Undo API mapping |
|
|
34
|
+
| `saga/` | Semantic saga with compensation |
|
|
35
|
+
| `audit/` | Merkle-chained delta engine |
|
|
36
|
+
| `verification/` | DID transaction history |
|
|
37
|
+
| `integrations/` | Nexus, CMVK, IATP adapters |
|
|
38
|
+
|
|
39
|
+
## Code Style
|
|
40
|
+
|
|
41
|
+
- Python 3.11+
|
|
42
|
+
- Type hints on all public APIs
|
|
43
|
+
- Ruff for linting (`ruff check`)
|
|
44
|
+
- MyPy for type checking (`mypy src/`)
|
|
45
|
+
- Max line length: 100
|
|
46
|
+
|
|
47
|
+
## Testing
|
|
48
|
+
|
|
49
|
+
```bash
|
|
50
|
+
# All tests
|
|
51
|
+
python -m pytest tests/ -v
|
|
52
|
+
|
|
53
|
+
# Unit tests only
|
|
54
|
+
python -m pytest tests/unit/ -v
|
|
55
|
+
|
|
56
|
+
# Integration tests
|
|
57
|
+
python -m pytest tests/integration/ -v
|
|
58
|
+
|
|
59
|
+
# Benchmarks
|
|
60
|
+
python benchmarks/bench_hypervisor.py
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
## Related Projects
|
|
64
|
+
|
|
65
|
+
- [Agent OS](https://github.com/imran-siddique/agent-os) — Governance kernel
|
|
66
|
+
- [Agent Mesh](https://github.com/imran-siddique/agent-mesh) — Trust network
|
|
67
|
+
- [Agent SRE](https://github.com/imran-siddique/agent-sre) — Reliability platform
|
|
@@ -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.
|
|
@@ -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
|
+
[](https://github.com/imran-siddique/agent-hypervisor/stargazers)
|
|
50
|
+
[](https://github.com/sponsors/imran-siddique)
|
|
51
|
+
[](https://github.com/imran-siddique/agent-hypervisor/actions)
|
|
52
|
+
[](https://github.com/imran-siddique/agent-hypervisor)
|
|
53
|
+
[](benchmarks/)
|
|
54
|
+
[](https://pypi.org/project/agent-hypervisor/)
|
|
55
|
+
[](LICENSE)
|
|
56
|
+
[](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>
|