GitHub - saezbaldo/ic-agi: Infrastructure Critical Anti-AGI: Distributed execution framework that separates intelligence from authority. K-of-N threshold auth, capability tokens, formal verification (TLA+), sandboxed execution.

5 min read Original article β†—

Separate intelligence from authority.

IC-AGI is a distributed execution and authority framework that ensures no single entity β€” human or artificial β€” can unilaterally execute critical actions. It is designed to control actors that may be more intelligent than the control system itself.

Tests TLA+ Python License Phase


🧠 The Problem

"The power of AI agents comes from intelligence, data access, and freedom to act. But security is the biggest bottleneck for broad adoption."

As AI agents become more capable, the core challenge shifts from capability to containment:

  • The more data & control you give an AI agent, the more it can help you β€” and the more it can hurt you.
  • No single machine should hold the keys to critical infrastructure.
  • Traditional access control assumes trusted principals. AI agents are adversarial by design assumption.

IC-AGI solves this by distributing authority so that no single point of compromise can lead to uncontrolled action.


πŸ—οΈ Architecture

β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚              CONTROL PLANE              β”‚
β”‚  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”‚
β”‚  β”‚ Policy   β”‚ β”‚Capabilityβ”‚ β”‚Thresholdβ”‚ β”‚
β”‚  β”‚ Engine   β”‚ β”‚ Issuer   β”‚ β”‚Approversβ”‚ β”‚
β”‚  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β”‚
β”‚         β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”                β”‚
β”‚         β”‚  Audit Ledgerβ”‚ (append-only)  β”‚
β”‚         β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜                β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
                  β”‚ Capability Tokens
                  β”‚ (TTL + Scope + Budget)
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β–Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚             EXECUTION PLANE             β”‚
β”‚  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”    β”‚
β”‚  β”‚Worker 0β”‚  β”‚Worker 1β”‚  β”‚Worker 2β”‚    β”‚
β”‚  β”‚(shard) β”‚  β”‚(shard) β”‚  β”‚(shard) β”‚    β”‚
β”‚  β””β”€β”€β”€β”€β”€β”€β”€β”€β”˜  β””β”€β”€β”€β”€β”€β”€β”€β”€β”˜  β””β”€β”€β”€β”€β”€β”€β”€β”€β”˜    β”‚
β”‚  No worker sees ALL segments.           β”‚
β”‚  State encrypted in transit (HMAC).     β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

πŸ” Core Security Guarantees

Guarantee Mechanism Formally Verified
No unilateral authority K-of-N threshold approval (Shamir SSS) βœ… TLA+ P1-P4
Capability-bounded execution Tokens with TTL, scope, and consumable budget βœ… TLA+ P5-P9
Anti-replay HMAC-SHA256 signatures, budget=1 enforcement βœ… TLA+ P5
Segment isolation No worker holds all IR segments βœ… TLA+ P10-P14
Tamper detection Encrypt-then-MAC on state in transit βœ… TLA+ P13
Oracle abuse prevention Rate limiting + behavioral fingerprinting βœ… Tested
Compromised node isolation Circuit breaker (CLOSEDβ†’OPENβ†’HALF_OPEN) βœ… Tested
Proactive key rotation Zero-polynomial protocol (secret never reconstructed) βœ… Algebraic proof A4-A5

⚑ Quick Start

# Clone
git clone https://github.com/saezbaldo/ic-agi.git
cd ic-agi

# Install
pip install -r requirements.txt

# Run tests (273 checks)
python -m pytest ic_agi/ -v

# Start the control plane
python -m ic_agi.service

Execute a function

# Simple addition (distributed across workers)
curl -X POST http://localhost:8080/execute \
  -H "Content-Type: application/json" \
  -d '{"function": "add", "operands": [3, 7]}'

# Custom sandboxed code
curl -X POST http://localhost:8080/execute \
  -H "Content-Type: application/json" \
  -d '{
    "function": "custom",
    "code": "result = sum(range(100))",
    "inputs": {},
    "output_names": ["result"]
  }'

πŸ§ͺ What's Been Verified

Formal Verification (TLA+ & Algebraic Proofs)

  • 14 safety properties verified via exhaustive model checking (~50,000+ states, ~250,000+ property checks)
  • 8 algebraic proofs of Shamir Secret Sharing correctness
  • Zero violations found

Adversarial Testing

Attack Vector Result
Forged HMAC token ❌ Rejected
Replay attack (consumed token) ❌ Rejected
Expired token reuse ❌ Rejected
Tampered state in transit ❌ Detected via MAC
Man-in-the-middle (altered operands) ❌ HMAC integrity check fails
Malicious code injection (import, eval, exec) ❌ AST validator rejects
Oracle extraction (repeated queries) ❌ Anti-oracle blocks
Distributed flooding ❌ Global rate cap
Combined multi-vector attack ❌ All vectors blocked

