AI Engineering
/
Tool Calling & Agents
/

Design an agent with idempotent side effects

Tool Calling & Agents · 3 to 4 hours

Design an agent with idempotent side effects

Design an agent that closes a ticket and sends one approved closure email safely across duplicate jobs, crashes, timeouts, and concurrent workers, and say exactly what the design can and cannot guarantee.

Hard
System Design

4 h

Premium

Used in interview rounds:

AI System Design (Hard)

Step 1: The question

Design an agent that closes a ticket and sends one approved closure email. It must recover from duplicate jobs, crashes, timeouts, and concurrent workers. Explain operation identity, transaction boundaries, approvals, external API uncertainty, resumption, and fault tests.

Constraints

  • Closing the ticket writes to the application's own database; the email goes through an external service
  • The user must approve the recipient and the content before any email is sent
  • Jobs can be delivered twice, workers can crash or run concurrently, and calls can time out
  • Completed, partial, and uncertain outcomes must be reported accurately

Deliverables

  • Operation identities and the durable state each operation records
  • Transaction boundaries for the ticket change and the notification intent
  • Approval binding and the permission checks at execution time
  • Handling of a lost email response, and resumption after a crash
  • Fault-injection tests, each with the invariant it checks

Hard questions are part of Premium: the study guide, reference answer, rubric, and exercises unlock with Premium.