Lesson 1 of 3 Monitoring Agents, Tools and Vector Stores

Observing Agents and Their Tools

This lesson covers the metrics and traces needed to operate agents and their tools, which request metrics cannot see: which tools agents call, in what order, how often they fail and how agents hand work to each other.

Learning outcomes

After completing this lesson, you will be able to:

  • Track tool performance metrics.
  • Baseline call patterns and detect changes.
  • Trace agents and multi-agent coordination.

Tool performance metrics

Every tool an agent calls is a dependency with its own performance metrics: call count, latency percentiles, error rate, timeouts and the size of the results it returns. Tools implemented as Lambda functions already publish invocation, duration, error and throttle metrics to CloudWatch. The agent layer adds context that those metrics lack, such as the tool name, the agent that called it and whether the agent used the result.

These metrics matter because tool problems spread. A slow tool lengthens every agent session that uses it, and a failing tool makes the agent retry or work around it, which increases token usage and cost and can lead to worse answers. Alarms on tool latency and error rates therefore detect problems that would otherwise appear only as vaguely worse agent behaviour.

Select all that apply

Tool metrics to watch

Exam skills 4.3.4

Choose the metrics that should be tracked for each tool an agent calls.

Log in to try this activity Interactive activities are free with an account.

Call pattern tracking and baselines

Call pattern tracking records the sequence of tool calls in each agent session: which tools are chosen for which kinds of request, how many calls a task takes, and whether the same tool is called repeatedly with the same arguments, which signals that the agent is stuck in a loop. Patterns also reveal design problems. A tool that is never called may have a poor description, and a tool called far more often than expected may be compensating for information that should be in the prompt.

Usage baselines record normal patterns for each tool and agent, such as calls per session and the mix of tools used. Monitoring these with CloudWatch anomaly detection flags sudden changes after a prompt, model or tool update, which often indicate an unintended change in agent behaviour that tests did not catch.

The following diagram shows the tool metrics behind a rise in an agent's steps and cost, and the diagnosis.

Diagnosing a tool that is never used. After a release, steps per support task rose from 4 to 9 and token costs doubled. Tool metrics show the new lookup_warranty tool is never called while general search is called repeatedly; its description did not say when to use it, and rewriting it with an example restores the baseline.
The call counts are illustrative.
Scenario questions

Reading tool call patterns

Exam skills 4.3.4

Interpret each call pattern from an agent's tool usage.

Log in to try this activity Interactive activities are free with an account.

Tracing agents and multi-agent coordination

Tool calling observability comes from traces. Amazon Bedrock agent traces show each orchestration step with rationale, tool invocation and observation. Agents built with Strands Agents or hosted on AgentCore Runtime emit OpenTelemetry spans through AgentCore Observability, viewable in CloudWatch, where a session trace shows model calls, tool calls and their timing. Multi-agent coordination tracking follows hand-offs between supervisor and specialist agents, revealing where tasks stall, bounce between agents or are routed to the wrong agent. X-Ray covers the AWS service calls underneath. The following table summarises what to track.

What to trackWhySource
Calls, latency and errors per toolFind slow or failing dependenciesLambda metrics; custom tool metrics
Tool call sequences per sessionDetect loops and poor tool selectionAgent traces; spans
Steps and tokens per taskEfficiency and costTraces; token metrics
Hand-offs between agentsFind routing errors and stallsMulti-agent traces
Deviation from usage baselinesDetect behaviour changesCloudWatch anomaly detection
Worked example

A tool that is never used

After a release, the average number of steps per support task rises from 4 to 9 and token costs double. Tool metrics show that a new lookup_warranty tool is never called while the general search tool is called repeatedly.

Call pattern tracking points to tool selection: the new tool's description does not say when to use it. Rewriting the description and adding an example restores the baseline, which an anomaly detection alarm on steps per task now guards.

Check yourself

What reveals that an agent is looping?

Show answer

Tracking tool call sequences, which show the same calls repeating.

Exam Tips

Remember for the exam

  • Measure calls, latency and errors for every tool.
  • Track tool call sequences to detect loops and poor tool selection.
  • Agent traces and AgentCore Observability spans show each step.
  • Baselines plus anomaly detection catch behaviour changes after releases.