How I built an AI Agent without writing code:
- Cindy Adem
- May 6
- 6 min read
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
Once orders have been extracted and classified, the next step is to process them by verifying stock availability and updating inventory.
First: To ensure smooth order management, we process extracted orders and update stock levels accordingly.
🛠 This step does the following:
✅ Creates a copy of the product catalog to track stock changes.
✅ Verifies if each order is classified as a valid "Order request" or "Product inquiry, Order request" before processing.
✅ Checks available stock for each ordered product and updates it if sufficient.
✅ Marks orders as "out of stock" if there is no more inventory of the product
✅ Marks orders as 'partially fulfilled' if requested quantity exceeds available inventory.
✅ Updates inventory sequentially based on email_id
✅ Appends processed orders to a structured list with relevant details (email_id, product_id, quantity, status).
✅ Writes the processed order data to the order-status sheet in Google Sheets.
✅ Skips writing data if there are no orders to process, preventing unnecessary updates.:
Last: Generate order responses
To enhance customer experience, we generate personalized order responses based on processing results.
🛠 This step does the following:
✅ Extracts all processed orders related to a specific email.
✅ Retrieves the original email text to provide relevant context in the response.
✅ Groups orders into categories:
"created" → Successfully processed orders.
"out of stock" → Items unavailable, with possible alternatives suggested.
"product not found" → Items not found in the product catalog.
✅ Uses an LLM (GPT) to generate a warm, professional response:
Acknowledging the order.
Listing successfully processed items.
Explaining stock issues and offering alternatives.
Ensuring a friendly and professional tone.
✅ Ensures responses are customer-friendly and sign off as "Customer Service Team."
What our fulfilment database looks like after this step:

Task 3: Handle Product Inquiries
First step: Customers may ask general or specific product-related questions. The AI system must generate relevant and personalized responses using information from the product catalog.
🛠 This task does the following:
✅ Responds to product inquiries using structured product catalog data.
✅ Retrieves relevant product information without loading the entire catalog into the prompt.
✅ Ensures responses are scalable to handle a catalog with over 100,000 products.
✅ Generates responses that are accurate, informative, and customer-friendly.
✅ Saves responses to the inquiry-response sheet in Google Sheets.
Final step: Process Multiple Product Inquiries
To finalize product inquiry handling, we process multiple inquiries and ensure accurate retrieval.
🛠 This step does the following:
✅ Iterates over multiple customer inquiries to retrieve relevant product data.
✅ Uses an improved **product retrieval function** to filter results accurately.
✅ Handles non-string inputs gracefully to prevent runtime errors.
✅ Displays retrieved products or warnings when no matches are found.
✅ Ensures the system is robust enough for large-scale inquiry processing.
Example:
User email:
"After weeks of consideration, I've made up my mind! Looking at my bank account right now, and I'm prepared to commit to those CGN2345 Cargo Pants - all 5 of them, exactly as we discussed in my previous emails about the color options and material details. Just need you to confirm the availability first, before we move formward."
AI Agent response:
"Subject: Availability Confirmation for CGN2345 Cargo Pants
Dear [Customer's Name],
Thank you so much for reaching out and for your enthusiasm about our CGN2345 Cargo Pants! We truly appreciate your interest and are excited to assist you with your purchase.
I have checked the availability of the CGN2345 Cargo Pants, and currently, we have 2 pairs in stock. Given your interest in purchasing 5 pairs, I recommend securing these 2 pairs today to ensure you get them before we replenish our inventory. We are always striving to restock our popular items as swiftly as possible and can notify you once more become available.
These cargo pants are a fantastic addition to any wardrobe, with their combination of functionality and style. Perfect for spring, summer, and fall, they offer versatility for numerous occasions—whether you're heading on an outdoor adventure, a travel escapade, or simply elevating your casual ensemble.
If you're also looking for other vibrant options, you might be interested in our CRD3210 Corduroy Pants, which are fully stocked and offer a perfect fall and winter look with a retro flair.
Please feel free to reach out if you have any more questions or require further assistance. We're here to help!
Warm regards,
Customer Service Team"
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.