github.com/aws/aws-sdk-go-v2/service/bedrockruntime). Unlike the HTTP-bytes instrumentations, Bedrock is traced via the AWS smithy-go middleware stack, reading the typed operation input/output structs directly, so there is no body buffering. It captures Converse, ConverseStream and (best-effort) InvokeModel, including cache read + write tokens and latency.
Installation
Usage
Set
LANGWATCH_API_KEY before running, and ensure your AWS credentials and region are configured (e.g. via AWS_REGION and the standard AWS credential chain).aws.Config once with InstrumentConfig, and every Bedrock Runtime client built from it is traced:
Instrumenting a single client or operation
If you do not want to mutate the sharedaws.Config, add the middleware to a single client (or call) via APIOptions:
The middleware captures input and output content by default (
langwatch.DataCaptureAll). Pass bedrock.WithDataCapture(langwatch.DataCaptureNone) to InstrumentConfig / WithTracing to opt out. Use bedrock.WithGenAIProvider(...) to attribute spans to the underlying foundation-model vendor instead of aws.bedrock.Related
- Go Integration Guide - Setup, manual spans, data capture and the REST client
- Go SDK API Reference - Instrumentation options and collected attributes
- Capturing Evaluations & Guardrails - Log evaluations and implement guardrails in your Bedrock applications