Home › Agentic AI with Bunty › Lesson 5

Planning: big goal, small steps

Agentic AI with Bunty, lesson 5 of 6. simple English notes, free.

Open the interactive lessonWatch on YouTube

The idea

Raj told Bunty: "Plan Mummy's birthday party for Sunday." Bunty panicked: "Sir, such a big job can't be done in one go!"

So Bunty made a plan. He broke the big goal into small steps, and did them one by one.

On every step he ran the loop from Part 4: think, act, check. Then one step failed, and Bunty changed the plan.

The code: A plan with a Plan B

Save this as bunty_plan.py and run it with python bunty_plan.py:

# Planning: break a big goal into small steps, check each one, and re-plan when a step fails.
def order_cake():      return True
def message_guests():  return True
def book_decorator():  return False          # the decorator is not coming!
def balloons_online(): return True

plan = [("Order the cake", order_cake), ("Message the guests", message_guests), ("Decoration", book_decorator)]
plan_b = {"Decoration": ("Order balloons online", balloons_online)}

print("Goal: Mummy's birthday party on Sunday")
for i, (name, do) in enumerate(plan, 1):
    ok = do()                                  # act
    print(f"Step {i}: {name} -> {'done' if ok else 'FAILED'}")   # check
    if not ok and name in plan_b:              # re-plan
        new_name, new_do = plan_b[name]
        print(f"  Re-plan: {new_name} -> {'done' if new_do() else 'FAILED'}")
print("Party ready!")

Output:

Goal: Mummy's birthday party on Sunday
Step 1: Order the cake -> done
Step 2: Message the guests -> done
Step 3: Decoration -> FAILED
  Re-plan: Order balloons online -> done
Party ready!

The plan is a list of small steps. Each step is done and checked. When the decoration step fails, Bunty switches to Plan B.

Try it: change the code

Try it yourself

Remember

A good agent breaks a big goal into steps, and re-plans when it needs to. Next: Part 6, Memory.

← The agent loop: think, act, check · Memory: write it down, read it next time →

All lessons: Agentic AI with Bunty