This integration covers direct Boto3
bedrock-runtime calls in Python and @aws-sdk/client-bedrock-runtime calls in JavaScript. It does not instrument aioboto3 or the separate Anthropic Bedrock client.Supported APIs
Only the language-specific surfaces in this table receive Bedrock-specific PromptLayer request log enrichment. In Python, consume or close a streaming response before flushing so its span can finish.
Prerequisites
- A PromptLayer API key for the workspace that should receive the traces
- AWS credentials, a region, and access to the Bedrock model or inference profile your application calls
- Python 3.10 or later for Python, or Node.js 20 or later for JavaScript
AWS_REGION and AWS_BEDROCK_MODEL as application configuration:
Python
1. Install the SDKs
2. Configure Bedrock instrumentation
Configure tracing before creating the Bedrock Runtime client or making the first request:bedrock. Python also accepts amazon.bedrock and aws.bedrock as aliases for the same Botocore instrumentor.
Use an existing Python PromptLayer client
Use an existing Python PromptLayer client
If your application already creates a PromptLayer client, select Bedrock when enabling tracing:Omit
tracing_providers to instrument every supported provider SDK that is installed.JavaScript
1. Install the SDKs
2. Preload PromptLayer instrumentation
The preload must run before the application imports the AWS SDK client:3. Use the AWS SDK normally
configureTracing({ providers: ["bedrock"] }) in a bootstrap module and dynamically import the application afterward. See Select Providers.
Capture Prompts and Responses
PromptLayer captures supported Bedrock request and response content by default. To export metadata-only telemetry, opt out before tracing is configured:captureContent: false to configureTracing().
Content coverage differs by Bedrock Runtime operation:
All supported operations still include non-content telemetry supplied by the instrumentor, such as the model, timing, token usage when available, and errors.
Verify the Integration
Run one supported Bedrock Runtime request, consume any Python response stream, flush or shut down tracing, and open Traces in PromptLayer. The Bedrock span should have an associated request log and identify the Converse or InvokeModel API. If no span appears:- Confirm instrumentation is configured before the first Bedrock Runtime request.
- Confirm the client and operation are listed for your language in Supported APIs.
- In JavaScript, confirm the preload or bootstrap runs before
@aws-sdk/client-bedrock-runtimeloads. - Confirm
PROMPTLAYER_API_KEYbelongs to the workspace you are checking. - For Python streaming calls, fully consume or close the stream before flushing.
- Flush tracing before a short-lived process exits.
- If only message content is missing, confirm content capture was not disabled, check the operation-specific coverage above, and restart the process after changing the setting.

