Skip to main content
Moda captures Anthropic models on Amazon Bedrock automatically in Python when you call them through the AnthropicBedrock client from the anthropic package. Calls made through boto3 (invoke_model, converse) and all Bedrock calls from Node.js are not auto-instrumented — use manual capture, the HTTP API, or OpenTelemetry for those paths.

Support matrix

Python: AnthropicBedrock client

Prerequisites

  • Python 3.10 or later
  • The moda-ai and anthropic packages
  • AWS credentials with Bedrock model access (environment variables, shared credentials file, or an IAM role)
  • A Moda API key, created at Settings → Ingestion keys (see Authentication)
1

Install the packages

2

Initialize Moda before creating the client

moda.init() is synchronous. Call it before you construct the AnthropicBedrock client.
app.py
The examples on this page use a US cross-region inference profile ID; substitute the model or inference-profile ID that is enabled for your AWS account and region.Streaming through client.messages.stream(...) and async clients are captured the same way.
3

Verify in the dashboard

Open Conversations in the dashboard. Within minutes you should see a conversation with ID session_8f2a containing the user message and the assistant response, with the model name and token counts attached.

boto3 and Node.js

The Moda SDKs do not auto-instrument boto3 or any Node.js Bedrock client. Pick one of the following.

Node.js: manual capture with Moda.withLLMCall

If you already use the Moda SDK for Node.js, wrap the Bedrock call and report the request and response yourself:
app.ts
Errors thrown inside the callback propagate to your code after the span is recorded. See the Node.js SDK page for the full withLLMCall reference.

Any language: HTTP API

Make the Bedrock call as usual, then post the messages to POST /v1/ingest:
A successful request returns:
The full event schema and limits are on the HTTP API page.

OpenTelemetry

If your service already exports OpenTelemetry spans, point them at Moda’s OTLP endpoint and add GenAI attributes to your Bedrock spans — see OpenTelemetry.
In Python, moda.init() also activates the opentelemetry-instrumentation-bedrock package for boto3 when both are installed. That package is third-party and is not bundled with moda-ai; install it separately if you want to try this path.

Troubleshooting

Next steps

  • Moda SDK for Python — init options, context APIs, and flush semantics.
  • HTTP API — full event schema, limits, and error envelope.
  • OpenTelemetry — send OTLP spans from an existing tracing setup.
  • Anthropic — auto-instrumentation for the Anthropic API outside Bedrock.