Agent Reliability interview question

Agentic AIAgent ReliabilityTool Callinghard

During an outage, a retailer's inventory API answers every request with HTTP 503. The shopping assistant reaches it through the three layers below; assume the model follows its instruction exactly. About 200 customer questions a minute need a stock check. How many requests per question reach the inventory API, and what is the fix?

python
# Layer 1: HTTP client shared by all tools (urllib3 retry policy;
#          raises an error once its retries are used up)
session.mount("https://", HTTPAdapter(
    max_retries=Retry(total=2, status_forcelist=[503])))

# Layer 2: tool wrapper (tenacity; retries on any exception)
@retry(stop=stop_after_attempt(3))
def check_stock(sku):
    return session.get(f"{INVENTORY}/stock/{sku}", timeout=3).json()

# Layer 3: agent system prompt
# "If a tool returns an error, call it again, up to 2 more times."
  1. A9 requests per question (3 + 3 + 3), or 1,800 a minute; attempts add up across the layers, so exponential backoff in each layer is enough to keep the inventory API safe.
  2. B81 requests per question (3⁴, since the agent's first call is a layer of its own), or 16,200 a minute; remove the prompt rule and keep both code-level retry layers.
  3. C27 requests per question (3 × 3 × 3), or 5,400 a minute; retry in one layer only, let the other layers fail fast, and cap retries with a budget such as 10% of requests.
  4. D7 requests per question (1 + 2 + 2 + 2 retries), or 1,400 a minute; retries add up across layers, so it is enough to cap each of the three layers at a single retry.
Show the answer and explanation

Correct answer: C, 27 requests per question (3 × 3 × 3), or 5,400 a minute; retry in one layer only, let the other layers fail fast, and cap retries with a budget such as 10% of requests.

Explanation Agent Reliability

Retries at nested layers multiply, because every attempt of an outer layer runs the full retry loop of the layers inside it.

  • HTTP client: Retry(total=2) means 1 attempt + 2 retries = 3 requests before it raises (urllib3's default raise_on_status=True; requests reports a RetryError).
  • Tool wrapper: stop_after_attempt(3) calls the client 3 times (tenacity retries on any exception by default) → 3 × 3 = 9.
  • Agent: one call plus up to 2 re-calls = 3 tool calls → 3 × 9 = 27 requests per question.

At 200 questions a minute the failing API receives 200 × 27 = 5,400 requests a minute instead of 200: a 27× load increase on a service that is already down, which can stop it from recovering.

Fixes:

  1. Retry at one layer, usually the one closest to the call that knows whether the error is retryable, and make the other layers fail fast.
  2. Retry budget: allow retries only while they stay below a share of traffic (e.g. 10% of requests), so an outage cannot multiply load.
  3. Tell the model the error is temporary and was already retried, so it does not loop; add backoff with jitter and a circuit breaker.

Why the other counts are wrong: adding attempts (9) or retries (7) ignores the nesting, and per-layer backoff only spreads the requests out in time without reducing them. 81 counts the agent twice: its first call is already one of its three calls.

Interview tip: draw the call stack and multiply attempts per layer. The Google SRE book makes the same point: one top-level request can cause the product of the attempts at every layer, so retry at one level and use a per-client retry budget.

Practice it as a quiz

Answer this and the other free questions with instant grading, streaks and weak-topic tracking, or unlock all 4,000 questions.

More Agentic AI questions

  1. After one chat, a grocery-delivery assistant's memory extractor proposed the candidate long-term memories below. Which write policy keeps later recall precise?
  2. Trace mining of 50,000 runs of a telecom billing-support agent gives the tool paths below. The team will hard-code the three most frequent paths as…
  3. What control flow does this LangGraph graph implement?
  4. A retail client wants to benchmark a customer-service agent that must follow a written returns policy, call order-management APIs and handle multi-turn…
  5. You are building an MCP server for a retailer's merchandising team. (1) summarize_reviews needs an LLM to condense 500 reviews, but the server must not hold…