Introduction
In this tutorial, you'll learn how to build a simple Employee AI Spend Tracker using Python and basic data structures. This tool will help you monitor how much time and resources employees spend on AI tools, similar to what Rippling created after their own AI spending discovery. We'll build a console application that tracks individual employee AI usage and displays spending reports.
Prerequisites
To follow along with this tutorial, you'll need:
- A computer with Python 3 installed (version 3.6 or higher)
- A text editor or IDE (like VS Code, PyCharm, or even Notepad)
- Basic understanding of Python concepts like variables, lists, and dictionaries
- No prior experience with AI tools required
Step-by-Step Instructions
Step 1: Set Up Your Python Environment
Why this step matters
We need to make sure our Python environment is ready to run our code. This step ensures we have all the necessary components to build our AI spending tracker.
First, open your terminal or command prompt and verify Python is installed:
python --version
If you see a version number (like Python 3.9.7), you're good to go. If not, install Python from python.org.
Step 2: Create the Main Project File
Why this step matters
We'll create our main Python file where all our tracking logic will live. This file will contain our data structures and functions to manage employee AI spending.
Create a new file called ai_spend_tracker.py and open it in your text editor.
Step 3: Initialize Our Data Structure
Why this step matters
We need a way to store employee data. In this case, we'll use a dictionary to track each employee's AI spending. This is the foundation of our tracking system.
# Initialize our employee spending data
employee_spending = {
"John Smith": {
"ai_tools": ["ChatGPT", "GitHub Copilot"],
"spend": 150.0,
"hours": 10.0
},
"Sarah Johnson": {
"ai_tools": ["Claude", "Midjourney"],
"spend": 200.0,
"hours": 15.0
}
}
This structure stores each employee's name as a key, with their AI tools, total spending, and hours used as nested values.
Step 4: Create the Add Employee Function
Why this step matters
We need a way to add new employees to our tracking system. This function will let us input new employee data and store it properly.
def add_employee(name, ai_tools, spend, hours):
"""Add a new employee to our tracking system"""
employee_spending[name] = {
"ai_tools": ai_tools,
"spend": spend,
"hours": hours
}
print(f"Added {name} to tracking system")
This function takes employee details and stores them in our main dictionary, making it easy to add new team members.
Step 5: Build the Display Spending Report Function
Why this step matters
After tracking spending, we need to be able to view and analyze the data. This function will show us a formatted report of all employee AI spending.
def display_spending_report():
"""Display a formatted report of all employee AI spending"""
print("\n=== AI SPENDING REPORT ===")
print("{:<20} {:<30} {:<10} {:<10}".format("Employee", "AI Tools", "Spend ($)", "Hours"))
print("-" * 70)
total_spend = 0
total_hours = 0
for name, data in employee_spending.items():
tools = ", ".join(data["ai_tools"])
print("{:<20} {:<30} {:<10} {:<10}".format(name, tools, data["spend"], data["hours"]))
total_spend += data["spend"]
total_hours += data["hours"]
print("-" * 70)
print("{:<20} {:<30} {:<10} {:<10}".format("TOTAL", "", total_spend, total_hours))
This function creates a clean, readable table showing all employee spending data and calculates totals.
Step 6: Create the Update Spending Function
Why this step matters
As employees use AI tools, their spending will change. This function allows us to update existing employee records with new data.
def update_employee_spending(name, new_spend, new_hours):
"""Update an employee's AI spending records"""
if name in employee_spending:
employee_spending[name]["spend"] = new_spend
employee_spending[name]["hours"] = new_hours
print(f"Updated {name}'s spending records")
else:
print(f"Employee {name} not found in system")
This function lets us modify existing employee data, keeping our tracking system current.
Step 7: Add a Menu System for User Interaction
Why this step matters
To make our tool user-friendly, we'll create a simple menu that lets users choose what actions they want to take. This makes our program interactive.
def show_menu():
"""Display the main menu options"""
print("\n=== AI SPEND TRACKER MENU ===")
print("1. Add new employee")
print("2. View spending report")
print("3. Update employee spending")
print("4. Exit")
choice = input("Enter your choice (1-4): ")
return choice
This function creates a simple interface for users to interact with our tracking system.
Step 8: Implement the Main Program Loop
Why this step matters
The main loop connects all our functions together and creates a continuous user experience. This is where our program runs and responds to user input.
def main():
"""Main program loop"""
print("Welcome to the Employee AI Spend Tracker!")
while True:
choice = show_menu()
if choice == '1':
name = input("Enter employee name: ")
tools = input("Enter AI tools (comma-separated): ").split(",")
tools = [tool.strip() for tool in tools]
spend = float(input("Enter spending amount: "))
hours = float(input("Enter hours spent: "))
add_employee(name, tools, spend, hours)
elif choice == '2':
display_spending_report()
elif choice == '3':
name = input("Enter employee name to update: ")
new_spend = float(input("Enter new spending amount: "))
new_hours = float(input("Enter new hours spent: "))
update_employee_spending(name, new_spend, new_hours)
elif choice == '4':
print("Thank you for using AI Spend Tracker!")
break
else:
print("Invalid choice. Please try again.")
# Run the program
if __name__ == "__main__":
main()
This complete program loop handles user input and calls the appropriate functions based on choices.
Step 9: Test Your Program
Why this step matters
Testing ensures our program works correctly. We'll run through various scenarios to make sure everything functions as expected.
Run your program by typing:
python ai_spend_tracker.py
Try adding new employees, viewing reports, and updating spending data to see how the system works.
Summary
In this tutorial, you've built a simple but functional Employee AI Spend Tracker. This tool mimics the functionality that Rippling created to monitor their own AI spending. You learned how to:
- Structure data using Python dictionaries
- Create functions to add, update, and display employee information
- Build a user-friendly menu system
- Handle user input and process it appropriately
This basic system can be expanded with features like data persistence (saving to files), more complex analytics, or integration with actual AI tool usage tracking APIs. The foundation you've built here demonstrates how to approach building tools that help organizations understand and manage their AI investments.


