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)

Overview

Design an agent executor that performs authorized side effects safely across retries, crashes, duplicate messages, and uncertain external outcomes. A strong answer defines durable state, logical operation identity, approval boundaries, reconciliation, and explicit limits on what execution can guarantee.

Study time: 3 to 4 hours

Interview format: System design discussion with a failure timeline

By the end you can

  • Separate the model's proposals from the executor's authority over side effects
  • Distinguish run, tool-call, and logical operation identifiers, and key idempotency on accepted intent
  • Make a local mutation idempotent inside one transaction, and handle external effects whose outcome is unknown
  • Bind approvals to the exact recipient, content, and resource version, and revalidate them at execution
  • Resume after a crash from durable state, and test duplicates, crashes, leases, and replay windows

Prerequisites

Helpful background: Familiarity with transactions, queues, and distributed systems helps.

This topic covers workflows versus agents, typed tools, approval boundaries, state, and termination. Specific frameworks and protocols appear as tags.

In this guide

  1. Separate planning from authority
  2. Distinguish three identifiers
  3. Model durable operation state
  4. Idempotency within one transactional store
  5. External services and unknown outcomes
  6. Worked scenario: close a ticket and send one email
  7. Failure timeline
  8. Bind approvals to concrete effects
  9. Concurrency and stale state
  10. Durable agent state and resumption
  11. Budgets, termination, and compensation
  12. Evaluation and fault injection

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

Practice the interview question

Answer it in your own words before you look at the reference answer.