To instrument your application, use the register function from @arizeai/phoenix-otel and manually instrument the Bedrock Agent Runtime SDK.Create the instrumentation.ts file:
import { register } from "@arizeai/phoenix-otel";import { BedrockAgentRuntimeClient } from "@aws-sdk/client-bedrock-agent-runtime";import { BedrockAgentRuntimeInstrumentation } from "@arizeai/openinference-instrumentation-bedrock-agent-runtime";// Initialize Phoenix tracingconst tracerProvider = register({ projectName: "bedrock-agent-app", // If using Phoenix Cloud: // url: "https://app.phoenix.arize.com/s/your-space-name", // apiKey: process.env.PHOENIX_API_KEY, // If using self-hosted Phoenix: // url: "http://localhost:6006",});// Set up Bedrock Agent Runtime instrumentationconst instrumentation = new BedrockAgentRuntimeInstrumentation();instrumentation.manuallyInstrument(BedrockAgentRuntimeClient);console.log("Bedrock Agent Runtime instrumentation registered");
After setting up instrumentation and running your Bedrock Agent application, traces will appear in the Phoenix UI for visualization and analysis. This includes: