@arizeai/openinference-instrumentation-bedrock-agent-runtime package.
This is the TypeScript / JavaScript guide. For the Python instrumentor, see Amazon Bedrock Agents.
Prerequisites
- Node.js 18+
- An Arize AX account (sign up)
- An AWS account with:
- Bedrock model access enabled for the foundation model your agent uses
- A deployed Bedrock Agent in the
PREPAREDstate, with a callable agent alias. Create one from the Bedrock console or via thebedrock-agent(control-plane) API — see Create an agent. You’ll need the agent ID (e.g.WYHKWZQCFM) and the agent alias ID (e.g.TSTALIASIDfor the auto-generated draft, or a custom alias) to invoke it.
Launch Arize AX
- Sign in to your Arize AX account.
- From Space Settings, copy your Space ID and API Key. You will set them as
ARIZE_SPACE_IDandARIZE_API_KEYbelow.
Install
Configure credentials
Setup tracing
Run Amazon Bedrock Agents
Expected output
Verify in Arize AX
- Open your Arize AX space and select project
amazon-bedrock-agents-js-tracing-example. - You should see a new trace within ~30 seconds containing a
bedrock.invoke_agentparent span (AGENT) wrapping per-step orchestration spans, any action-group (TOOL) or knowledge-base (RETRIEVER) spans your agent uses, and an LLM span (with the prompt, response, and token usage attached). - 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.- Arize skill (agent)
- AX CLI
- SDK
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_IDandARIZE_API_KEYare set in the same shell that runsexample.ts. Enable OpenTelemetry debug logs withexport OTEL_LOG_LEVEL=debugand re-run. - Agent spans missing.
registerInstrumentations(...)must run before thebedrock-agent-runtimeclient is created. Make sureinstrumentation.tsis imported first in your entry point. ValidationException: Agent <agent_id> is not in PREPARED state. A newly-created agent stays inNOT_PREPAREDuntil you click Prepare in the console (or callbedrock-agent prepare_agent) and it finishes building. Agents must be re-prepared after any change to instructions, action groups, or knowledge bases.ResourceNotFoundException: ... agent alias .... A “draft” agent has no callable alias by default — the auto-generated test aliasTSTALIASIDonly works once the agent is prepared. Create an alias via the Aliases tab in the Bedrock console orbedrock-agent create_agent_alias.AccessDeniedException. Your IAM principal needsbedrock:InvokeAgent(different frombedrock:InvokeModel) plus model access for the underlying foundation model.- Only LLM spans, no agent-reasoning spans. Make sure
enableTrace: trueis in theInvokeAgentCommand— without it, Bedrock returns only the final answer chunks and the instrumentor has no orchestration data to build the span tree. - Process exits before spans flush. Always
await provider.forceFlush()(orprovider.shutdown()) before the process exits, otherwise trailing spans are dropped.