Member-only story

Decision Making in AI Agents: From Rules to Intelligence

Arthi Rajendran
6 min readNov 28, 2024

Hey folks! 👋 Today we’re diving deep into how AI agents make decisions. We’re going way beyond simple if-else statements and building something that can actually think through problems.

This is the 5th article in the 30-day AI Agents from Zero to Hero series. Check out the first 3 articles if you haven’t already.

Previous Articles: ( Day 1, Day 2, Day 3, Day 4)

What We’re Building

We’re creating a decision-making system that can:

  • Evaluate multiple options
  • Learn from experience
  • Handle uncertainty
  • Adapt to new situations

Let’s get coding!

Starting Simple: Rule-Based Decision Making

First, let’s look at a basic rule-based system to understand the foundations:

from enum import Enum
from typing import Dict, List, Any, Tuple
import random
from dataclasses import dataclass

class Action(Enum):
MOVE_LEFT = "left"
MOVE_RIGHT = "right"
MOVE_UP = "up"
MOVE_DOWN = "down"
WAIT = "wait"

@dataclass
class State:
position: Tuple[int, int]
energy: float
has_goal: bool
obstacles: List[Tuple[int, int]]

class SimpleDecisionMaker:
def decide(self, state: State) -> Action:
# Avoid obstacles
for obstacle in state.obstacles:
if…

--

--

Arthi Rajendran
Arthi Rajendran

Written by Arthi Rajendran

I’m Arthi, an AI explorer turning complex tech into fun, relatable stories. Join me as we dive into AI’s potential in healthcare, cybersecurity, and beyond!

No responses yet