Simple Reflex Agent — AI Technical Interview Questions & Answers

Simple Reflex Agent

Simple Reflex Agent

  • Simple reflex: if percept then action. No memory of the past. Thermostat: if temp < 20 then heat. Vacuum: if dirt then suck else move. Fails when the right action depends on history (a maze).
  • Upgrade path: add internal state (model-based). Don’t call a huge LLM a simple reflex.
  • Simple Reflex Agent — output: heat off. No memory of yesterday.
  sensors  →  agent  →  actuators
                │
                ▼
            environment

Technical Interview Tip: Thermostat example + when it fails.

Code Examples for Simple Reflex Agent

Example

# Thermostat reflex
def reflex(temp):
    return "heat" if temp < 20 else "off"

print(reflex(18), reflex(22))

Simple Reflex Agent — output: heat off. No memory of yesterday.

How to Explain Simple Reflex Agent to an Interviewer

Explain Simple Reflex Agent as if you are teaching a junior — definition, then one example.

Condition–action rules. No memory. Fails when history matters.

What does the example print, and what does that prove?

Simple Reflex Agent — output: heat off

What mistake do freshers make with Simple Reflex Agent?

Fails when history matters.