# Retries, timeouts and idempotency interview questions

> 6 retries, timeouts and idempotency interview questions for AI and ML engineer roles, each with a model answer.

Canonical: https://llmdojo.dev/interview/topic/agent-failures
Last updated: 2026-10-23

6 questions: 1 junior, 3 mid-level and 2 senior. Taught in [When Steps Fail: Retries, Timeouts, Idempotency and Checkpoints](https://llmdojo.dev/learn/agents-harness-engineering/failures-and-recovery).

## [Which tool failures should a harness retry automatically?](https://llmdojo.dev/interview/q/which-tool-failures-should-a-harness-retry-automatically)

Level: Junior

**Transient** ones: timeouts and dropped connections, with backoff. Not **permanent** ones like invalid arguments: return those to the model so it can fix the call. Overload responses mean slow down, not retry harder.

**Diagram: Which failures to retry**

1. Not every failure deserves the same response.
2. Transient failures may succeed if tried again a little later: retry, with backoff.
3. Overload errors mean the service is struggling. Google's SRE book: return a specific overload status so callers back off instead of retrying.
4. Permanent errors will never succeed: malformed requests, invalid arguments. Retrying the identical call only adds load.
5. In an agent, many permanent errors come from the model's arguments. Returning the error to the model lets it correct the call.
6. AI Engineering's tool failures include a tool simply returning the wrong output: no error is raised. Catching those needs checks on results (lesson 5).

## [A refund call times out. What does the harness know?](https://llmdojo.dev/interview/q/a-refund-call-times-out-what-does-the-harness-know)

Level: Mid-level

Nothing certain: the request may have been lost, may still be running, or may have **succeeded** with the response lost. They look identical.

**Diagram: What a timeout doesn't tell you**

1. Every call needs a deadline, or one stuck tool stalls the whole agent.
2. But when the deadline passes, three different things might have happened.
3. The harness can't tell them apart. For a read, retrying is harmless. For a write like a refund, retrying blindly can do it twice: the next pages.

For reads, retry. For writes, retry only if the operation is **idempotent**, or check its effect first.

## [Why add jitter to exponential backoff?](https://llmdojo.dev/interview/q/why-add-jitter-to-exponential-backoff)

Level: Mid-level

Clients that failed together retry together. Backoff alone keeps them in step, so a recovering service gets all of them at once: in the course's simulation, **100** calls in one 100 ms window.

Random waits spread them out: peak **11**.

## [How do retries multiply, and how do you stop it?](https://llmdojo.dev/interview/q/how-do-retries-multiply-and-how-do-you-stop-it)

Level: Mid-level

Attempts per layer raised to the number of layers: five layers of 3 is **243** attempts at the bottom.

Retry at **one** layer, cap retries per request, keep a process-wide **retry budget**, and count the model's own re-calls against it.

## [How do you make an agent's write actions safe to retry?](https://llmdojo.dev/interview/q/how-do-you-make-an-agent-s-write-actions-safe-to-retry)

Level: Senior

**Idempotency keys**: the server stores the first result for a key and returns it to repeats, so a retried refund happens once.

The **harness** derives the key from task and step (or saves it in the checkpoint), so retries reuse it; a key the model invents each time protects nothing. Without API support, record completed writes and check before repeating.

## [Your agent runs for an hour and sometimes crashes midway. How do you resume safely?](https://llmdojo.dev/interview/q/your-agent-runs-for-an-hour-and-sometimes-crashes-midway-how-do)

Level: Senior

**Checkpoint** after every step: task, context or summary, results, completed side effects, keys in flight. On restart, load it and continue; the harness, not the model, decides which steps are done, so completed writes are skipped.

The same mechanism makes pauses for human approval cheap.

## Related
- [All interview questions](https://llmdojo.dev/interview)
