CACS410 Artificial Intelligence

Artificial IntelligenceUnit 1011 min read

AI Agents, PEAS Framework & Turing Test

Unit 10 of Artificial Intelligence explores AI agents (their types, architectures, and PEAS framework), the Turing Test (history, criteria, and modern debates), and real-world applications in chatbots, recommendation systems, and autonomous systems—with visual traces of agent decision-making and test simulations.

TAKEAWAYS:

  • An AI agent is an entity that perceives its environment and acts to achieve goals, classified by perception, action, and architecture (e.g., reflex, goal-based, utility-based).
  • The PEAS framework (Performance, Environment, Actuators, Sensors) systematically analyzes agents by their operational constraints and capabilities.
  • The Turing Test evaluates an agent’s human-like intelligence through text-based interactions, with modern variants like the Loebner Prize and Winograd Schema Challenge.
  • Real-world agents include chatbots (e.g., WhatsApp’s AI assistant), recommendation systems (e.g., Daraz’s product suggestions), and autonomous systems (e.g., Pathao’s route optimization).
  • Limitations of agents include bounded rationality, partial observability, and ethical dilemmas (e.g., self-driving cars’ utility trade-offs).
  • Exam focus: Compare agent types, design PEAS for a custom agent, and critique the Turing Test’s validity in modern AI.

1. What is an AI Agent?

An AI agent is a system that perceives its environment through sensors and acts upon it via actuators to achieve goals. Agents are the fundamental building blocks of AI, bridging theory and real-world applications.

Key Components of an Agent

Every agent has:

  1. Perceptors (Sensors): Input devices (e.g., cameras, microphones, GPS) that gather data from the environment.
  2. Effectors (Actuators): Output mechanisms (e.g., motors, speakers, screens) that perform actions.
  3. Agent Program: The logic (e.g., rules, neural networks) that maps perceptions to actions.

classDiagram
    class Agent {
        +perceive() Environment
        +act() Action
        +agentProgram() Logic
    }
    class Environment {
        +getState() State
        +executeAction(Action) State
    }
    Agent --> Environment : perceives
    Environment --> Agent : updates

Example: A thermostat agent perceives room temperature (sensor) and turns the heater on/off (actuator) to maintain a set temperature (goal).


2. Types of AI Agents

Agents are classified based on their perception, action, and decision-making capabilities. Below is a comparison table:

Agent Type Description Example Advantages Disadvantages
Simple Reflex Agent Acts based on current perception (no memory). Vending machine Fast, simple No history-dependent decisions
Model-Based Agent Maintains an internal state of the world (e.g., maps, models). GPS navigation system Handles partial observability Requires accurate world models
Goal-Based Agent Chooses actions to achieve a goal (e.g., shortest path). Pathao’s route optimizer Optimizes for objectives Needs goal representation
Utility-Based Agent Selects actions that maximize expected utility (trade-offs). Daraz’s recommendation system Balances multiple objectives Computationally expensive
Learning Agent Improves performance over time (e.g., via reinforcement learning). WhatsApp’s spam filter Adapts to new data Requires training data

Worked Example: Simple Reflex Agent Scenario: Design a traffic light controller agent for a single intersection.

  • Percepts: Sensor inputs for car presence at each direction (N, S, E, W).
  • Actions: Turn green/red for each direction.
  • Rule: If cars detected in North, turn North green, others red.
  • PEAS Framework (see next section) would analyze this agent’s performance.

3. The PEAS Framework: Analyzing Agents

The PEAS framework evaluates agents by four dimensions:

  1. Performance Measure: How success is defined (e.g., "minimize wait time at traffic lights").
  2. Environment: Fully observable? Dynamic? Discrete/continuous?
  3. Actuators: What actions can the agent take?
  4. Sensors: What data can the agent perceive?

Worked Example: English-to-Nepali Translating Agent PEAS Analysis:

Dimension Details
Performance Accuracy: 95% translation correctness; latency: <2s response time.
Environment Partially observable (input text may be ambiguous); static (no real-time changes).
Actuators Outputs translated text via API or UI.
Sensors Input text, user feedback (e.g., corrections), language context.

Agent Architecture:

  • Simple Reflex: If input = "hello", output = "नमस्ते".
  • Model-Based: Uses a pre-trained neural machine translation (NMT) model.
  • Utility-Based: Prioritizes formal vs. casual translations based on user history.

flowchart LR
    A["Input: English Text"] --> B["Preprocessing: Tokenization"]
    B --> C["NMT Model: Translation"]
    C --> D["Postprocessing: Grammar Check"]
    D --> E["Output: Nepali Text"]
    E --> F["User Feedback Loop"]

Real-World Tie-In:

  • Google Translate uses a utility-based agent to balance speed, accuracy, and context awareness. For example, translating "I’m hungry" to "म मलाई खानेको छ" (Nepali) vs. "मलाई खाना खान्छ" (formal).

4. The Turing Test: Measuring Intelligence

Proposed by Alan Turing (1950), the Imitation Game tests whether a machine can exhibit human-like intelligence by convincing a judge in a text-based conversation that it is human.

How the Test Works

  1. A human judge interacts via text with:
    • A human (hidden).
    • A machine (the AI agent).
  2. If the judge cannot reliably distinguish the machine from the human, the machine passes.

