UNIT IV — Software Agents
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)
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
| Architecture | Description | Pros | Cons | Real-Life Example |
|---|---|---|---|---|
| Reactive (Simple Reflex) | If condition → action (no memory, no planning) | Very fast, simple | Cannot handle complex goals | Thermostat, Roomba vacuum (basic) |
| Deliberative (BDI) | Beliefs, Desires, Intentions → plans using reasoning | Goal-oriented, flexible | Computationally heavy | Personal assistant (Siri, Cortana) |
| Hybrid | Combines reactive + deliberative layers | Fast response + long-term planning | Complex design | Self-driving car (Tesla Autopilot) |
| Learning Agents | Improves behavior over time using ML | Adapts to new situations | Needs training data | Recommendation 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)
| Performative | Meaning | Example Use Case |
|---|---|---|
| inform | Tell something believed true | "The price is $1200" |
| request | Ask to perform action | "Please deliver by Friday" |
| propose | Suggest a deal | "I offer $1100" |
| accept-proposal | Accept the deal | "Deal! $1150" |
| reject-proposal | Reject the deal | "Too low" |
| query-if | Ask if something is true | "Do you have stock?" |
3. Negotiation and Bargaining
Multi-agent systems often need to reach agreements.
Types of Negotiation
| Type | Description | Example |
|---|---|---|
| Auction | One seller, many buyers (or vice versa) | eBay, Google AdWords |
| Bilateral Negotiation | Two agents bargain over one or more issues | Buyer-Seller price negotiation |
| Multi-lateral | Many agents, many issues | Supply 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
| Model | How it Works | Example System |
|---|---|---|
| Direct Experience | Rate past interactions | eBay feedback score |
| Reputation (Witness) | Ask others about an agent | TripAdvisor reviews |
| Certified References | Third-party certificates | SSL certificates |
| Socio-Cognitive | Model beliefs, intentions of others | Advanced 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
| Topic | Core Idea | Real-World Example | Key Algorithm/Protocol |
|---|---|---|---|
| Agent Architecture | How agents think and act | Self-driving cars, Siri | BDI, Reactive, Hybrid |
| Agent Communication | Standardized message passing | Smart home devices | FIPA-ACL performatives |
| Negotiation | Reach mutually acceptable agreements | Online shopping, stock trading | Concession strategies |
| Argumentation | Convince using reasons and counterarguments | Automated legal systems | Dung’s Argumentation |
| Trust & Reputation | Decide whom to interact with | Uber, Airbnb, eBay | Beta 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! 🚀
UNIT IV — Software Agents
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)
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
| Architecture | Description | Pros | Cons | Real-Life Example |
|---|---|---|---|---|
| Reactive (Simple Reflex) | If condition → action (no memory, no planning) | Very fast, simple | Cannot handle complex goals | Thermostat, Roomba vacuum (basic) |
| Deliberative (BDI) | Beliefs, Desires, Intentions → plans using reasoning | Goal-oriented, flexible | Computationally heavy | Personal assistant (Siri, Cortana) |
| Hybrid | Combines reactive + deliberative layers | Fast response + long-term planning | Complex design | Self-driving car (Tesla Autopilot) |
| Learning Agents | Improves behavior over time using ML | Adapts to new situations | Needs training data | Recommendation 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)
| Performative | Meaning | Example Use Case |
|---|---|---|
| inform | Tell something believed true | "The price is $1200" |
| request | Ask to perform action | "Please deliver by Friday" |
| propose | Suggest a deal | "I offer $1100" |
| accept-proposal | Accept the deal | "Deal! $1150" |
| reject-proposal | Reject the deal | "Too low" |
| query-if | Ask if something is true | "Do you have stock?" |
3. Negotiation and Bargaining
Multi-agent systems often need to reach agreements.
Types of Negotiation
| Type | Description | Example |
|---|---|---|
| Auction | One seller, many buyers (or vice versa) | eBay, Google AdWords |
| Bilateral Negotiation | Two agents bargain over one or more issues | Buyer-Seller price negotiation |
| Multi-lateral | Many agents, many issues | Supply 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
| Model | How it Works | Example System |
|---|---|---|
| Direct Experience | Rate past interactions | eBay feedback score |
| Reputation (Witness) | Ask others about an agent | TripAdvisor reviews |
| Certified References | Third-party certificates | SSL certificates |
| Socio-Cognitive | Model beliefs, intentions of others | Advanced 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
| Topic | Core Idea | Real-World Example | Key Algorithm/Protocol |
|---|---|---|---|
| Agent Architecture | How agents think and act | Self-driving cars, Siri | BDI, Reactive, Hybrid |
| Agent Communication | Standardized message passing | Smart home devices | FIPA-ACL performatives |
| Negotiation | Reach mutually acceptable agreements | Online shopping, stock trading | Concession strategies |
| Argumentation | Convince using reasons and counterarguments | Automated legal systems | Dung’s Argumentation |
| Trust & Reputation | Decide whom to interact with | Uber, Airbnb, eBay | Beta 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! 🚀