Troubleshooting with AgentCore Observability and AWS X-Ray
This lesson explains how traces from AWS X-Ray and AgentCore Observability show each step's timing and errors, so the cause of a slow or failed AI request can be found anywhere along the path.
Learning outcomes
After completing this lesson, you will be able to:
- Trace requests with AWS X-Ray.
- Trace agents with AgentCore Observability.
- Use traces systematically to troubleshoot.
AWS X-Ray
AWS X-Ray collects traces as requests pass through API Gateway, Lambda, ECS, EC2 and instrumented code, building a service map and showing a timeline of segments and subsegments for each request: for example, API Gateway, the Lambda function, its call to a SageMaker AI endpoint and its call to DynamoDB. It reveals which call is slow or failing and supports sampling rules to control cost. X-Ray traces are viewed in the CloudWatch console, and the AWS Distro for OpenTelemetry can send traces to X-Ray.
Tracing terms
AgentCore Observability
AgentCore Observability instruments agents running on AgentCore Runtime (and agents elsewhere that use OpenTelemetry) and sends traces, metrics and logs to CloudWatch. Spans cover the session, each model invocation with token counts, each tool call through Gateway, memory operations and identity token retrievals. Metrics include session counts, latency, errors, throttles and resource usage. Because traces use OpenTelemetry, they can be correlated with X-Ray traces of the services the tools call.
Using traces to troubleshoot
Traces are most useful when used systematically. Troubleshooting starts from the symptom, a slow or failed request. The team finds its trace, looks for the longest or failed span, such as one slow tool call or a model call that timed out, and drills into that span's logs.
Comparing slow and fast traces for the same operation often shows the cause directly, for example an extra reasoning loop or a tool that sometimes takes much longer. The following table summarises when to use each tool.
| Question | Tool |
|---|---|
| Which service in the request path is slow? | X-Ray service map and traces |
| Which agent step, model call or tool is slow or failing? | AgentCore Observability traces |
| Is the endpoint itself saturated? | CloudWatch endpoint metrics |
| What did the container log at that time? | CloudWatch Logs Insights |
The following diagram shows the spans of a slow request's trace on a timeline.

Read the trace
An 8-second response
Users report that a RAG assistant behind API Gateway and Lambda sometimes takes 8 seconds instead of 2.
Trace (slow request) Duration
API Gateway 8.1 s
Lambda handler 8.0 s
Bedrock Retrieve (knowledge base) 0.4 s
Rerank 0.3 s
DynamoDB GetItem (user profile) 5.6 s <- retries after throttling
Bedrock Converse 1.5 sThe trace shows the slow step is not the model but a throttled DynamoDB table being retried. Switching the table to on-demand capacity fixes the problem. Without tracing, the team might have bought Provisioned Throughput for the model, which would not have helped.
Which standard does AgentCore Observability use?
Show answer
OpenTelemetry, sending the data to CloudWatch.
Exam Tips
Remember for the exam
- Slow segment across services: X-Ray traces and service map.
- Slow or failing agent step, model call or tool: AgentCore Observability.
- AgentCore Observability uses OpenTelemetry and sends data to CloudWatch.
- Find the longest span before optimising anything.
- Use sampling rules to control tracing cost.