In this article
Before you start
Why interviewers ask this
Agent questions test whether a candidate can name the simplest design that works and say when it stops working. "Is a thermostat an agent?" and "How is a language-model agent different from a rule-based one?" both start here. A weak answer lists agent types from memory. A strong answer says what each type senses, what it remembers, and what breaks when the world is only partly visible. The textbook ladder, from Artificial Intelligence: A Modern Approach (AIMA) by Russell and Norvig, starts at the simple reflex agent, so it is the baseline every other design is compared with. The answer to practise has three parts: the definition, the example, and the limit.
Simple reflex agents from first principles
- Simple reflex agent
- A simple reflex agent is an agent that selects each action using only the current percept and a fixed set of condition-action rules, with no memory of earlier percepts or actions.
- Percept
- A percept is the information an agent's sensors deliver at one moment, such as a location and the state of that location.
- Condition-action rule
- A condition-action rule is an if-then instruction that links a situation the agent can sense to the action it should take, for example "if dirty then suck".
In plain words
Think of the reflex a doctor tests with a small hammer. The knee is tapped and the leg kicks. No planning happens between the tap and the kick. A simple reflex agent works the same way: sense, match a rule, act. A household thermostat is the usual example. It senses the temperature and switches the heating on below a set point. The analogy breaks in one place. A body reflex is built in by evolution, while an agent's rules are written by a designer, so the agent is only as good as the rules that person thought of.
In one precise sentence: a simple reflex agent computes its action as a function of the present percept and nothing else. The Chalmers course slides built on the AIMA slides draw it as sensors feeding a box of condition-action rules that drives the actuators.
Step 1: Sense the percept
An agent starts each turn by reading its sensors. In the standard teaching example, the two-square vacuum world, the percept is two things: the agent's location, A or B, and whether that square is dirty or clean, as the slides and the aima-python vacuum notes describe. The agent can act with Left, Right, Suck or NoOp.
The input is the world. The output is a percept such as "A, Dirty". What the sensors do not report does not exist for the agent. If the location were missing from the percept, the agent could not tell the two squares apart, a point Step 5 returns to.
Step 2: Match a condition-action rule
The agent compares the percept with its rules and picks the rule whose condition fits. The vacuum agent has only three, written in the slides as pseudo-code: if the status is dirty, return Suck; else if the location is A, return Right; else if the location is B, return Left.
The rules are the entire "intelligence" of the agent. There is no search, no model of the world and no learning. That is why it is fast and cheap: choosing an action is a few comparisons. It is also why it is predictable: the same percept always gives the same action, which makes the agent easy to test and easy to explain.
Step 3: Act through an actuator
The chosen action goes to the actuators, the parts of the agent that change the world. In the vacuum world Suck removes the dirt on the current square and Left or Right moves the agent. In the aima-python environment the score is 10 for each dirt cleaned and minus 1 for each move, which is the measure our script uses.1
The output of this step is a changed world. The action may not work as planned: a Right move from square B hits the wall and goes nowhere. The agent has no way to notice that by itself, because noticing needs a comparison with the earlier percept, and a simple reflex agent keeps none.
Step 4: Repeat from the next percept, with no memory
After acting, the agent senses again and starts the loop from nothing. Each turn depends only on what the sensors report now. This is the defining property, and it has a price. Once both squares are clean, the percept is "A, Clean" or "B, Clean", the rules say move, and the agent moves forever. It cannot know the job is finished, because "finished" depends on what it saw on the other square a moment ago.
In our run from start state A with both squares dirty, the first ten actions are Suck, Right, Suck, Left, Right, Left, Right, Left, Right, Left: two cleanings, then eight pointless moves. Over 20 steps it scores 2. An agent that remembers it has seen both squares clean scores 19 from the same start.1
Step-by-step description
- Read the percept: location and status.
- Pick the condition-action rule that fits.
- Send the action to the actuators.
- Start again from the next percept; nothing is remembered.
- Hidden information is where the rules run out.
- The agent senses a percept such as a location and a status.
- A condition-action rule maps the percept to an action.
- The agent keeps no memory between turns.
- Hidden information is where the rules run out.
Step 5: See where the rules run out
A simple reflex agent works well only when the current percept holds everything needed to choose correctly. The AIMA slides list the next rung up as the reflex agent with state, which adds an internal record of what the world is like. Hidden information is the usual cause of failure. Remove the location from the percept and the same three rules fall apart: a status-only agent that always moves Right when clean never leaves square B.
The output here is a boundary. Inside it, rules are enough. Outside it, the agent needs memory, a model of the world, a goal or a way to learn. Each of those additions is a step up the textbook ladder of agent types: a model-based reflex agent keeps state, a goal-based agent also holds a goal and searches or plans toward it, and a utility-based agent scores how good each outcome is. A language-model agent loop is not a textbook rung; it carries its history in the prompt.
Knowing it is half the job. Saying it is the other half.
Interview Clozo is an AI interview copilot for real interview rounds: it hears the question and puts a strong answer on your screen, and you say it in your own words. See the features or how it works.
Start Free Trial →Worked example
The script runs three agents in the two-square world from all 8 start states (the agent in A or B, each square dirty or clean) for 20 steps each, using the score above. The 20-step horizon is our choice and illustrative.1
| Agent | Sees | Start states fully cleaned (of 8) | Mean moves after the room is clean | Mean score |
|---|---|---|---|---|
| Simple reflex | location and status | 8 | 18.5 | -9 |
| Simple reflex | status only | 6 | 14.125 | -11.75 |
| Reflex with memory | location and status | 8 | 0.5 | 9 |
Text description of the diagram
- The simple reflex agent averages 18.5 moves after the room is clean.
- The status-only agent averages 14.125 and the agent with memory 0.5.
Two results stand out. First, the reflex agent that sees location and status is correct, since it cleans all 8 start states, yet it makes the most moves after the room is clean, because it never stops. Across the 8 starts it wastes 17, 19, 18, 20, 17, 18, 19 and 20 moves, and 148 divided by 8 is 18.5. The negative mean score is the price of that: 10 points per dirt cleaned cannot repay a minus 1 on every later step. Second, the status-only agent fails 2 of 8 start states, the ones where it starts in B and A is dirty, because it keeps trying to move Right into the wall.1
The loop in the script is short:
def reflex_vacuum_agent(percept): # percept = (location, status)
location, status = percept
if status == "Dirty":
return "Suck"
return "Right" if location == "A" else "Left"
# environment loop: sense -> act -> score, no memory kept by the agent
for t in range(20):
action = reflex_vacuum_agent(sense(world))
world, reward = apply(world, action)
Trade-offs and edge cases
Simple reflex agents win where the percept is complete and the rules are few. A thermostat, a spam filter's block list and a stateless firewall rule all decide from what they sense now. They are cheap, fast, testable and easy to explain. Anthropic's agent guide (December 2024) recommends "the simplest solution possible" and notes that more complex agentic systems trade latency and cost for better task performance, which is the same principle in modern wording.
Partial observability breaks them. When the percept hides something the decision needs, a memoryless agent cannot recover, as the status-only row shows. The fix is state: remember what you have seen, which is the model-based reflex agent.
Rule tables grow fast. Every new situation needs a rule, and rules can conflict. As the rule set grows, rules overlap and conflict, and teams move to a model, a planner or a learned policy.
Language-model agents are not simple reflex agents. An agent built on a language model loops over reasoning and actions, with the history in its prompt. Yao et al. (2023) describe ReAct, which alternates reasoning steps and actions and reports a 34 percent absolute gain on ALFWorld and 10 percent on WebShop over imitation and reinforcement-learning baselines. The history is state, so it sits above the simple reflex rung. A single call with no history behaves like a reflex function of the current input.
| Fact | Value |
|---|---|
| Inputs to the action choice | the current percept only |
| Vacuum-world percept | location and status of the current square |
| Mean moves after the room is clean, 20 steps (our run) | 18.5 for the reflex agent, 0.5 with memory |
| Start states cleaned by the status-only agent (our run) | 6 of 8 |
| Score of the reflex agent from A with both dirty, 20 steps | 2 |
| Score of the agent with memory, same start | 19 |
Text description of the diagram
- A simple reflex agent keeps nothing and chooses by matching a rule.
- A model-based reflex agent keeps state about what it has seen.
- A goal-based agent holds a goal and plans; a utility-based agent scores outcomes.
- A language-model agent loop carries its history in the prompt.
How to answer it in an interview
What is a simple reflex agent, and when is it enough?
A simple reflex agent picks its action from the current percept alone, using condition-action rules, so it has no memory. The standard example is a vacuum agent: if the square is dirty, suck, otherwise move to the other square. It is enough when the percept shows everything the decision needs, because it is fast and predictable. It breaks when information is hidden. The vacuum agent sees only its own square, so it cannot know the task is finished and keeps moving: in my run it wasted 18.5 of 20 steps on average. I would add state first.
The spoken structure is: the definition, the vacuum example, then the limit and the fix.
Common mistakes
"A simple reflex agent learns from experience." (wrong) It has fixed rules and no memory, so nothing it experiences changes its behaviour. (right) "It maps the current percept to an action; learning would be a separate component."
"Reflex means fast and therefore unintelligent, so it never matters." (wrong) It is the right design when the percept is complete, and the simplest design that works is a strength. (right) "It is cheap and testable; I would only add memory when the task needs it."
"A language-model agent is a reflex agent." (wrong) The loop carries the history in its prompt, which is state. (right) "A single stateless call is reflex-like; an agent loop with history has state, and usually a goal, so it is at least model-based."
"More rules fix every failure." (wrong) Hidden state cannot be rebuilt from the percept; in our run the status-only agent never cleaned square A when it started in B. (right) "I add memory or sensing, not more rules."
Follow-up questions
What is the difference between a simple reflex agent and a model-based reflex agent?
A model-based reflex agent keeps an internal state, a record of what the world is like, and uses it together with the current percept. In the aima-python code it is ModelBasedReflexAgentProgram, and its ModelBasedVacuumAgent returns NoOp once it has seen both squares clean. The memory in our vacuum run is the whole difference between a score of 2 and a score of 19.1
Is a thermostat a simple reflex agent?
Yes, in the ideal case: it senses the temperature now and applies a rule such as "below the set point, heat". A thermostat with a built-in delay or timer keeps some state, so it is a reflex agent with state.
Is an LLM agent a simple reflex agent?
Usually not. An agent loop feeds earlier steps back into the prompt and decides what to do next, as in ReAct, so it has state and often a plan. Anthropic separates workflows, which follow predefined code paths, from agents, which direct their own process; neither is a bare reflex rule. See the AI agent architecture page and agentic AI interview questions.
What if the episode runs longer than 20 steps?
The waste grows by one move for every extra step: over N steps the reflex agent wastes N minus 1.5 moves on average, so 98.5 at 100 steps, while the agent with memory stays at 0.5. From A with both squares dirty its score falls to minus 78 at 100 steps; the agent with memory keeps 19.1
What are the types of agents in AI?
The AIMA-based course slides list four basic types in order of increasing generality: simple reflex, reflex with state, goal-based and utility-based, and say all of them can be turned into learning agents.
When should you still use a simple reflex agent?
When the decision depends only on what is sensed now and the rule set is small: guards, thresholds and filters. Pair it with human approval for risky actions, as in human-in-the-loop agents, and with typed tool calls as in the Model Context Protocol. The AI engineer interview questions page covers neighbouring topics.
- A simple reflex agent chooses an action from the current percept alone, using condition-action rules.
- The loop is sense, match a rule, act, repeat with nothing remembered.
- It is cheap and predictable, and enough when the percept shows everything the decision needs.
- Without memory it cannot know a task is finished: 18.5 of 20 steps were wasted moves in our run.
- Hidden information is fixed by adding state, not more rules.
Sources
- Artificial Intelligence: A Modern Approach, 4th US edition (companion site) — Russell and Norvig, UC Berkeley (date = site last modified), 22 Aug 2022
- aima-python: Python code for Artificial Intelligence: A Modern Approach — aimacode (GitHub, date = read date), 24 Oct 2026
- The vacuum world (aima-python environment notes) — Yale CS 370 course site (date = read date), 24 Oct 2026
- Intelligent Agents, Chapter 2 slides (spring 2013, based on the AIMA slides of 2004) — Chalmers University of Technology (Ljunglof), 19 Mar 2013
- Building effective agents — Anthropic, 19 Dec 2024
- ReAct: Synergizing Reasoning and Acting in Language Models (arXiv 2210.03629 v3) — arXiv (Yao et al.), 10 Mar 2023