Skip to main content

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

Metadata

Release files for moss-anthropic 1.0.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 moss-anthropic 1.0.0
File Size Uploaded
moss_anthropic-1.0.0.tar.gz 5.5 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for moss-anthropic 1.0.0
File Interpreter ABI Platform
moss_anthropic-1.0.0-py3-none-any.whl Python 3 none any Details

Total release size: 11.1 kB

Release files / moss_anthropic-1.0.0.tar.gz

Download URL moss_anthropic-1.0.0.tar.gz
Size 5.5 kB
Tags Source
SHA-256 checksum
How to use checksums
34b390a45f28a00f5bf306b1f51a3ee109c2768b5105ff928a9def89d8f85af3
BLAKE2b-256 checksum
How to use checksums
5e3efaf8b169be75529377018c46b2cb66953087cfdb53cf949dff88f3aadfb5
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.7

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 Jan 25, 2026.

Transparency log

Release files / moss_anthropic-1.0.0-py3-none-any.whl

Download URL moss_anthropic-1.0.0-py3-none-any.whl
Size 5.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
1afac135eec5c07800824547751ae5a80bb8138e2320d336f12979bacd75736e
BLAKE2b-256 checksum
How to use checksums
dd1454d48c5ac5afb167e0cdb3a451d35cbe5ff42353f03fad7f1892c804dd57
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.7

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 Jan 25, 2026.

Transparency log

Release history Release notifications | RSS feed

This release

1.0.0 This release

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