AI System Design Interview: Design a QA Agent Step by Step

Practise these 10 questions as a mock drillTimed questions, reveal the model answer, rate yourself — your dashboard tracks what you know and brings back your weak ones.
Sign in free to practise →

“Design an AI agent that writes and runs tests for our company.” In a senior interview, that may be the entire question. An AI system design interview tests how you think when the problem is open. In this lesson you will follow a clear six-step method, and use the system you built in this course as your worked example.

📖 What You’ll Learn

  • A repeatable method for design questions
  • How to clarify requirements first
  • How to draw and explain the components
  • How to discuss safety, failure and cost

💡 How an AI System Design Interview Works

Explain Like I’m 5: Designing a Treehouse

Imagine: Before building, you ask how many children will use it and how high it can safely be.

What it really means: Ask questions before you design anything.

In testing: Find out the users, risks and limits first.

StepTimeGoal
1. Clarify5 minutesAgree scope and constraints
2. High-level design10 minutesDraw the components
3. Deep dive15 minutesExplain the hard parts
4. Safety5 minutesShow how it stays controlled
5. Evaluation5 minutesProve that it works
6. Trade-offs5 minutesName limits and next steps

🔍 Step 1: Clarify

Ask questions, and write down the answers:

  • What will it test: web, API or both?
  • Who uses it, and how many runs are expected each day?
  • What systems may it touch? Is production excluded?
  • What data can be sent to a model?
  • Who approves generated code?
  • What does success look like?

Then state your assumptions, such as: “I will design for web testing on staging, one team first, with human approval.”


🧩 Step 2: High-Level Design

Explain Like I’m 5: Drawing the Map First

Imagine: You draw the rooms before you decide on the wallpaper.

What it really means: Start with the big picture and add detail later.

In testing: Show how a request travels through the system.

Users --> API --> Job queue --> Worker
                                  |
                                  v
                            Orchestrator
             +-----------+--------+---------+-----------+
             |           |        |         |           |
          Parser     Explorer   Planner  Generator   Reporter
                                  |
                  Validator --> Human approval --> Executor
                                                      |
                                            Failure analyst, Healer

Stores: database, artifact storage. Model access through one adapter.

Walk through one request from start to finish. Your AI agent architecture lesson covers each part.


🛠️ Step 3: Deep Dive

The interviewer will pick an area. Be ready to go deeper on any of these.

TopicKey points
OrchestrationCode controls order, and agents stay focused
ContractsSchemas validate every handoff
Model accessOne adapter, with timeouts and validation
EvidenceLocators must come from the real page
ExecutionFixed commands, no shell, restricted environment
ConcurrencyOne worker first, then isolated workspaces
StateSaved per run, and failed runs are not retried automatically

📌 Step 4: Safety

Explain Like I’m 5: Seat Belts and Brakes

Imagine: A fast car needs good brakes, seat belts and airbags. They each protect you in a different way.

What it really means: Use several independent layers of protection.

In testing: Allowlists, approvals and budgets each stop different problems.

RiskControl
Unsafe model outputValidation and human review
Prompt injection from pagesData labelling and narrow tools
Reaching wrong systemsHost allowlist and network limits
Runaway costCall, token and daily limits
Hiding real bugsHealing cannot change assertions
Secret exposureSecret store, redaction and synthetic data

🔑 Step 5: Evaluation

Describe how you would know that it is good. Use a fixed evaluation pack, people to score correctness and safety and a gate that blocks regressions. Track test acceptance, classification accuracy, cost and review time.


💡 Step 6: Trade-offs

DecisionBenefitCost
Human approvalSafety and trustSlower throughput
Workflow over free agentPredictable behaviourLess flexibility
One database firstSimple to runLimited scale
Model outside merge checksReliable pipelineSlower quality signal

Choose and explain

There is rarely one right design. Interviewers want to hear what you chose, what you gave up and when you would change your mind.


🌍 Real-Life Example: The Candidate Who Asked

One candidate immediately draws twelve agents. Another asks whether production is in scope, learns that it is not and designs a small workflow with approvals. The interviewer then adds a tenfold growth requirement, and the second candidate calmly explains how the queue and workspaces would change.


🧪 Try It Yourself

  1. Set a 45-minute timer.
  2. Design the agent on paper, using the six steps.
  3. Explain it aloud to someone.
  4. Add a new requirement, such as ten teams.
  5. Say what you would change, and why.

📋 Ready-to-Copy Prompt

You are a staff engineer running a system design interview.

Question: Design an AI agent that creates and runs tests for our company.

Answer my clarifying questions, but do not design it for me. Add one new
constraint part of the way through.

At the end, score me on requirements, architecture, safety, evaluation and
trade-offs. Point out anything I forgot to ask.

⚠️ Common Mistakes

  • Designing before asking questions
  • Drawing too many agents
  • Forgetting about failures and cost
  • Never mentioning evaluation
  • Treating your first design as the only option

🎯 Key Takeaways

  • Clarify the problem before you design.
  • Walk through one request from end to end.
  • Use several independent safety layers.
  • Explain your trade-offs, and when you would change them.

🎤 Interview Questions

1. How would this design change for ten teams?

Model answer: I would isolate each run’s workspace, move to PostgreSQL and object storage, add several workers and add per-team permissions and budgets.

2. What happens if the model provider goes down?

Model answer: Calls time out and retry within limits. The run stops with a clear reason, and the adapter makes it possible to switch providers after evaluation.

3. How do you stop the agent running forever?

Model answer: I enforce limits on workflow steps, model calls, tokens, command time and approval waiting. Each ends the run safely with a recorded reason.

4. Why not use one powerful agent with all the tools?

Model answer: It would be harder to test and control. Focused stages with narrow permissions make failures easier to find and limit the damage.

5. What would you build first?

Model answer: I would build a reliable test foundation, then typed contracts and a mocked workflow. I would add a real model only when that foundation is proven.


📝 Assignment

Write a two-page design for an agent that tests a payment flow in staging. Include assumptions, a diagram, safety controls, evaluation and three trade-offs. Then present it in 20 minutes.


❓ FAQ

Do I need to know a specific cloud?

Not usually. Explain the concepts, then mention tools that you have really used.

What if I get stuck?

Say what you are thinking, and ask a clarifying question. Interviewers often help when they can follow your reasoning.


🚀 Next Steps

Well done on finishing this lesson. Complete the assignment, then continue with QA Mock Interview with AI: Ethics, Company Policy and Final Review.