Topic 1: Knowledge-Based Agents

Understanding the Foundation of Intelligent Reasoning

Back to Lecture 7 Overview

What is a Knowledge-Based Agent?

A Knowledge-Based Agent (KBA) is an intelligent agent that uses knowledge about its environment and logical reasoning to make decisions, rather than relying solely on reactive responses to stimuli.

Key Characteristics:
  • Knowledge Storage: Maintains a knowledge base (KB) containing facts and rules
  • Reasoning Capability: Can derive new information from existing knowledge
  • Goal-Oriented: Uses reasoning to achieve specific objectives
  • Adaptive: Can learn and update its knowledge base

KBA vs Reactive Agents

Aspect Reactive Agents Knowledge-Based Agents
Decision Making Direct stimulus-response Reasoning-based decisions
Memory No persistent memory Maintains knowledge base
Learning Cannot learn from experience Can learn and update knowledge
Complexity Simple, fast responses Complex reasoning processes
Flexibility Limited to programmed responses Highly flexible and adaptable
Example Thermostat, simple robot Expert system, chess program

The Role of Knowledge Base (KB)

The Knowledge Base is the heart of a knowledge-based agent. It stores facts and rules about the world that the agent can use for reasoning.

What's Stored in KB:
  • Facts: Basic statements about the world
  • Rules: If-then relationships
  • Axioms: Fundamental truths
  • Constraints: Limitations and boundaries
KB Operations:
  • Tell: Add new knowledge
  • Ask: Query existing knowledge
  • Retract: Remove outdated knowledge
  • Update: Modify existing knowledge
Example Knowledge Base:
// Facts
is_bird(tweety)
has_wings(tweety)
can_fly(X) :- is_bird(X), has_wings(X)

// Rules
if can_fly(X) then is_animal(X)
if is_animal(X) then is_living(X)

The Sense-Reason-Act Cycle

Knowledge-based agents follow a continuous cycle of perceiving, reasoning, and acting:

Perceive
Tell
Ask
Act
1. Perceive

Agent observes the environment through sensors

2. Tell

Add new percepts to the knowledge base

3. Ask

Query KB to determine what action to take

4. Act

Execute the chosen action in the environment

The Declarative Approach

The declarative approach focuses on what is true rather than how to act. This separation of knowledge and control provides several advantages:

Advantages:
  • Modularity: Knowledge and control are separate
  • Reusability: Same knowledge can be used for different tasks
  • Maintainability: Easy to update knowledge without changing code
  • Transparency: Knowledge is explicit and understandable
Challenges:
  • Representation: Need formal languages for knowledge
  • Inference: Requires efficient reasoning algorithms
  • Completeness: Must represent all relevant knowledge
  • Consistency: Knowledge must not contradict itself

PEAS Examples: Wumpus World

The PEAS framework helps us analyze agent design by considering Performance, Environment, Actuators, and Sensors.

Wumpus World Agent:
Performance:
  • Find gold
  • Avoid wumpus
  • Avoid pits
  • Minimize steps
Environment:
  • 4×4 grid world
  • Partially observable
  • Stochastic (wumpus location)
  • Sequential
Actuators:
  • Move forward
  • Turn left/right
  • Grab gold
  • Shoot arrow
Sensors:
  • Stench (near wumpus)
  • Breeze (near pit)
  • Glitter (gold present)
  • Bump (hit wall)
Why Wumpus World is Perfect for KBAs:
  • Partial Observability: Agent must reason about hidden information
  • Uncertainty: Multiple possible world states
  • Logical Inference: Can derive safe actions from percepts
  • Knowledge Accumulation: Each step adds new information

Key Takeaways

Knowledge-Based Agents:
  • Use knowledge + inference for intelligent behavior
  • Follow sense-reason-act cycle
  • Maintain persistent knowledge base
  • Can learn and adapt over time
Design Principles:
  • Separate knowledge from control
  • Use declarative representation
  • Enable logical inference
  • Support knowledge updates
Next Steps:

Now that we understand what knowledge-based agents are, we'll explore how to structure and organize the knowledge they use in Topic 2: Knowledge Base Structure.

Back to Overview Next: Knowledge Base Structure