Skip to main content
Amazon Bedrock is AWS’s managed foundation-model service — Claude, Llama, Mistral, Titan, and others are reachable through a single AWS SDK client. Arize AX captures every Bedrock model call (invoke_model, converse, converse_stream) via the OpenInference instrumentors for Python and JavaScript / TypeScript.

Bedrock Tracing Tutorial (Google Colab)

Prerequisites

  • Python 3.10+ or Node.js 18+
  • An Arize AX account (sign up)
  • An AWS account with Bedrock model access enabled for the model you want to call (the example below uses Anthropic Claude Sonnet 4.6 — request access from the Bedrock console under Model access if you haven’t already)

Launch Arize AX

  1. Sign in to your Arize AX account.
  2. From Space Settings, copy your Space ID and API Key. You will set them as ARIZE_SPACE_ID and ARIZE_API_KEY below.

Install

Configure credentials

Setup tracing

TypeScript: load the instrumentor as CommonJS. The current @arizeai/openinference-instrumentation-bedrock ESM build value-imports type-only names from the AWS SDK, so a direct import throws does not provide an export named 'ContentBlock' under ESM / tsx (openinference#3393). The example loads the instrumentor and the AWS SDK through createRequire so the working CommonJS build is used and the require-hook auto-instrumentation patches the client. Once the upstream fix ships you can switch to plain import.

Run Amazon Bedrock

Expected output

Verify in Arize AX

  1. Open your Arize AX space and select project amazon-bedrock-tracing-example.
  2. You should see a new trace within ~30 seconds containing a bedrock.converse LLM span with the prompt, response, and token usage attached. The span’s llm.model_name is the model id you called (e.g. us.anthropic.claude-sonnet-4-6).
  3. If no traces appear, see Troubleshooting.

Check from the skill, CLI, or SDK

Confirm spans are actually reaching your Arize AX project. Use whichever fits your workflow — the skill and CLI work for any framework; the SDK check is shown for each language.
Install the Arize Skills plugin and let your coding agent check for you:
Then prompt your agent:
Use the arize-trace skill to export and analyze recent traces from my project. Confirm spans are arriving, and summarize any errors or latency issues.

Troubleshooting

  • No traces in Arize AX. Confirm ARIZE_SPACE_ID and ARIZE_API_KEY are set in the same shell that runs example.py. Enable OpenTelemetry debug logs with export OTEL_LOG_LEVEL=debug and re-run.
  • Bedrock spans missing but other spans present. BedrockInstrumentor().instrument(...) must run before boto3.client("bedrock-runtime", ...) is called. Make sure instrumentation.py is the first import in your entry point — boto3 clients created before instrumentation aren’t patched.
  • AccessDeniedException / Could not assume role. Your IAM principal doesn’t have bedrock:InvokeModel permission, or model access isn’t enabled for the model id in the example. Enable access in the Bedrock console under Model access and confirm your IAM policy grants bedrock:InvokeModel on arn:aws:bedrock:*::foundation-model/*.
  • ValidationException: Invocation of model ID anthropic.claude-sonnet-4-6 ... isn't supported. Some Claude models on Bedrock are only available through cross-region inference profiles. Prefix the model id with your geography slug — us.anthropic.claude-sonnet-4-6 (the example uses this) or eu.anthropic.claude-sonnet-4-6.
  • ExpiredTokenException. Your AWS_SESSION_TOKEN (SSO / STS temporary credentials) has expired. Re-run the SSO login and re-export the new triple of AWS_ACCESS_KEY_ID, AWS_SECRET_ACCESS_KEY, AWS_SESSION_TOKEN.
  • Meta Llama spans missing with invoke_model. The instrumentor doesn’t currently capture Llama responses via the invoke_model API — use converse (which the example above already does) for any non-Anthropic model.

Resources

Amazon Bedrock Documentation

OpenInference Bedrock Instrumentor (Python)

OpenInference Bedrock Instrumentor (JavaScript / TypeScript)

boto3 (AWS SDK for Python)

Bedrock Examples (Converse, Streaming, Tools, Agents)