AI FUNDAMENTALS

AI Agents and Uninformed Search

Agents perceive environments and act to achieve goals. Uninformed search — BFS and DFS — is how agents find solutions without domain knowledge.

1What is an AI Agent?

An AI agent is anything that perceives its environment through sensors and acts upon it through actuators. A chess program perceives the board state and acts by moving pieces. A robot perceives images and distances, and acts by turning motors. What makes it an agent is the sense-act loop — not whether it uses neural networks or if-else rules.

PEAS is the standard framework for defining an agent: Performance measure (what counts as success), Environment (where it operates), Actuators (how it acts), Sensors (how it perceives). Specifying PEAS precisely before writing code prevents optimising the wrong objective.

Simple Reflex Agent
Responds to the current percept only — no memory, no planning. Works when the environment is fully observable and the right action follows directly from the current state. Fast but brittle.
Goal-Based Agent
Maintains a goal state and searches for action sequences that reach it. Requires a model of the world. More flexible than reflex agents — it can handle novel situations by searching forward from the current state.
Utility-Based Agent
Replaces a binary goal with a utility function to maximise. Enables trade-offs between competing objectives — speed vs safety, accuracy vs cost. The dominant formalism in modern AI decision-making.
Learning Agent
Improves its own behaviour from experience. Contains a learning element that modifies the performance element based on feedback from a critic. All ML-based agents are learning agents.

2Characterising Environments

The environment type determines which agent design applies. A fully observable, deterministic, static game like chess is a very different problem from a partially observable, stochastic, continuous domain like autonomous driving. You cannot use the same search algorithm for both.

Fully vs Partially Observable
Fully observable: the agent sees the complete state at each step (chess). Partially observable: hidden state forces the agent to maintain a belief distribution over possible states (poker, real-world robotics).
Deterministic vs Stochastic
Deterministic: an action always produces the same next state (sliding puzzle). Stochastic: outcomes vary probabilistically (dice games, physical actuators with noise). Stochastic environments require probabilistic planning.
Episodic vs Sequential
Episodic: each decision is independent — past actions do not affect future decisions (spam filter per email). Sequential: current decisions affect future states (chess, navigation). Sequential environments require lookahead.

3Uninformed Search — BFS and DFS

A goal-based agent treats problem-solving as graph search: find a path from the initial state to a goal state. Uninformed search (also called blind search) has no information about how close a state is to the goal — it only knows the structure of the graph. Two fundamental strategies:

Breadth-First Search (BFS)
Explores all nodes at depth d before any node at depth d+1. Uses a queue (FIFO). Guaranteed to find the shallowest solution — optimal when all step costs are equal. Memory is O(bd) where b is branching factor and d is solution depth — exponential and often prohibitive for deep solutions.
Depth-First Search (DFS)
Explores as deep as possible before backtracking. Uses a stack (LIFO). Memory is O(bm) where m is maximum depth — linear in path length, far more practical than BFS for deep trees. Not optimal — the first solution found may not be the shortest. Can diverge in graphs with infinite depth if not guarded.

Completeness: BFS is complete for finite branching factors — it will always find a solution if one exists. DFS is not complete in graphs with cycles unless visited nodes are tracked. In practice, always track visited states to prevent infinite loops.

4When to Use Each — and What Comes Next

Use BFS when you need the shortest solution and the branching factor is small enough that storing the entire frontier is feasible. Use DFS when memory is the constraint, solutions are deep, and optimality is not required. Neither is practical for large real-world problems — that is where informed search (A*, greedy best-first) and ML-based planning take over.

Related

BFS vs DFS — compare paths and nodes explored

Recall check

0 of …

Say the answer out loud before revealing — recalling is what makes it stick.

  1. What does PEAS stand for and why is it useful for defining an AI agent?

  2. What is the difference in memory usage between BFS and DFS, and why?

  3. Under what conditions is BFS guaranteed to find an optimal solution?

  4. What makes an environment partially observable, and how does it change agent design?