Skip to main content

Goderash adapter for the Anthropic Python SDK (Messages + tool use) — tamper-evident, hash-chained, regulator-ready.

Project description

goderash-adapter-anthropic

Goderash adapter for the Anthropic Python SDK — Messages + tool use.

PyPI version PyPI downloads license

Drop-in adapter that audits every messages.create call to Claude via Goderash — tamper-evident, hash-chained, regulator-ready. Mirrors the TypeScript adapter @goderash/adapter-claude-sdk.

Install

pip install goderash-adapter-anthropic

Quickstart

import os
import anthropic
from goderash_sdk import GoderashClient
from goderash_adapter_anthropic import wrap_anthropic, audit_messages_response

goderash = GoderashClient(
    api_key=os.environ["GODERASH_API_KEY"],
    tenant="acme",
    agent_id="claude-agent-v1",
)
ctx = goderash.new_context()

# Option 1 — wrap the client; every messages.create is audited automatically.
client = wrap_anthropic(
    client=anthropic.Anthropic(api_key=os.environ["ANTHROPIC_API_KEY"]),
    goderash=goderash,
    context=ctx,
)

response = client.messages.create(
    model="claude-opus-4-7",
    max_tokens=1024,
    messages=[{"role": "user", "content": "hello"}],
)

# Option 2 — audit a response you already have.
audit_messages_response(goderash=goderash, context=ctx, response=response)

Events emitted per messages.create

Event When Payload includes
llm.call.started Before the request leaves model, max_tokens, message count
llm.call.completed After the response input_tokens, output_tokens, stop_reason
tool.invoked One per tool_use block in the response tool name, args, parent LLM call hash

You are responsible for emitting the matching tool.completed / tool.failed after your code runs each tool. The wrap_tool decorator in goderash-sdk does this for you automatically.

Streaming

Streaming is supported via client.messages.stream(...). The adapter aggregates token usage and emits llm.call.completed when the stream closes.

Compatibility

  • anthropic >= 0.40.0
  • Python >= 3.10
  • Works with any Claude model (claude-opus-4-7, claude-sonnet-4-6, claude-haiku-4-5, etc.)

Related packages

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

goderash_adapter_anthropic-0.1.1.tar.gz (5.4 kB view details)

Uploaded Source

Built Distribution

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

goderash_adapter_anthropic-0.1.1-py3-none-any.whl (4.3 kB view details)

Uploaded Python 3

File details

Details for the file goderash_adapter_anthropic-0.1.1.tar.gz.

File metadata

  • Download URL: goderash_adapter_anthropic-0.1.1.tar.gz
  • Upload date:
  • Size: 5.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.9.28 {"installer":{"name":"uv","version":"0.9.28","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

File hashes

Hashes for goderash_adapter_anthropic-0.1.1.tar.gz
Algorithm Hash digest
SHA256 dc2c38496b0fcbc2bb96654f30436c08574e1a96e69ba2006586c05038edebf0
MD5 df91b8fb049b58ce5c375b9f7be82690
BLAKE2b-256 6e125f4fe0b9d39ab980afae0842e33402bd939894c8a35b6ce60da329331ea5

See more details on using hashes here.

File details

Details for the file goderash_adapter_anthropic-0.1.1-py3-none-any.whl.

File metadata

  • Download URL: goderash_adapter_anthropic-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 4.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.9.28 {"installer":{"name":"uv","version":"0.9.28","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

File hashes

Hashes for goderash_adapter_anthropic-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 cb377e3ee063bdd536313fc3b851419936e00509df58082a54506e94b87358cc
MD5 7ecf48317387af3cbd84fb60b7f00978
BLAKE2b-256 3657442dad15283b2d6dd8f4d04f518d6bfcb1453094d28e6638ae76d95c7b6f

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