Graceful Tool Failure
Definition
Returning tool errors as structured data in the tool result (with isError / errorCategory / isRetryable flags) so the agent can respond politely and fail fast, rather than crashing the agent with application exceptions.
Key points
- Sequence: User → Agent → Tool Server (
lookup_order). Tool returns{isError: true, errorCategory: "transient", isRetryable: true}. Agent gives a polite response ("I'm experiencing a delay, please try again later."). - Anti-pattern: Throwing application exceptions that crash the agent, or returning empty strings.
- Correct pattern: Return the error message in the tool result content with the
isErrorflag set to true.
Why it matters for the exam
- Tests recognition of the exact flag names —
isError,errorCategory(e.g."transient"),isRetryable— and that errors belong in the tool result content, not as thrown exceptions.
Common gotchas
- Crashing with an exception or returning an empty string are both wrong — the agent needs the error surfaced inside the tool result so it can reason about retry/response.
isErrorgoes in the tool result content; the extraerrorCategory/isRetryablefields let the agent decide whether to retry.
See also
Sources
Referenced by
Practice questions optional · AI
Generate fresh practice questions about this concept with AI. These are not vault-verified.