Skip to main content

openhands-nti

NTI Conformant License Leaderboard

Drop-in Neutral Trust Infrastructure (NTI) guardrail for the OpenHands agent framework.

NTI Conformant. This wrapper is verified against the NTI conformance suite and ranked on the public NTI leaderboard. Licensed under Apache-2.0.

A one-line change intercepts every OpenHands action -- bash, Python execution, file edits, browser and web requests, MCP tools, and client tools -- and wraps it in NTI verification: an ML-DSA-87 signature over the action and a Merkle delegation-chain proof that the action is authorized, checked before the tool runs. Denials fail closed.

from openhands_nti import NTIGuardrail

NTIGuardrail(
    agent_did="did:webvh:z6Mk...:agents.example.com",
    key_pair=key_pair,               # ube_foundation.PqcKeyPair (ML-DSA-87)
    delegation_chain=delegation_chain,
).install()

# ... run your agent as usual ...

That is the whole integration. install() patches the single OpenHands method every tool call funnels through, so no per-tool wiring is needed. Call uninstall() (or use the guardrail as a context manager) to restore the original behavior.

What happens on every action

  1. Intercept. openhands.sdk.tool.tool.ToolDefinition.__call__ is wrapped. The sync agent loop and the async acall path both pass through it, so bash, the IPython tool, the file editor, browser/web tools, MCP tools, and client tools are all covered by one patch.
  2. Resolve the capability. The tool name is mapped to an NTI capability (for example bash -> shell.execute). Override or extend the mapping.
  3. Prove delegation. The delegation record granting that capability to the agent's DID must be included in the Merkle chain. The proof is folded back to the recomputed chain root; a mismatch fails closed.
  4. Sign. The action is canonicalized and signed with ML-DSA-87 over the engine's exact signed tuple: (request_id, actor, capability, action, input).
  5. Authorize. The NTI TrustEngine returns a verdict. Anything other than Allow blocks the action.
  6. Execute and attest. Only then does the original tool run, and the signed receipt is attached to its output as observation.nti_receipt.

If any step fails -- unknown capability, missing delegation record, bad signature, engine denial, an unexpected error -- the tool never executes. The incident is written to the audit trail and NTIBlocked is raised.

Install

pip install openhands-nti            # core (ube-foundation)
pip install "openhands-nti[openhands]"  # + openhands-sdk

Usage

One-line install

from openhands_nti import NTIGuardrail

guardrail = NTIGuardrail(
    agent_did=AGENT_DID,
    key_pair=key_pair,
    delegation_chain=chain,
).install()

Context manager

from openhands_nti import NTIGuardrail

with NTIGuardrail(agent_did=AGENT_DID, key_pair=key_pair, delegation_chain=chain):
    conversation.run()

Reading receipts

Every allowed action returns an observation carrying a signed receipt:

observation = bash_tool(BashAction(command="ls -la"))
receipt = observation.nti_receipt
# receipt["ml_dsa_87_signature"] -> "ml-dsa-87:4627:..."

Verify it against the agent's public key:

from openhands_nti import verify_receipt

assert verify_receipt(receipt, key_pair)

Custom capability mapping

NTIGuardrail(
    agent_did=AGENT_DID,
    key_pair=key_pair,
    delegation_chain=chain,
    capability_overrides={"bash": "shell.execute", "my_custom_tool": "data.read"},
    # or fully custom:
    # capability_resolver=lambda tool_name: f"tool.{tool_name}",
).install()

Delegation chain format

Each record is a JSON object. The guardrail hashes records with the NTI reference construction:

  • leaf: sha256(b"nti-delegation-leaf-v1:" || canonical_json(record))
  • node: sha256(b"nti-delegation-node-v1:" || left || right)
  • odd node: promoted unchanged (RFC 6962), never duplicated
{
  "delegation_id": "sha256:root",
  "parent_delegation_id": null,
  "issuer": "did:webvh:z6MkIssuer...:issuer.example.com",
  "subject": "did:webvh:z6MkAgent...:agents.example.com",
  "scope": ["shell.execute", "file.write"],
  "issued_at": "2026-01-01T00:00:00Z",
  "depth_remaining": 2
}

Security notes

  • Fail-closed. Every failure path blocks the action. There is no "allow on error" mode.
  • ML-DSA-87, not DER/ECDSA. Signatures are raw ML-DSA-87 bytes in the NTI tagged form ml-dsa-87:{length}:{hex}. parse_tagged_signature rejects DER/base64-looking input.
  • Canonicalization is a security boundary. See SECURITY.md for the float-canonicalization hazard and the float_policy controls.

Architecture

flowchart TD
    Agent["OpenHands Agent<br/>LLM reasoning loop"]
    Wrapper["NTI Wrapper<br/>openhands_nti.guardrail"]
    Canon["Canonicalizer<br/>float_policy=round"]
    Chain["Merkle Delegation Chain<br/>RFC 6962"]
    Sidecar["Rust Sidecar<br/>ube-foundation TrustEngine"]
    Sign["ML-DSA-87 Signature<br/>ml-dsa-87:4627:hex"]
    Verify["Verification Endpoint<br/>TrustEngine.evaluate()"]
    Exec["Execute tool + receipt"]
    Block["Block action (fail-closed)"]

    Agent -->|"tool call"| Wrapper
    Wrapper --> Canon
    Wrapper --> Chain
    Canon --> Sidecar
    Chain --> Sidecar
    Sidecar --> Sign
    Sign --> Verify
    Verify -->|"Allow"| Exec
    Verify -->|"Deny / error"| Block
    Exec --> Agent
    Block --> Agent

Full flow, stage table, sequence diagram, and a gitdiagram.com link: see ARCHITECTURE.md.

Development

pip install -e ".[dev]"
pytest

The tests exercise the real ube_foundation bindings and the real openhands-sdk execution path -- no mocks.

License

Apache License 2.0. See LICENSE for the full text.

Conformance

This wrapper is NTI Conformant and tracked on the public NTI leaderboard.

Metadata

Release files for openhands-nti 0.1.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for openhands-nti 0.1.1
File Size Uploaded Provenance Actions
openhands_nti-0.1.1.tar.gz 26.4 kB With provenance Details for openhands_nti-0.1.1.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for openhands-nti 0.1.1
File Interpreter ABI Platform Actions
openhands_nti-0.1.1-py3-none-any.whl Python 3 none any Details for openhands_nti-0.1.1-py3-none-any.whl

Total release size: 49.6 kB

Release files / openhands_nti-0.1.1.tar.gz

Download URL openhands_nti-0.1.1.tar.gz
Size 26.4 kB
Tags Source
SHA-256 checksum
How to use checksums
432550bed10b4989e9f20e5fb0ee236afbe30a4f78acc67fccb1ddd3d25cc646
BLAKE2b-256 checksum
How to use checksums
21b8b80ab3bddc8a0fb9a19c45af73caa0b82adde8e7d889337749baabe16cbd
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 25, 2026.

Transparency log

Release files / openhands_nti-0.1.1-py3-none-any.whl

Download URL openhands_nti-0.1.1-py3-none-any.whl
Size 23.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
4d83daa0709297bd4411a857f7555771ae33627985045773734d6eef08e95340
BLAKE2b-256 checksum
How to use checksums
5aebbee8ca46499d1268b0f22ab1fe29af9c58398bfd00fe6f0dcc89b09e3458
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 25, 2026.

Transparency log

Security for openhands-nti 0.1.1

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for openhands_nti-0.1.1.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 25, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.1.1 This release

2 release files Full provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page