Hard20 minAI Engineering
UpdatedAug 6, 2026
Edit

Agent: Recover from Tool Failure

Question Variations

  • "How does an agent distinguish a timeout from a failed action?"
  • "What state must survive an agent restart?"

Why This Is Asked

An agent must book travel, but one tool times out after possibly making a reservation. Design state, idempotency, retry, and user communication so it neither silently abandons nor duplicates work.

Key Concepts

  • Durable state: Persist workflow step, inputs, and external operation IDs.
  • Idempotency: Use stable operation keys and query status before retrying.
  • Bounded recovery: Limit retries and escalate unresolved ambiguity.
  • User visibility: Report pending or failed state instead of fabricating completion.

Question Variations

  • “How does an agent distinguish a timeout from a failed action?”
  • “What state must survive an agent restart?”

Answers by Technology

+ Add Variant
System DesignImprove this answer ✏️

Expected Answer

Persist workflow state, inputs, operation IDs, and idempotency keys before calling the booking tool. On timeout, query status using the stable key before retrying. Bound retries, surface pending status to the user, and escalate unresolved ambiguity rather than claiming success.

Why It Matters

External side effects can succeed even when the agent never receives a reply.

Common Mistakes

  • Retrying with a new key: It can create duplicate bookings.
  • Keeping state only in context: Restart recovery becomes impossible.

Follow-up Questions

  • What survives restart? (Answer: Step state and external operation identities.)
  • What does timeout mean? (Answer: Outcome is unknown, not necessarily failed.)