How sagarchhatrala/horizon-agent-containment works
HAC is a deterministic containment engine for long-horizon agent actions. An agent action enters through the engine directly or through the MCP adapter; HAC validates it, applies it to a hypothetical security state while preserving artifact provenance and graph relationships, derives capabilities, and evaluates invariants. The engine commits allowed state changes and blocks invalid or malformed actions. The optional ACB bridge adds action-level enforcement. The Streamlit demo and documented attack scenarios present the engine’s decisions and state. Core relationships are grounded in excerpts and README; links to unsampled demo/scenario implementations are documented rather than inferred.
Main entry points: engine.py HAC Engine · state.py Security State · transitions.py Action Validation and Transitions · acb.py ACB Bridge
Components 19
Action Interfaces
- MCP Adapter
adapters/mcp.py - ACB Bridge
adapters/acb.py - Simulator Adapter
adapters/simulator.py
Containment Engine
- HAC Engine
src/hac/engine.py - Decision Model
src/hac/decisions.py - Action Validation and Transitions
src/hac/transitions.py - Invariant Evaluation
src/hac/evaluator.py - Capability Derivation
src/hac/capabilities.py - Security Invariants
src/hac/invariants.py - Authority Checks
src/hac/authority.py
Security State
- Provenance Lineage
src/hac/provenance.py - Security State
src/hac/state.py - Capability Graph
src/hac/graph.py - Domain Models
src/hac/models.py
Scenarios and Demo
- Scenario Workflows
scenarios - Streamlit Demo
demo/app.py
Other components
- AI Agent
- ACB Enforcer
- External Resources
Connections 21
- AI Agent → MCP Adapter: sends tool request
adapters/mcp.py - MCP Adapter → HAC Engine: evaluates action
adapters/mcp.py - AI Agent → ACB Bridge: submits action
README.md - ACB Bridge → HAC Engine: evaluates action
adapters/acb.py - ACB Bridge → ACB Enforcer: optionally enforces
adapters/acb.py - Simulator Adapter → HAC Engine: evaluates action
adapters/simulator.py - HAC Engine → Action Validation and Transitions: validates and applies
src/hac/engine.py - HAC Engine → Invariant Evaluation: evaluates resulting state
src/hac/engine.py - HAC Engine → Security State: reads and commits
src/hac/engine.py - HAC Engine → Decision Model: returns decision
src/hac/engine.py - Action Validation and Transitions → Security State: clones and updates
src/hac/transitions.py - Action Validation and Transitions → Provenance Lineage: inherits lineage
src/hac/transitions.py - Action Validation and Transitions → Capability Graph: records relationships
src/hac/transitions.py - Invariant Evaluation → Capability Derivation: derives capabilities
src/hac/evaluator.py - Invariant Evaluation → Security Invariants: checks invariants
src/hac/evaluator.py - Capability Derivation → Security State: reads state and history
src/hac/capabilities.py - Authority Checks → Security State: checks delegations
src/hac/authority.py - Security State → Capability Graph: stores graph
src/hac/state.py - Scenario Workflows → HAC Engine: provides actions
README.md - Streamlit Demo → HAC Engine: demonstrates decisions
README.md - External Resources → HAC Engine: modeled in actions
README.md