Loading...
Development

Complete Notes for Deep Understanding (with Real-Life Examples & Key Concepts)

UNIT IV — Software Agents

Complete Notes for Deep Understanding (with Real-Life Examples & Key Concepts)

1. Architecture for Intelligent Agents

An Intelligent Agent is a software entity that:

  • Perceives its environment (through sensors/messages)
  • Acts autonomously to achieve goals (through actuators/actions)
  • Reasons and plans
  • Communicates with other agents/humans

Types of Agent Architectures

ArchitectureDescriptionProsConsReal-Life Example
Reactive (Simple Reflex)If condition → action (no memory, no planning)Very fast, simpleCannot handle complex goalsThermostat, Roomba vacuum (basic)
Deliberative (BDI)Beliefs, Desires, Intentions → plans using reasoningGoal-oriented, flexibleComputationally heavyPersonal assistant (Siri, Cortana)
HybridCombines reactive + deliberative layersFast response + long-term planningComplex designSelf-driving car (Tesla Autopilot)
Learning AgentsImproves behavior over time using MLAdapts to new situationsNeeds training dataRecommendation systems (Netflix)

BDI Architecture (Most Important in Theory)

  • Beliefs: Agent’s knowledge about the world (e.g., "battery_low = true")
  • Desires/Goals: What the agent wants to achieve (e.g., "reach charging station")
  • Intentions: Committed plans (e.g., "follow path P1 to charger")

Jason / AgentSpeak Code Example (BDI in Practice)

// Simple cleaning robot in Jason
!start.

+!start : true <- move_to(living_room); clean.

+dirt(X,Y) : position(MyX, MyY) & MyX=X & MyY=Y 
   <- suck_dirt; broadcast(tell, dirt_cleaned(X,Y)).

+battery_low : true 
   <- !recharge.   // new goal

+!recharge : true 
   <- move_to(charger); recharge.

2. Agent Communication

Agents need a common language to cooperate or compete.

Key Components of Agent Communication

  • Ontology: Shared vocabulary (e.g., "price", "delivery_date")
  • Content Language: Meaning of message (e.g., RDF, JSON)
  • Communication Protocol: Rules of conversation
  • ACL (Agent Communication Language) → FIPA-ACL is standard

FIPA-ACL Message Structure (Most Important)

( inform
   :sender   buyer_agent
   :receiver seller_agent
   :content  (price laptop 1200)
   :language Prolog
   :ontology electronics-sale
   :protocol fipa-request
)

Performative Types (Speech Acts)

PerformativeMeaningExample Use Case
informTell something believed true"The price is $1200"
requestAsk to perform action"Please deliver by Friday"
proposeSuggest a deal"I offer $1100"
accept-proposalAccept the deal"Deal! $1150"
reject-proposalReject the deal"Too low"
query-ifAsk if something is true"Do you have stock?"

3. Negotiation and Bargaining

Multi-agent systems often need to reach agreements.

Types of Negotiation

TypeDescriptionExample
AuctionOne seller, many buyers (or vice versa)eBay, Google AdWords
Bilateral NegotiationTwo agents bargain over one or more issuesBuyer-Seller price negotiation
Multi-lateralMany agents, many issuesSupply chain contracts

Negotiation Strategies

  • Concession: Gradually reduce demand (e.g., time-dependent, resource-dependent)
  • Zeuthen Strategy: Based on risk attitude
  • Game-Theoretic (Nash Bargaining)

Python Example: Simple Buyer-Seller Negotiation

class NegotiatingAgent:
    def __init__(self, name, min_price, max_price, is_buyer):
        self.name = name
        self.min_price = min_price
        self.max_price = max_price
        self.is_buyer = is_buyer
        self.current_offer = max_price if is_buyer else min_price

    def make_offer(self, opponent_offer):
        if self.is_buyer:
            if opponent_offer <= self.current_offer:
                return opponent_offer  # accept
            self.current_offer = min(self.max_price, opponent_offer * 0.95)
        else:
            if opponent_offer >= self.current_offer:
                return opponent_offer  # accept
            self.current_offer = max(self.min_price, opponent_offer * 1.05)
        return self.current_offer

