Meet Your First AI Agent — A Smart To-Do List That Works for You

AI Agents have become a hot topic in the tech world lately. I’ve been diving deep into this fascinating area for the past few months and I’m excited to share what I’ve learned about creating AI agents! If you’re interested in discovering how AI can streamline tasks and enhance decision-making, you’ve come to the right spot.

Let’s dive in with a practical example. For this blog we will be creating an AI powered to-do list that not only keeps track of your tasks but also helps you prioritize and schedule them efficiently.

What Is an AI Agent?

Think of an AI agent as a digital assistant that can perceive its environment, make decisions, and take actions to achieve specific goals. Unlike traditional software that follows predefined instructions, AI agents can adapt and learn from their experiences, making them more flexible and intelligent over time.

Before we start, here’s how we’ll approach it:

  1. Perception: The agent will gather information about your tasks, deadlines, and priorities.
  2. Reasoning/Decision-Making: It will analyze this information to determine the optimal order and timing for each task.
  3. Action: The agent will schedule tasks into your calendar and send reminders.

Tools We’ll Use

  • Programming Language: Python
  • Libraries: Pandas for data handling, datetime for scheduling, and a simple rule-based system for decision-making.

Project Setup

Now on to building your very first AI agent. Exciting!

Prerequisites

  • Python 3.8+
  • Basic knowledge of Python and CSV files
  • Git (optional but recommended)

Here’s the folder layout we’ll be aiming for:

smart_todo_ai_agent/
├── data/                   # Task CSV file
├── smart_todo_agent/       # Agent code (Python package)
│   ├── __init__.py
│   ├── core.py             # Agent logic
│   └── run_agent.py        # CLI execution script
├── tests/                  # Unit tests
├── setup.py                # Python packaging and CLI
└── requirements.txt

Step 1: Define the Tasks

Now let’s begin building the agent. For the first step, we are going to create a simple dataset that represents your daily tasks. This will give our AI agent something to process. Someday, when you advance this, you can use data directly from a database. You might even use data from a real-time data source.

You’ll define your task list in a CSV file data/tasks.csv. Each task includes:

  • name: what the task is
  • deadline: when it must be done
  • priority: 1 (high) to 3 (low)
  • duration: estimated time in hours
data/tasks.csv
name,deadline,priority,duration
Write blog post,2025-05-10,1,2
Answer emails,2025-05-08,2,1
Workout,2025-05-07,3,1

This simple dataset acts as the environment your AI agent will perceive.

Step 2: Perception – Load the Tasks

The next step is to help our AI agent perceive its environment. In our case, that environment is the CSV file we just created. This step is similar to how a human looks at their calendar or to-do list.

We’ll use pandas to load the data and convert the deadline column into proper datetime objects, so our agent can work with them.

smart_todo_agent/core.py
import pandas as pd

def load_tasks(file_path):
    df = pd.read_csv(file_path)  # Read the CSV file into a DataFrame
    df['deadline'] = pd.to_datetime(df['deadline'], errors='coerce')  # Convert deadline to datetime
    return df.dropna(subset=['deadline'])  # Drop rows with invalid deadlines

This gives our agent a structured view of the tasks it needs to work with.

Step 3: Reasoning – Prioritize the Tasks

Now that the agent can “see” the task list, we need to help it reason — just like we do when we look at a list and ask, “What should I do first?”

This function will sort the tasks first by deadline (earliest first) and then by priority (1 being highest). That way, the most urgent and important tasks float to the top.

smart_todo_agent/core.py
def prioritize_tasks(df):
    return df.sort_values(by=['deadline', 'priority'])

This is the first piece of intelligence we give our agent — it’s no longer just reading; it’s thinking.

Step 4: Action – Schedule the Tasks

Now it’s time to let the agent act. We want it to create a realistic plan by assigning time slots to each task.

We’ll simulate starting from 9AM (or the current hour) and allocate time slots based on each task’s duration. This helps the agent turn its decisions into action.

smart_todo_agent/core.py
from datetime import datetime, timedelta

def schedule_tasks(df, start_time):
    schedule = []
    current = start_time
    for _, row in df.iterrows():
        end = current + timedelta(hours=row['duration'])  # Calculate end time
        schedule.append({
            'task': row['name'],
            'start': current.strftime('%H:%M'),
            'end': end.strftime('%H:%M')
        })
        current = end  # Move to the next time slot
    return schedule

This completes the sense-think-act cycle for our agent.

Step 5: Connect It All in run_agent.py

Let’s now bring everything together. This script will serve as the agent’s brain — the place where perception, reasoning, and action all flow in a sequence.

smart_todo_agent/run_agent.py
from smart_todo_agent.core import load_tasks, prioritize_tasks, schedule_tasks
from datetime import datetime

def main():
    df = load_tasks('data/tasks.csv')
    prioritized = prioritize_tasks(df)
    now = datetime.now().replace(minute=0, second=0, microsecond=0)
    result = schedule_tasks(prioritized, now)

    print("=== Your Smart Schedule ===")
    for task in result:
        print(f"{task['task']}{task['start']} to {task['end']}")

if __name__ == "__main__":
    main()

Step 6: Add a Test Case

Let’s take a moment to validate that our agent is thinking the way we expect. Testing may sound boring, but it’s how you make sure your AI behaves consistently.

Here’s how we test whether our task prioritization is working as intended:

tests/test_core.py
import pandas as pd
from smart_todo_agent.core import prioritize_tasks

def test_priority_order():
    data = pd.DataFrame([
        {"name": "Task A", "deadline": "2025-05-10", "priority": 2, "duration": 1},
        {"name": "Task B", "deadline": "2025-05-08", "priority": 1, "duration": 1}
    ])
    data['deadline'] = pd.to_datetime(data['deadline'])
    result = prioritize_tasks(data)
    assert result.iloc[0]['name'] == 'Task B'  # B has the earliest deadline and highest priority

Run it with:

pytest

This is a great habit for building robust and reliable AI systems.

Understanding setup.py

You might be wondering how to turn all of this into something more usable. Here’s where setup.py comes in — it allows you to package your project so it can be installed and run like a real CLI tool.

setup.py
from setuptools import setup, find_packages

setup(
    name='smart_todo_agent',
    version='0.1.0',
    packages=find_packages(),
    install_requires=['pandas'],
    entry_points={
        'console_scripts': [
            'run-agent=smart_todo_agent.run_agent:main',
        ],
    },
)

Install it in development mode:

pip install -e .

Then run your AI agent using:

run-agent

This practice helps you prepare your project for reuse and sharing. You can also check the full project at https://github.com/amalg989/smart-todo-ai-agent.

What’s Next?

  • Add calendar integration using Google Calendar API
  • Use NLP to accept natural language task entries
  • Predict duration using past data and machine learning

This is not just about simply cloning a AI agent project — it’s about learning how to design and build intelligent software agents from scratch. By walking through this small yet meaningful example, you’re building foundational skills in agent design, data processing, and automation.

Next time you open your calendar and see your smart agent already did the work — you’ll know how it was built.

Happy hacking!


Discover more from Amal Gamage

Subscribe to get the latest posts sent to your email.

Previous Article

Natural Language Processing Pipelines in Node.js

Write a Comment

Leave a Reply