SeniorSystem Design

Design an agent that automates invoice processing end to end: receive, extract, match to purchase orders, and schedule payment. Finance signs off on it. What does the design look like?

What they are really testing: Agentic design where real money moves. The differentiators: knowing when a workflow beats a free-form agent, designing approval tiers finance will actually sign, and idempotency so a crashed run never pays twice.

A real interview question

Design an agent that automates invoice processing end to end: receive, extract, match to purchase orders, and schedule payment. Finance signs off on it. What does the design look like?

What most people say

drag me

An agent with tools for OCR, PO lookup and the payment API processes each invoice, asking a human when it is unsure, and logs everything for audit.

"Asking when unsure" delegates the escalation boundary to the model self-assessment, which is exactly backwards for money. No idempotency, no duplicate handling, no hard limits, and finance is asked to trust confidence feelings rather than controls.

The follow-ups they ask next

  • Why is the escalation boundary policy rather than model confidence?

    Model self-assessment is uncalibrated and gameable by a weird invoice. Finance can audit "under 5,000, exact match, approved supplier"; nobody can audit "the model felt sure". Confidence can inform the tiers, never define them.

  • An invoice was paid twice anyway. Walk me through what failed and what you check.

    The audit log first: was it two documents evading duplicate detection, an idempotency key gap on retry, or a human override. Each has a different fix, near-duplicate matching, key coverage on every side-effect path, or override friction. The log answers it in minutes, which is why it exists.

What the interviewer is listening for

  • Chooses deterministic workflow orchestration with LLM steps, and says why
  • Autonomy tiers defined as auditable policy with named thresholds
  • Idempotency, duplicate detection, hard caps and immutable audit as first-class design

What sinks the answer

  • Free-form agent deciding process steps with money-moving tools
  • Escalation delegated to model confidence
  • No idempotency or duplicate story, retries can pay twice

If you genuinely do not know

Say this instead of freezing. Reasoning out loud from what you do know beats silence every single time, and a good interviewer is listening for exactly that.

A workflow, not a free agent: [deterministic pipeline, model inside steps]. Trust per step: [nullable schema extraction, arithmetic cross-checks, PO match with named discrepancies]. Autonomy is policy: [auto under 5,000 with exact match, one-click review for soft exceptions, humans for hard ones]. Money-grade underneath: [idempotency keys, duplicate detection, hard caps, immutable audit, shadow-mode rollout].

Keep going with system design

All 57 ai engineer questions

Knowing the answer is not the same as recalling it under pressure

Sign in to send the questions you fumble to spaced recall, so they come back right before you would forget them, and learn the concepts behind them with hands-on labs.

Start free