# Simulation
buyer = NegotiatingAgent("Buyer", 800, 1500, True)
seller = NegotiatingAgent("Seller", 1000, 2000, False)

offer = 1500
rounds = 0
while rounds < 20:
    print(f"Round {rounds}: Buyer offers {offer}")
    seller_response = seller.make_offer(offer)
    if seller_response == offer:
        print(f"Deal at ${offer}!"); break
    offer = seller_response
    rounds += 1
else:
    print("No deal reached")

4. Argumentation among Agents

Agents exchange arguments (not just offers) to convince each other.

Argument Structure

  • Claim: "You should accept $1200"
  • Premise: "Because market price is $1150 and you need fast delivery"
  • Backing: "Data from Amazon shows..."
  • Rebuttal: "But I have high shipping cost"

Famous Argumentation Frameworks

  • Dung’s Abstract Argumentation Framework
    • Arguments attack each other
    • Find acceptable sets (stable, preferred, grounded extensions)

Real-Life Example: Legal dispute resolution bots, peer review systems

5. Trust and Reputation in Multi-Agent Systems

Critical in open systems (eBay, Uber, Airbnb)

Trust Models

ModelHow it WorksExample System
Direct ExperienceRate past interactionseBay feedback score
Reputation (Witness)Ask others about an agentTripAdvisor reviews
Certified ReferencesThird-party certificatesSSL certificates
Socio-CognitiveModel beliefs, intentions of othersAdvanced research agents

Popular Reputation Algorithms

  • EigenTrust: Google PageRank-style reputation
  • Beta Reputation System: Uses beta distribution (simple & effective)

Python: Simple Beta Reputation System

import numpy as np

class ReputationSystem:
    def __init__(self):
        self.ratings = {}  # agent -> (positive, negative)

    def add_rating(self, agent, rating):  # rating = 1 (good), 0 (bad)
        pos, neg = self.ratings.get(agent, (0, 0))
        if rating == 1:
            self.ratings[agent] = (pos + 1, neg)
        else:
            self.ratings[agent] = (pos, neg + 1)

    def reputation(self, agent):
        pos, neg = self.ratings.get(agent, (1, 1))  # start with 1,1 (neutral)
        return (pos + 1) / (pos + neg + 2)  # Bayesian smoothing

# Example usage
rep = ReputationSystem()
seller = "FastShippingCo"

# 8 good, 2 bad ratings
for _ in range(8): rep.add_rating(seller, 1)
for _ in range(2): rep.add_rating(seller, 0)

print(f"Reputation of {seller}: {rep.reputation(seller):.2f}")  # ~0.77

Summary Table – Unit IV

TopicCore IdeaReal-World ExampleKey Algorithm/Protocol
Agent ArchitectureHow agents think and actSelf-driving cars, SiriBDI, Reactive, Hybrid
Agent CommunicationStandardized message passingSmart home devicesFIPA-ACL performatives
NegotiationReach mutually acceptable agreementsOnline shopping, stock tradingConcession strategies
ArgumentationConvince using reasons and counterargumentsAutomated legal systemsDung’s Argumentation
Trust & ReputationDecide whom to interact withUber, Airbnb, eBayBeta Reputation, EigenTrust

Key Takeaways

  • Software agents are the building blocks of modern distributed AI (IoT, smart cities, blockchain agents).
  • Communication + Negotiation + Trust = Foundation of Multi-Agent Systems (MAS).
  • Real commercial systems (Amazon, Uber, blockchain DAOs) use these concepts daily.

Master Unit IV → You understand how future AI societies (multi-agent economies, robot teams, decentralized AI) will work! 🚀