Test Results

Suite Checks Status
Unit tests 7/7 βœ…
Shamir crypto 23/23 βœ…
Adversarial attacks 32/32 βœ…
Integration (GKE) 49/49 βœ…
Distributed execution 25/25 βœ…
Anti-oracle & rate limiting 47/47 βœ…
Sandbox runtime & MITM 58/58 βœ…
Formal verification 32/32 βœ…
Total 273/273 βœ…

πŸ—ΊοΈ Roadmap

Phase Description Status
1 IR Specification & Sandboxed Execution βœ… Complete
2 Capability System (TTL, Scope, Budget) βœ… Complete
3 Threshold Authorization (K-of-N) βœ… Complete
4 Real Cryptography (Shamir, HMAC-SHA256) βœ… Complete
5 Distributed Worker Communication (K8s) βœ… Complete
6 Anti-Oracle & Rate Limiting βœ… Complete
7 Real Runtime + Adversarial Testing βœ… Complete
8 Formal Verification (TLA+) βœ… Complete
9 Governance Protocols πŸ”„ In Progress
10 Production Hardening πŸ“‹ Planned

πŸ›οΈ Design Principles

  1. No single node contains full authority.
  2. No single node contains full program logic.
  3. Execution requires explicit capabilities with TTL and scope.
  4. Critical actions require K-of-N threshold approval.
  5. All state transitions are auditable.
  6. Oracle abuse is rate-limited and monitored.
  7. Secrets are rotated proactively.

πŸ”¬ How It's Different

IC-AGI is not a new cryptographic primitive. Every component exists independently:

  • Shamir Secret Sharing (1979)
  • Capability-based security (1966)
  • Threshold signatures (1991)
  • Circuit breakers (2007)

What's novel is the composition thesis: a system designed from first principles to control actors that are potentially more intelligent than the control system itself. No existing system combines threshold authorization, distributed IR execution, capability tokens with consumable budgets, anti-oracle detection, and formal verification into a single framework purpose-built for AI agent containment.

See the full Competitive Analysis for detailed comparison against Kerberos, HashiCorp Vault, Gnosis Safe, Temporal.io, LangChain, and others.


πŸ“‚ Project Structure

ic_agi/
β”œβ”€β”€ ir_definition.py        # Intermediate Representation (opcodes, segments)
β”œβ”€β”€ share_manager.py         # Shamir Secret Sharing over GF(p)
β”œβ”€β”€ threshold_auth.py        # K-of-N threshold authorization
β”œβ”€β”€ threshold_crypto.py      # Cryptographic threshold operations
β”œβ”€β”€ control_plane.py         # Policy engine + capability issuer
β”œβ”€β”€ worker.py                # Local IR execution worker
β”œβ”€β”€ remote_worker.py         # Distributed worker (HTTP/K8s)
β”œβ”€β”€ scheduler.py             # IR segment routing
β”œβ”€β”€ sandbox_executor.py      # AST-validated Python sandbox
β”œβ”€β”€ crypto_utils.py          # HMAC-SHA256 encrypt-then-MAC
β”œβ”€β”€ audit_log.py             # Append-only audit ledger
β”œβ”€β”€ rate_limiter.py          # Sliding-window rate limiter
β”œβ”€β”€ anti_oracle.py           # Behavioral fingerprinting
β”œβ”€β”€ circuit_breaker.py       # Worker health state machine
β”œβ”€β”€ service.py               # HTTP API (FastAPI)
β”œβ”€β”€ formal/
β”‚   β”œβ”€β”€ ThresholdAuth.tla     # TLA+ spec (P1-P4)
β”‚   β”œβ”€β”€ CapabilityTokens.tla  # TLA+ spec (P5-P9)
β”‚   β”œβ”€β”€ DistributedExecution.tla # TLA+ spec (P10-P14)
β”‚   β”œβ”€β”€ model_checker.py      # Exhaustive BFS model checker
β”‚   └── shamir_proofs.py      # Algebraic proofs (A1-A8)
k8s/                          # Kubernetes manifests (GKE-ready)

🀝 Contributing

We welcome contributions from:

  • Cryptographers β€” threshold schemes, MPC protocols
  • Distributed systems engineers β€” consensus, fault tolerance
  • AI safety researchers β€” containment strategies, threat models
  • Formal methods experts β€” TLA+, TLAPS proofs, Coq/Lean
  • Security auditors β€” penetration testing, adversarial analysis

πŸ“„ License

Apache 2.0


πŸ“¬ Contact


IC-AGI is not about hiding code from intelligence. It is about separating intelligence from authority.