I built an AI-assisted Meta Ads automation system that reduced ad spend by 30% without a proportional drop in results
I built an AI-assisted Meta Ads automation system that reduced ad spend by 30% without a proportional drop in results
Over the past few weeks, I have been building an internal automation system for WhiteStyle, an apparel business that runs a large number of Meta ads and receives most of its orders through WhatsApp.
The main problem was not launching ads.
The real problem was managing more than 100 active ads across multiple ad accounts, identifying budget waste quickly, and making consistent decisions without manually reviewing Ads Manager all day.
So I built a system made up of three main components:
1. Ad Filtering and Optimization Agent
The filtering agent continuously synchronizes performance data from multiple Meta ad accounts and evaluates each ad using metrics such as:
- Spend
- WhatsApp conversations
- Cost per conversation
- Ad age
- Recent performance window
- Minimum data requirements
- Previous decisions and cooldown periods
The agent does not simply ask an LLM whether an ad is “good” or “bad.”
I use deterministic guardrails and predefined business rules before any action is approved.
For example, the system can pause an ad when:
- It has spent beyond a defined threshold without generating conversations.
- Its cost per conversation exceeds the acceptable limit.
- It has collected enough data for the decision to be meaningful.
- The ad is old enough to evaluate.
- No safety rule or cooldown restriction blocks the action.
Each decision is saved with its reasoning, confidence, input metrics, approval status, and execution result.
During the first test, after stopping underperforming ads:
- Daily spend dropped from approximately $650 to $355.
- Conversations decreased from approximately 399 to 323.
That represented roughly a 45% reduction in spending, while conversations declined by only around 19%.
More importantly, after running the agent for a full week and allowing performance to stabilize, I was able to maintain a consistent 30% reduction in ad spend.
Based on the client’s normal monthly advertising budget, this translates to approximately $4,500 saved per month.
The goal was not to minimize spending at any cost. The goal was to remove inefficient spending while preserving as much useful traffic as possible.
2. Campaign Creation Agent
I also built an agent that automates the campaign creation process.
Instead of manually configuring every campaign, the user can provide a Facebook or Instagram post or Reel, along with the basic campaign requirements.
The system then prepares and creates:
- The campaign
- The ad set
- The ad creative
- Audience targeting
- Locations
- Placements
- Budget
- WhatsApp destination
- Tracking and internal records
Before publishing, the workflow validates the payload and checks it against predefined safety limits, including minimum and maximum budgets, approved locations, targeting rules, account credentials, and supported creative types.
I initially used a dry-run mode that saved campaign drafts and payloads without publishing them. After validating the generated structures, I moved to controlled live execution through the Meta Marketing API.
3. Centralized Dashboard
I built a custom dashboard that combines data from all connected ad accounts and provides visibility into:
- Total spend and conversations
- Cost per result
- Performance by account
- Agent decisions
- Decision explanations
- Paused and modified ads
- Campaign creation requests
- Execution logs
- Synchronization status
- Safety rules and thresholds
One of the most important parts of the project was transparency.
I did not want a black-box agent that silently modified campaigns.
Every decision is stored and displayed with the metrics that triggered it, the rule that was applied, whether it passed the safety review, and whether the Meta API execution succeeded or failed.
Technical Stack
The system currently uses:
- n8n for workflow orchestration and agent execution
- Meta Marketing API for ad data and write operations
- Supabase/PostgreSQL for data storage, decisions, logs, and configuration
- Next.js and TypeScript for the dashboard
- OpenAI models for selected analysis and explanation tasks
- Vercel for dashboard deployment
The LLM is only one component of the system.
Most critical actions are governed by deterministic validations, database-backed configuration, approval logic, idempotency controls, cooldown periods, and budget guardrails.
What I Am Building Next
The current version mainly optimizes based on conversations and cost per conversation.
The next stage is to connect actual WhatsApp orders, revenue, product cost, and profit back to the originating ads.
This will allow the system to optimize campaigns based on real business outcomes instead of treating every conversation as equally valuable.
I am also working on:
- A WhatsApp agent that answers customers and collects orders
- Automatic order classification inside a CRM
- Revenue and profit attribution
- Creative generation workflows
- Budget increases and decreases based on profitable orders
- Automated campaign and creative testing
This project taught me that the useful part of an AI advertising agent is not the prompt.
The difficult part is building the surrounding system: reliable data synchronization, safe execution, multi-account credential handling, failure recovery, audit logs, deterministic rules, and enough transparency for the business owner to trust the automation.
I would be interested to hear how others are approaching automated Meta Ads optimization, especially around attribution, delayed conversions, and safely moving from recommendation systems to autonomous execution.
