Skip to main content

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

Metadata

Release files for goderash-adapter-anthropic 0.1.1

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

Source distribution (sdist)

Source distribution for goderash-adapter-anthropic 0.1.1
File Size Uploaded
goderash_adapter_anthropic-0.1.1.tar.gz 5.4 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for goderash-adapter-anthropic 0.1.1
File Interpreter ABI Platform
goderash_adapter_anthropic-0.1.1-py3-none-any.whl Python 3 none any Details

Total release size: 9.7 kB

Release files / goderash_adapter_anthropic-0.1.1.tar.gz

Download URL goderash_adapter_anthropic-0.1.1.tar.gz
Size 5.4 kB
Tags Source
SHA-256 checksum
How to use checksums
dc2c38496b0fcbc2bb96654f30436c08574e1a96e69ba2006586c05038edebf0
BLAKE2b-256 checksum
How to use checksums
6e125f4fe0b9d39ab980afae0842e33402bd939894c8a35b6ce60da329331ea5
Upload date
Uploaded using Trusted Publishing?
What is 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}

Release files / goderash_adapter_anthropic-0.1.1-py3-none-any.whl

Download URL goderash_adapter_anthropic-0.1.1-py3-none-any.whl
Size 4.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
cb377e3ee063bdd536313fc3b851419936e00509df58082a54506e94b87358cc
BLAKE2b-256 checksum
How to use checksums
3657442dad15283b2d6dd8f4d04f518d6bfcb1453094d28e6638ae76d95c7b6f
Upload date
Uploaded using Trusted Publishing?
What is 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}

Release history Release notifications | RSS feed

This release

0.1.1 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