Skip to main content

occ-anthropic

OCC cryptographic proof signing for the Anthropic Python SDK.

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-anthropic

Quick Start

Wrap Client

import anthropic
from occ_anthropic import wrap_client

client = anthropic.Anthropic()
client = wrap_client(client)

# Every messages.create() with tool_use responses is now signed
response = client.messages.create(
    model="claude-sonnet-4-20250514",
    max_tokens=1024,
    tools=[{
        "name": "search",
        "description": "Search the web",
        "input_schema": {
            "type": "object",
            "properties": {"query": {"type": "string"}},
            "required": ["query"],
        },
    }],
    messages=[{"role": "user", "content": "Search for OCC proofs"}],
)

Decorator

from occ_anthropic import occ_tool

@occ_tool
def search(query: str) -> str:
    """Search the web."""
    return f"Results for: {query}"

# Call as usual — proof is signed automatically
result = search(query="OCC proofs")

Custom Signer

from occ_anthropic import OCCSigner, wrap_client

signer = OCCSigner(state_dir=".occ", proof_file="audit.jsonl")
client = wrap_client(anthropic.Anthropic(), 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

Metadata

Release files for occ-anthropic 0.2.0

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

Source distribution (sdist)

Source distribution for occ-anthropic 0.2.0
File Size Uploaded
occ_anthropic-0.2.0.tar.gz 5.9 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for occ-anthropic 0.2.0
File Interpreter ABI Platform
occ_anthropic-0.2.0-py3-none-any.whl Python 3 none any Details

Total release size: 12.8 kB

Release files / occ_anthropic-0.2.0.tar.gz

Download URL occ_anthropic-0.2.0.tar.gz
Size 5.9 kB
Tags Source
SHA-256 checksum
How to use checksums
92d9e3c4459d2c5e090e1afc5ffec0c9a886810c6986dae297782a196a3361db
BLAKE2b-256 checksum
How to use checksums
983cd7a3312d76bf5da62525b56380598def2f1cb6e9668506619e2a12680bf4
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.9.6

Release files / occ_anthropic-0.2.0-py3-none-any.whl

Download URL occ_anthropic-0.2.0-py3-none-any.whl
Size 6.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
f2d0a18c59cf827bb729a8d1d5a474dfd72b293a15fd623cc2d06dfd932d23d2
BLAKE2b-256 checksum
How to use checksums
97433f3ef07e747a2955bfebe6ee62f52da69be9513fab53fd204e756d8017e1
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.9.6

Release history Release notifications | RSS feed

This release

0.2.0 This release

2 release files

0.1.0

2 release files

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