Skip to main content

OCC cryptographic proof signing for LlamaIndex

Project description

occ-llamaindex

OCC cryptographic proof signing for LlamaIndex.

Every tool call produces an Ed25519-signed proof entry in proof.jsonl, creating a tamper-evident audit log of agent actions.

Install

pip install occ-llamaindex

Quick Start

Callback Handler (recommended)

from llama_index.core.callbacks import CallbackManager
from occ_llamaindex import OccCallbackHandler

handler = OccCallbackHandler()
callback_manager = CallbackManager([handler])
# Pass callback_manager to your agent or query engine

Wrap Individual Tools

from llama_index.core.tools import FunctionTool
from occ_llamaindex import OccTool

def search(query: str) -> str:
    return f"Results for {query}"

tool = FunctionTool.from_defaults(fn=search)
safe_tool = OccTool(inner=tool)

Wrap All Tools

from occ_llamaindex import wrap_tools

safe_tools = wrap_tools([search_tool, calc_tool])
agent = ReActAgent.from_tools(safe_tools)

Custom Signer

from occ_llamaindex import OCCSigner, OccCallbackHandler

signer = OCCSigner(state_dir="/tmp/.occ", proof_file="audit.jsonl")
handler = OccCallbackHandler(signer=signer)

Proof Format

Each line in proof.jsonl is a JSON object:

{
  "version": "occ/proof/1",
  "timestamp": "2026-03-20T12:00:00.000Z",
  "signer": "<base64url-ed25519-public-key>",
  "payload": {
    "type": "tool-call",
    "tool": "search",
    "inputHash": "<sha256-hex>",
    "outputHash": "<sha256-hex>"
  },
  "signature": "<base64url-ed25519-signature>",
  "prev": "<sha256-hex-of-previous-proof>"
}

Proofs are chained: each proof's prev field contains the SHA-256 hash of the previous proof's canonical JSON.

Configuration

  • State directory: Keypair stored in .occ/signer-state.json (defaults to CWD)
  • Proof file: Defaults to proof.jsonl in CWD
  • Both configurable via OCCSigner(state_dir=..., proof_file=...)

License

Apache-2.0

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

occ_llamaindex-0.1.0.tar.gz (4.9 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

occ_llamaindex-0.1.0-py3-none-any.whl (6.0 kB view details)

Uploaded Python 3

File details

Details for the file occ_llamaindex-0.1.0.tar.gz.

File metadata

  • Download URL: occ_llamaindex-0.1.0.tar.gz
  • Upload date:
  • Size: 4.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.9.6

File hashes

Hashes for occ_llamaindex-0.1.0.tar.gz
Algorithm Hash digest
SHA256 91b9629500e0d4e418bb1b096bafe323782e6c0d8e9a51074c483a880f333c99
MD5 5de6c3e7ed3472db8182dac53a314ca9
BLAKE2b-256 ef9b67639d42ff1d835926f2f9e85e8da721cfa571858f9c84f4926a49224ccf

See more details on using hashes here.

File details

Details for the file occ_llamaindex-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: occ_llamaindex-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 6.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.9.6

File hashes

Hashes for occ_llamaindex-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 fbffb7ea2fe71fc2912cdcc05a670220bec03f362f05a9a3c94654a69e70eae6
MD5 6c569477b6cca612610d8293f85f1a5f
BLAKE2b-256 2c28fecaf6ec0583f09eda960065eeda8f592b193b4cc4ae7cd44d2ff2ba2f5b

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page