Modern Variants

  • Loebner Prize: Annual competition with cash prizes for best chatbot.
  • Winograd Schema Challenge: Tests commonsense reasoning (e.g., "The city councilmen refused the demonstrators a permit because they [feared/advocated] violence").
  • Conversational AI: Google’s LaMDA and Meta’s BlenderBot are evaluated using similar criteria.

Criticisms of the Turing Test:

  • Narrow Focus: Tests only language, not other intelligences (e.g., visual, spatial).
  • Cheating: Machines can mimic without understanding (e.g., memorizing scripts).
  • Ethical Concerns: Could enable deception (e.g., scam bots).

Alan Turing portraitFather of the Turing Test, 1950 (Image: Elliott &amp; Fry, Public domain, via Wikimedia Commons)


5. Real-World AI Agents in Nepal

Example 1: eSewa’s Payment Agent

  • Type: Utility-based agent (balances security, speed, and user convenience).
  • PEAS:
    • Performance: 99% transaction success rate, <5s processing time.
    • Environment: Partially observable (network issues, fraud attempts).
    • Actuators: Sends payment confirmations, deducts funds.
    • Sensors: User input (amount, recipient), bank API responses.
  • How It Works:
    1. User requests payment via app.
    2. Agent validates input (e.g., sufficient balance).
    3. Agent executes transaction and updates ledger.
    4. Sends OTP for confirmation.

Example 2: Pathao’s Ride-Matching Agent

  • Type: Goal-based + learning agent (optimizes for driver-passenger matching).
  • PEAS:
    • Performance: Minimize wait time, maximize driver earnings.
    • Environment: Dynamic (traffic, demand fluctuations).
    • Actuators: Assigns rides, updates driver/passenger locations.
    • Sensors: GPS, ride requests, driver availability.
  • Decision Tree:

Example 3: NTC’s Traffic Management System

  • Type: Model-based agent (simulates traffic flow).
  • PEAS:
    • Performance: Reduce congestion by 20% in peak hours.
    • Environment: Fully observable (cameras, sensors) but stochastic (accidents, events).
    • Actuators: Adjusts traffic light timings.
    • Sensors: Vehicle counts, speed data.
  • Challenge: Partial observability (e.g., hidden accidents) leads to suboptimal decisions.

6. Designing an Agent: Step-by-Step

Scenario: Design a Khalti Fraud Detection Agent.

  1. Define Goals:
    • Detect fraudulent transactions with >95% accuracy.
    • Minimize false positives (legitimate transactions blocked).
  2. Choose Agent Type:
    • Model-based + learning agent (uses historical fraud patterns).
  3. PEAS Framework:
    Dimension Details
    Performance Precision: 98%, Recall: 92% (from training data).
    Environment Partially observable (new fraud tactics emerge).
    Actuators Flags transactions, blocks high-risk ones, alerts user.
    Sensors Transaction amount, time, location, user history, device fingerprint.
  4. Algorithm:
    • Train a random forest classifier on labeled fraud/non-fraud data.
    • Update model weekly with new fraud patterns.

7. The Turing Test in Practice: Chatbots

Example: WhatsApp Business AI Assistant

  • How It Passes the Test:
    • Mimics human responses (e.g., "Sorry, I didn’t understand. Can you rephrase?").
    • Uses contextual memory (remembers past messages in a conversation).
  • Limitations:
    • Fails on ambiguous queries (e.g., "What’s the capital of Nepal?" vs. "What’s the capital of your country?").
    • No true understanding (e.g., cannot explain why it gave an answer).

8. Ethical and Practical Challenges

  1. Bias in Agents:
    • Example: If a loan approval agent is trained on historical data where women were denied loans, it may perpetuate bias.
  2. Autonomy vs. Control:
    • Example: Self-driving cars (e.g., Tesla) must decide between utility-based trade-offs (e.g., swerving to avoid pedestrians).
  3. Accountability:
    • Who is responsible if an agent makes a harmful decision? (e.g., a medical diagnosis AI misclassifies a tumor.)

Exam Tip: How to Score Full Marks

  1. For Agent Types:

    • Always compare two types (e.g., "Goal-based agents use internal goals like Pathao’s route optimization, while reflex agents act instantly like a vending machine").
    • Draw a decision tree for goal-based agents to show how they evaluate actions.
  2. For PEAS Questions:

    • Use a table format (as shown above).
    • Relate to real systems: "Like eSewa’s agent, this system must handle [partial observability/network issues]."
  3. For the Turing Test:

    • Critique it: Mention Searle’s Chinese Room argument (symbol manipulation ≠ understanding).
    • Modern examples: "LaMDA passed some Turing-like tests but failed the Winograd Schema Challenge."
  4. Worked Examples:

    • Show every step: For a reflex agent, list all possible percept-action pairs.
    • Use small numbers: "If percept = {car at North}, action = turn North green."

Final Visual Summary:

mindmap
  root((AI Agents))
    Types
      Simple Reflex
      Model-Based
      Goal-Based
      Utility-Based
      Learning
    PEAS Framework
      Performance
      Environment
      Actuators
      Sensors
    Turing Test
      Imitation Game
      Loebner Prize
      Winograd Schema
    Real-World
      eSewa (Utility-Based)
      Pathao (Goal-Based)
      WhatsApp (Learning)

Based on the TU BCA syllabus for Artificial Intelligence (CACS410), unit 10.

Discussion

Loading…