π Introduction
Many people confuse Agentic AI with Generative AI.
π But they are fundamentally different.
⚖️ Key Differences
| Feature | Generative AI | Agentic AI |
|---|---|---|
| Role | Content generation | Task execution |
| Interaction | Prompt-based | Goal-based |
| Action | No real-world actions | Executes actions |
| Autonomy | Low | High |
π Example
Generative AI
π “What is best flight?”
➡️ Gives answer
Agentic AI
π “Book me the cheapest flight”
➡️ Searches → compares → books
π§ Core Difference
π
Generative AI responds
π
Agentic AI acts and completes tasks
π― Conclusion
Agentic AI builds on generative AI but adds: ✅ Planning
✅ Execution
✅ Feedback loop
π» ✅ Code Example: Generative AI vs Agentic AI
# Generative AI → responds to prompt
def generative_ai(question):
if "flight" in question.lower():
return "The cheapest flight is $300 with Airline B"
else:
return "Here is your answer"
# Example usage
result = generative_ai("What is the best flight?")
print("Generative AI Output:", result)
π Output:
Generative AI Output: The cheapest flight is $300 with Airline B
✅ Behavior:
- Takes input
- Returns answer
- ❌ No action performed
π€ 2. Agentic AI (Thinks + Acts)
# Agentic AI → completes the full task
def agentic_ai(goal):
print("Goal:", goal)
# Step 1: Search (Perceive)
flights = [
{"price": 500, "airline": "A"},
{"price": 300, "airline": "B"},
{"price": 400, "airline": "C"}
]
print("Searching flights...")
# Step 2: Compare (Reason)
cheapest = min(flights, key=lambda x: x["price"])
print("Comparing options... Best found:", cheapest)
# Step 3: Book (Act)
print(f"✅ Booking flight with {cheapest['airline']} for ${cheapest['price']}")
return "Flight booked successfully"
# Example usage
result = agentic_ai("Book me the cheapest flight")
print("Agent Output:", result)
π Output:
Goal: Book me the cheapest flight
Searching flights...
Comparing options...
✅ Booking flight with B for $300
Agent Output: Flight booked successfully
✅ Behavior:
- Finds data
- Makes decision
- Executes action
- Completes task
π 3. Add Feedback Loop (Agent Learning)
# Adding learning capability
def learn(success=True):
if success:
print("✅ Learning: Task completed successfully")
else:
print("❌ Learning: Improve next time")
# Example
learn(success=True)
π 4. Compare Both Systems in Code
def compare_ai():
print("\n--- Generative AI ---")
print(generative_ai("What is best flight?"))
print("\n--- Agentic AI ---")
agentic_ai("Book me cheapest flight")
compare_ai()
π§ What This Code Shows
| Feature | Generative AI | Agentic AI |
|---|---|---|
| Input | Prompt | Goal |
| Output | Answer | Action |
| Execution | ❌ | ✅ |
| Autonomy | Low | High |
No comments:
Post a Comment