Skip to main content

MOSS cryptographic signing integration for Anthropic Claude

Project description

moss-anthropic

MOSS signing integration for Anthropic SDK (Claude). Unsigned output is broken output.

PyPI

Installation

pip install moss-anthropic

Quick Start

Sign tool use, responses, and text blocks from Claude:

from anthropic import Anthropic
from moss_anthropic import sign_tool_use, sign_response, sign_text

client = Anthropic()

# Get a response with tool use
response = client.messages.create(
    model="claude-sonnet-4-20250514",
    max_tokens=1024,
    messages=[{"role": "user", "content": "What's the weather?"}],
    tools=[{"name": "get_weather", "description": "Get weather", ...}]
)

# Sign the full response
result = sign_response(response, agent_id="weather-bot")
print(f"Signed: {result.signature[:20]}...")

# Sign individual tool use blocks
for block in response.content:
    if block.type == "tool_use":
        result = sign_tool_use(block, agent_id="weather-bot")

Enterprise Mode

Set MOSS_API_KEY for automatic policy evaluation:

import os
os.environ["MOSS_API_KEY"] = "your-api-key"

from moss_anthropic import sign_tool_use, enterprise_enabled

print(f"Enterprise: {enterprise_enabled()}")  # True

result = sign_tool_use(
    tool_use_block,
    agent_id="finance-bot",
    context={"user_id": "u123"}
)

if result.blocked:
    print(f"Blocked by policy: {result.policy.reason}")

Verification

from moss_anthropic import verify_envelope

verify_result = verify_envelope(result.envelope)
if verify_result.valid:
    print(f"Signed by: {verify_result.subject}")

All Functions

Function Description
sign_tool_use() Sign a tool use block
sign_tool_use_async() Async version
sign_response() Sign a full Message response
sign_response_async() Async version
sign_text() Sign a text block
sign_text_async() Async version
sign_message() Alias for sign_response
sign_message_async() Async version
verify_envelope() Verify a signed envelope

Enterprise Features

Feature Free Enterprise
Local signing
Offline verification
Policy evaluation -
Evidence retention -
Audit exports -

Links

License

This package is licensed under the Business Source License 1.1.

  • Free for evaluation, testing, and development
  • Free for non-production use
  • Production use requires a MOSS subscription
  • Converts to Apache 2.0 on January 25, 2030

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

moss_anthropic-1.0.0.tar.gz (5.5 kB view details)

Uploaded Source

Built Distribution

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

moss_anthropic-1.0.0-py3-none-any.whl (5.6 kB view details)

Uploaded Python 3

File details

Details for the file moss_anthropic-1.0.0.tar.gz.

File metadata

  • Download URL: moss_anthropic-1.0.0.tar.gz
  • Upload date:
  • Size: 5.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for moss_anthropic-1.0.0.tar.gz
Algorithm Hash digest
SHA256 34b390a45f28a00f5bf306b1f51a3ee109c2768b5105ff928a9def89d8f85af3
MD5 b629e56fe880078cbea49a348465ad84
BLAKE2b-256 5e3efaf8b169be75529377018c46b2cb66953087cfdb53cf949dff88f3aadfb5

See more details on using hashes here.

Provenance

The following attestation bundles were made for moss_anthropic-1.0.0.tar.gz:

Publisher: publish.yml on mosscomputing/moss-anthropic

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file moss_anthropic-1.0.0-py3-none-any.whl.

File metadata

  • Download URL: moss_anthropic-1.0.0-py3-none-any.whl
  • Upload date:
  • Size: 5.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for moss_anthropic-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 1afac135eec5c07800824547751ae5a80bb8138e2320d336f12979bacd75736e
MD5 67af7cb5e6db92c948134010a45fd898
BLAKE2b-256 dd1454d48c5ac5afb167e0cdb3a451d35cbe5ff42353f03fad7f1892c804dd57

See more details on using hashes here.

Provenance

The following attestation bundles were made for moss_anthropic-1.0.0-py3-none-any.whl:

Publisher: publish.yml on mosscomputing/moss-anthropic

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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