top of page

How I built an AI Agent without writing code:

Updated: May 7

Using prompt engineering to automate one of the most tedious workflows in product ops.





The Problem

For many small-to-medium businesses, handling product orders that come in via email is still a manual, messy process. Team members often sift through long threads, extract item names, match them to inventory records, check availability, and update a spreadsheet.


I wanted to see if I could automate that workflow — using prompt engineering only, without traditional software development.


The Solution

I built a lightweight AI agent that uses OpenAI’s GPT model and Google Sheets to:

  • Automatically extract product orders from messy customer emails.

  • Match each order to the correct product in a structured database.

  • Interpret tricky instructions like “send ALL” or ambiguous quantities.

  • Check stock levels and assign order status accordingly (Created, Out of Stock, etc.).

  • Output everything in a clean, real-time spreadsheet.


All powered by prompts, not custom software.


Tools Used

  • OpenAI API for language understanding

  • Python + Google Colab for flow control

  • Google Sheets API for reading & writing to order dashboards


Behind the Scenes

Task 1: Classify emails

First: Connect to Google Sheets and Load Data: To process emails and classify them correctly, we first establish a connection to Google Sheets where our input and output data is stored.


🛠 This step does the following:


✅ Authenticates using a Google Service Account to access Google Sheets.

✅ Opens the Output Spreadsheet using its unique ID.

✅ Loads the email-classification and order-status sheets for further processing.

✅ Ensures the connection is successfully established before proceeding to classification and order extraction.


Last: Extract Order Details from Email Text

To ensure accurate order processing, we extract product IDs and quantities while avoiding false positives such as user referencing a specific product, but not expressly intending to order it. This also means finding ways to ID wrongly formatted product IDs within the email. Example of user inquiry email:

Hey there, I would like to buy Chelsea Boots [CBT 89 01] from you guys! You're so awesome I'm so impressed with the quality of Fuzzy Slippers - FZZ1098 I've bought from you before. I hope the quality stays. I would like to order Retro sunglasses from you, but probably next time! Thanks

🛠 This step does the following:


✅ Extracts product IDs using a regex pattern for formats like ABC1234.

✅ Captures quantity mentions, supporting words like "all," "remaining," or "a pair of."

✅ Maps common quantity words (e.g., "one" → 1, "a set of" → 2) for consistency.

✅ Ensures extracted product IDs and quantities are properly paired.

✅ Defaults quantity to 1 if no specific quantity is found.

✅ Prints confirmation once the extraction function is defined.

Task 2: Process Orders and Update Stock
Task 3: Handle Product Inquiries

Results

The final spreadsheet updates in real time with:

  • Product requests

  • Matched product IDs

  • Available stock

  • Order status (Created, Out of Stock, Partially Fulfilled, etc.)


This is the spreadsheet that had the emails and the product descriptions.


Below is the output sheet:



Want to see the full output sheet with processed orders?






🔑 Key Takeaways

  • AI agents are practical now — not just hype. They can already handle real, unglamorous business problems like order processing, lead qualification, and inbox triage.


  • Prompt engineering is UX — The way you design instructions to AI is just as important as UI design. Clear flows and good error handling make or break the experience.


  • You can ship fast with AI tools — This entire agent was built using Colab, Python, the OpenAI API, and Google Sheets. No full-stack team needed.


  • This is just the beginning — With a few more tweaks, this agent could expand to handle stock checks, pricing updates, CRM syncing, or even generate automated responses to suppliers and clients.


✨ Conclusion

This project was more than a technical experiment — it was a real-world demonstration of how AI can bridge the gap between unstructured human communication and structured business workflows. By using prompt engineering and automation tools, I turned messy, free-text email orders into clean, usable data — all without writing a traditional backend.


Whether you're a solo founder, operations lead, or product manager, this kind of AI-powered agent shows that you no longer need extensive programming expertise to create meaningful, scalable impact. With the right AI building blocks and a clear user workflow, you can transform how your business handles information, decisions, and customer interactions.

🚀 What’s Next?


This project has opened up a lot of exciting possibilities. I’m exploring whether to package this into a production-ready agent that others can use in their workflows — or simply let it live as a personal proof of concept that showcases what I’m capable of building from scratch using AI tools. Or maybe both.


Either way, this is a strong reminder of what’s now possible with just curiosity, a clear problem, and the right tools — and I can’t wait to keep building.


Chat me up if you want a peek at the full notebook or want to collaborate on something similar.

Comments


© Product Queen Inc. 2025

  • Medium
  • LinkedIn
bottom of page