Skip to main content

OCC cryptographic proof signing for the Anthropic Python SDK

Project description

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

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_anthropic-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_anthropic-0.1.0-py3-none-any.whl (5.9 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: occ_anthropic-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_anthropic-0.1.0.tar.gz
Algorithm Hash digest
SHA256 ee80f8d0b4f3f019113d305383b00c33c6f33646188086c577f3993592c42541
MD5 8cc2e9ceb2d584dcfa27630391d56dea
BLAKE2b-256 7e49ed467731cf8ff11976a042b49b979b7feaa53eddad29e9ce9fd1a55e4a85

See more details on using hashes here.

File details

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

File metadata

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

File hashes

Hashes for occ_anthropic-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 52a3a756e1059cb1ae690d9f6387f35ccae271752a2cf8118d7bde20ac252398
MD5 16ae3b0f15d1b6bad733b13fba6843a5
BLAKE2b-256 73da1afd0b6c1dd06e08c7c72c4a59cf95d89a4d618d8b444e18d1a28ded6084

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