Monitoring Agent Tool Failures, Coordination and Truncation
This lesson explains how to monitor the agent failure modes that the exam guide names: tool errors, coordination problems between agents and responses cut off mid-stream.
Learning outcomes
After completing this lesson, you will be able to:
- Detect and handle tool failures.
- Detect coordination failures in multi-agent systems.
- Detect truncated streaming from stop reasons.
Tool failures
Tools are where agents meet other systems, and they fail in several ways: errors from the system behind the tool, timeouts, throttling, invalid parameters generated by the model, and permission problems. The tool error rate and tool latency for each tool are monitored from traces and Lambda metrics.
Failures are mitigated with retries and exponential backoff for transient errors, clear error messages that the model can act on, validation of inputs before the tool runs, fallback tools, and circuit breakers that stop calling a failing dependency so the agent does not waste tokens retrying it.
The following diagram shows the safeguards around a booking agent whose availability tool sometimes times out.

An agent that fails
Coordination failures
In multi-agent systems, a supervisor may route a task to the wrong collaborator, agents may hand tasks back and forth in a loop, context may be lost in hand-offs, or an agent may stop without completing its part. Detect these with traces that show the sequence of agent invocations, counts of iterations per session, repeated identical tool calls and sessions that end without a final answer. Mitigate with maximum iteration and time limits, clear collaborator descriptions, structured hand-off messages and escalation to a human when limits are reached.
Truncated streaming
Streaming responses can end early. The stop reason returned by the Converse or ConverseStream API shows why: end_turn (normal), max_tokens (output limit reached, answer cut off), stop_sequence, tool_use, guardrail_intervened or content_filtered. Connection drops and client timeouts also truncate output without a stop reason. Monitor the share of max_tokens stops and incomplete streams, raise limits or ask for shorter answers, and implement reconnection or continuation. The following table summarises the failure modes.
| Failure | Detect | Mitigate |
|---|---|---|
| Tool error or timeout | Tool error rate and latency in traces | Retries, backoff, fallback, validation |
| Agent loop | Iterations per session, repeated calls | Iteration limits, alarms, human escalation |
| Wrong routing between agents | Trace of agent invocations | Better collaborator descriptions, routing tests |
| Truncated output | Stop reason max_tokens, incomplete streams | Raise max tokens, shorten output, continuation |
| Guardrail stops | Stop reason guardrail_intervened | Review policy and prompts |
Truncated answers
Automating agent recovery
A booking agent occasionally hangs when a partner's availability API times out, and some itineraries are cut off mid-response.
- Wrap the availability tool with a 5-second timeout, two retries with backoff and a clear error message telling the agent to offer alternative dates.
- Publish custom metrics for tool timeouts and for responses with stop reason max_tokens; alarm when either exceeds 2%.
- Raise maxTokens for the itinerary step and instruct the agent to summarise long itineraries.
- Cap sessions at 15 iterations and route capped sessions to a human agent.
The agent now degrades gracefully, and alarms show the team when a partner API or prompt change causes new problems.
Answers are cut off. What should be checked?
Show answer
Whether the stop reason is max_tokens, and whether streams time out.
Exam Tips
Remember for the exam
- Answers cut off: check for stop reason max_tokens and stream timeouts.
- Agent loops: iteration limits and alarms on repeated tool calls.
- Tool failures: retries with backoff, fallbacks and clear error messages.
- Multi-agent routing problems: inspect traces of agent invocations.
- Escalate to a human when limits are reached.