# abisheakp197/openhands---nti architecture

> Architecture diagram of the GitHub repository abisheakp197/openhands---nti, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-11-25). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/abisheakp197/openhands---nti
- Repository: https://github.com/abisheakp197/openhands---nti

## Overview

openhands-nti is a drop-in NTI security wrapper for OpenHands. An agent’s tool call passes through the patched SDK entry point, where the guardrail resolves the required capability, proves delegation, canonicalizes and signs the action, and asks the NTI engine for authorization. Allowed calls execute and receive a signed receipt; failures are audited and blocked. The package also exposes receipt verification and configurable capability mappings. Edges reflect the README and shown guardrail calls; the underlying OpenHands and NTI engine implementations are external dependencies, not inspected repository code.

Main entry points: [`openhands_nti/guardrail.py`](https://github.com/abisheakp197/openhands---nti/blob/main/openhands_nti/guardrail.py) (NTI guardrail), [`openhands_nti/receipt.py`](https://github.com/abisheakp197/openhands---nti/blob/main/openhands_nti/receipt.py) (Signed receipts), [`openhands_nti/policy.py`](https://github.com/abisheakp197/openhands---nti/blob/main/openhands_nti/policy.py) (Capability mapping), [`openhands_nti/delegation.py`](https://github.com/abisheakp197/openhands---nti/blob/main/openhands_nti/delegation.py) (Merkle delegation proof)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_integration["OpenHands integration"]
  node_sdk_entry["Tool call entry"]
  node_guardrail["NTI guardrail<br/>[guardrail.py]"]
  node_tools["OpenHands tools"]
end

subgraph group_authorization["Action authorization"]
  node_capability["Capability mapping<br/>[policy.py]"]
  node_delegation["Merkle delegation proof<br/>[delegation.py]"]
  node_engine["NTI TrustEngine"]
end

subgraph group_attestation["Receipts and audit"]
  node_receipt["Signed receipts<br/>[receipt.py]"]
  node_audit["Audit trail<br/>[audit.py]"]
  node_receipt_verifier["Receipt verification API<br/>[receipt.py]"]
end

subgraph group_support["Security primitives"]
  node_canonical["Action canonicalization<br/>[canonical.py]"]
  node_errors["Fail-closed errors<br/>[errors.py]"]
end

node_agent(("OpenHands agent"))

node_agent -->|"calls tool"| node_sdk_entry
node_sdk_entry -->|"dispatches through"| node_guardrail
node_guardrail -->|"resolves capability"| node_capability
node_guardrail -->|"builds proof"| node_delegation
node_guardrail -->|"canonicalizes action"| node_canonical
node_guardrail -->|"evaluates signed request"| node_engine
node_engine -->|"returns verdict"| node_guardrail
node_guardrail -->|"builds receipt"| node_receipt
node_guardrail -->|"records decisions"| node_audit
node_guardrail -->|"executes if allowed"| node_tools
node_guardrail -->|"blocks on failure"| node_errors
node_receipt_verifier -->|"verifies signature"| node_receipt
node_guardrail -->|"returns observation"| node_agent

click node_guardrail "https://github.com/abisheakp197/openhands---nti/blob/main/openhands_nti/guardrail.py"
click node_capability "https://github.com/abisheakp197/openhands---nti/blob/main/openhands_nti/policy.py"
click node_delegation "https://github.com/abisheakp197/openhands---nti/blob/main/openhands_nti/delegation.py"
click node_canonical "https://github.com/abisheakp197/openhands---nti/blob/main/openhands_nti/canonical.py"
click node_receipt "https://github.com/abisheakp197/openhands---nti/blob/main/openhands_nti/receipt.py"
click node_audit "https://github.com/abisheakp197/openhands---nti/blob/main/openhands_nti/audit.py"
click node_errors "https://github.com/abisheakp197/openhands---nti/blob/main/openhands_nti/errors.py"
click node_receipt_verifier "https://github.com/abisheakp197/openhands---nti/blob/main/openhands_nti/receipt.py"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_sdk_entry,node_guardrail,node_tools toneBlue
class node_capability,node_delegation,node_engine toneAmber
class node_receipt,node_audit,node_receipt_verifier toneMint
class node_canonical,node_errors toneRose
class node_agent toneIndigo
```

## Components

### OpenHands integration

- **Tool call entry**
- [NTI guardrail](https://github.com/abisheakp197/openhands---nti/blob/main/openhands_nti/guardrail.py): `openhands_nti/guardrail.py`
- **OpenHands tools**

### Action authorization

- [Capability mapping](https://github.com/abisheakp197/openhands---nti/blob/main/openhands_nti/policy.py): `openhands_nti/policy.py`
- [Merkle delegation proof](https://github.com/abisheakp197/openhands---nti/blob/main/openhands_nti/delegation.py): `openhands_nti/delegation.py`
- **NTI TrustEngine**

### Receipts and audit

- [Signed receipts](https://github.com/abisheakp197/openhands---nti/blob/main/openhands_nti/receipt.py): `openhands_nti/receipt.py`
- [Audit trail](https://github.com/abisheakp197/openhands---nti/blob/main/openhands_nti/audit.py): `openhands_nti/audit.py`
- [Receipt verification API](https://github.com/abisheakp197/openhands---nti/blob/main/openhands_nti/receipt.py): `openhands_nti/receipt.py`

### Security primitives

- [Action canonicalization](https://github.com/abisheakp197/openhands---nti/blob/main/openhands_nti/canonical.py): `openhands_nti/canonical.py`
- [Fail-closed errors](https://github.com/abisheakp197/openhands---nti/blob/main/openhands_nti/errors.py): `openhands_nti/errors.py`

### Other components

- **OpenHands agent**

## Connections

- OpenHands agent → Tool call entry: calls tool (evidence: `README.md`)
- Tool call entry → NTI guardrail: dispatches through (evidence: `README.md`)
- NTI guardrail → Capability mapping: resolves capability (evidence: `openhands_nti/guardrail.py`)
- NTI guardrail → Merkle delegation proof: builds proof (evidence: `openhands_nti/guardrail.py`)
- NTI guardrail → Action canonicalization: canonicalizes action (evidence: `openhands_nti/guardrail.py`)
- NTI guardrail → NTI TrustEngine: evaluates signed request (evidence: `openhands_nti/guardrail.py`)
- NTI TrustEngine → NTI guardrail: returns verdict (evidence: `README.md`)
- NTI guardrail → Signed receipts: builds receipt (evidence: `openhands_nti/guardrail.py`)
- NTI guardrail → Audit trail: records decisions (evidence: `openhands_nti/guardrail.py`)
- NTI guardrail → OpenHands tools: executes if allowed (evidence: `openhands_nti/guardrail.py`)
- NTI guardrail → Fail-closed errors: blocks on failure (evidence: `openhands_nti/guardrail.py`)
- Receipt verification API → Signed receipts: verifies signature (evidence: `openhands_nti/receipt.py`)
- NTI guardrail → OpenHands agent: returns observation (evidence: `README.md`)
