- Request and response payloads
- Token usage and costs
- Latency and performance metrics
- Custom tags and metadata for filtering and analysis
- Multi-step chains and agent workflows
Installation
langchain-aws, which provides the ChatBedrockConverse class for interacting with Bedrock models. The JavaScript integration requires @langchain/community for the Bedrock chat model, plus several AWS SDK packages for authentication, request signing, and streaming support.
Setup
To enable LangSmith tracing, configure your LangSmith API key and project settings. You’ll also need to set up your AWS credentials to authenticate with Bedrock.LangSmith configuration
LANGSMITH_PROJECT variable allows you to organize traces into different projects.
AWS credentials
Configure your AWS credentials to authenticate with Bedrock. You’ll need an AWS account with Bedrock access enabled. Follow the AWS setup instructions to create your credentials and enable model access:Configure tracing
Once your environment variables are set, LangSmith will automatically trace all Bedrock model calls made through LangChain. You can enhance traces with custom tags and metadata to make filtering and analysis easier. Tags help you categorize traces (e.g., by environment, feature, or test type), while metadata allows you to attach arbitrary key-value pairs for detailed context. The following example shows you how to invoke a Bedrock model with tracing enabled and custom metadata attached:View traces in LangSmith
After running your code, navigate to your LangSmith project at smith.langchain.com to view the traces. Each trace includes:- Request details: Input messages, model parameters, and configuration
- Response details: Model output, token usage, and response metadata
- Performance metrics: Latency, tokens per second, and cost estimates
- Custom metadata: Tags and metadata you provided in the
configparameter
aws-bedrock or integration-test), search by metadata fields, or drill into specific traces to debug issues.
Next steps
- Learn more about LangSmith features including evaluation, datasets, and feedback
- Explore Bedrock model capabilities like tool calling, streaming, and prompt caching
- Review LangChain Bedrock integration documentation for advanced features like extended thinking and citations