This post walks through an AI marketing agent that takes over weekly client reporting for a digital marketing agency with 25 accounts. It is an example of what we could build, not a write-up of a finished client project. This is the exact process I would use to build that system from scratch.
What does it take to build an AI marketing agent?
Building an AI marketing agent takes four layers: deterministic automation that fetches and validates data, code that calculates every metric, an LLM that interprets validated numbers and drafts commentary, and a human who approves the output.
That answer compresses a lot, so let me unpack it with the example.
The example is a multi-client reporting agent. Every week it pulls data from Google Ads, Meta Ads, GA4, and Search Console, normalizes the metrics, compares performance against previous periods and targets, flags anomalies, drafts client-facing commentary, and routes the report to an account manager for approval before anything reaches a client.
The workflow, simplified:
Trigger → Fetch data → Normalize → Validate → Calculate KPIs → Detect changes → Claude drafts commentary → Human review → Deliver report
Notice how late the AI shows up in that chain. That placement is the whole method.
Start by mapping the workflow, not by building the agent
Most tutorials teach agent-first: pick an LLM, give it tools, add memory, build a reasoning loop, deploy. I think that framing is backwards for an agency.
Start with one painful workflow and document what actually happens every Monday morning. For reporting, the manual version usually looks like this: log into each ad platform, export data, pull GA4 conversions, update the spreadsheet, calculate ROAS and CPA and CTR, compare against last week, find the meaningful changes, write commentary, send for review, revise, deliver.
Then classify every step into three buckets:
- Deterministic: software can do this reliably. Fetching data, cleaning it, calculating metrics, comparing periods, validating fields.
- AI reasoning: interpretation is required. Identifying which changes matter, explaining performance, drafting commentary.
- Human: being wrong has real consequences. Approving the final report, adding client context, handling unusual situations.
Run that classification honestly and you'll find most of the workflow lands in the first bucket. Fetching Google Ads data requires no intelligence. Calculating ROAS requires no intelligence. Comparing $84,210 with $79,100 requires no intelligence. Those steps should be plain software.
The agent earns its place at one narrow question: given these verified numbers and this client's goals, what deserves the account manager's attention?
Here is the position I'll plant a flag on. The best AI marketing agent has the least autonomy necessary to remove the most human work. Every decision you hand the model is a decision you now have to test, monitor, and recover from. If code can make a decision reliably, code makes it. If a rule can make it, the rule makes it. The model gets the decisions that genuinely require judgment. This is the core of AI systems engineering, and it's where the durable value sits.
The stack I would use
At Tech Emulsion we use five pieces for this kind of system, each doing one job.
n8n handles orchestration: scheduled runs, API calls to the ad platforms, retries when third-party APIs fail, client-specific workflow configuration, Slack alerts, and triggering the AI step once data is ready. A visual workflow also means the agency team can inspect the system six months later and see exactly where a run stopped.
Custom Python and TypeScript handle every calculation: ROAS, CPA, CTR, CPC, conversion rates, week-over-week and month-over-month changes, aggregation, anomaly detection, and normalization across platforms. My rule is simple. Code establishes the facts. AI interprets the facts.
The Claude API handles reasoning. Claude never sees raw exports. It receives structured, validated metrics like "Current ROAS: 3.94x, previous 4.38x, change -10.0%, spend +18.2%, revenue +6.4%" plus client context, and drafts the analysis. We also expose a few tightly scoped tools, like get_previous_period() and get_client_targets(), so the model can pull context without open access to the system.
Supabase and Postgres store everything people usually call "memory": client configurations, KPI targets, previous reports, account mappings, historical performance. The client's target CPA is a database row. Last month's metrics are database rows. Retrieving exact records beats hoping a model vaguely remembers them.
Railway runs the custom services. It lets us deploy production code, wire it to Postgres, and iterate without managing infrastructure that adds no client value.
Why n8n over LangGraph? Around 70 to 80 percent of this workflow is deterministic, and n8n is excellent at deterministic orchestration. LangGraph earns its complexity when you have long-running reasoning, repeated tool-use loops, or agents delegating to agents. A weekly reporting run needs none of that. The same logic applies to fully hand-coding the pipeline: possible, but then you maintain every scheduler, queue, and retry yourself for no gain.
This architecture pattern travels well beyond agencies. We run variants of it in our AI automation for e-commerce brands. The same skeleton drives internal reporting in our work with SaaS companies.
The step-by-step build plan
Here is an illustrative plan, in the order I'd give any founder. How long each step takes depends on your data and scope.
Step 1: Map the manual workflow
Automate nothing. Sit with whoever builds the reports today and document every step, then sort each step into the deterministic, AI, and human buckets. By the end of this step you want a workflow diagram and one sample report with every input and output defined. That diagram is worth more than any agent code you could write at this stage.
Step 2: Build the smallest working pipeline
Automate one client. One or two data sources, no more. Something like Google Ads → n8n → Python calculations → Claude → report draft. Keep the prompt simple: here are the verified metrics, targets, and previous period; identify the three most important changes and draft client-facing commentary.
Success at this step looks like an account manager saying "this isn't perfect, but it would save me real time." For most agencies, this is the MVP, and this is where you stop and evaluate. No memory, no multi-agent setup, no frontend. If the draft isn't useful, fix the workflow or kill the project before spending more time on it.
Step 3: Make the data trustworthy
Spend this whole step on reliability instead of features. Required-field checks, missing-data detection, API error handling, retries, duplicate-run protection, date-range validation, logging, alerts. The rule to implement: if the data isn't trustworthy, Claude doesn't get to see it. If Google Ads says $21,400 in spend and the existing report says $18,200, stop and find out why. Leave the prompt alone.
Step 4: Add client context and guardrails
Create a per-client configuration in Postgres: primary KPIs, target CPA and ROAS, important campaigns, terminology, data sources, formatting. Load it on every run. This beats one enormous universal prompt trying to cover every client scenario.
Tighten the output structure too. Require the top three performance changes, evidence for each, a possible explanation, a recommended action, and a client-facing summary, with every claim grounded in the provided data. Add the human approval step here. The agent drafts. The account manager approves. Nothing reaches a client automatically.
Step 5: Run it beside the humans
This is the stage everyone wants to skip and the stage that teaches you the most. Keep the existing process running. Let the agent independently produce its own report each cycle, then compare the two. Different numbers, missed anomalies, invented explanations, strange recommendations, missing context. Every disagreement becomes a bug fix, a validation rule, a client configuration, a prompt improvement, or an accepted human-only edge case.
The question changes at this stage. Instead of "did the agent generate a report," you ask "would I trust this report if nobody told me AI created it."
Step 6: Productionize what survived
Expand gradually: 1 client, then 3, then 5, then 10. Add monitoring for failed workflows, unusually low record counts, missing metrics, and reports waiting too long for review. Then measure the only metric that matters: human hours per report. Two hours down to ten minutes of review is a win. An "AI agent" that still needs 1 hour 45 minutes of babysitting is a failure wearing a demo's clothes.
The failure that doesn't look like a failure
Everyone building these systems worries about hallucination, meaning the model invents a number and someone catches it. In production AI systems, that is not the failure mode that scares me most.
The dangerous case is polished output built on bad inputs. When an API returns partial data or an account is mapped incorrectly, Claude can still produce a confident, professional, logically coherent explanation. If spend data comes in incomplete, the model might explain beautifully why ROAS improved. The reasoning is sound. The dataset is wrong. And the report looks exactly as trustworthy as a correct one.
That is why we treat the input dataset as the product. Before Claude generates a word, the pipeline has to confirm the expected date range arrived, all required accounts are present, spend and revenue and conversion fields are populated, the row count looks normal, and every integration completed. If any check fails, the workflow fails closed, alerts a human, and produces no report at all.
The reliability hierarchy I use: validate the data first, validate the calculations second, evaluate the AI reasoning third. Most tutorials spend nearly all their attention on the third layer. I'd tell you the first two matter more, because a good model makes bad data more dangerous by making the result sound convincing.
Expect the ordinary failures too: expired OAuth tokens, changed APIs, disconnected credentials, drifting output style between clients. Retries, alerts, and per-client configuration handle those. Keeping a system healthy after launch is its own discipline, and I've written more about AI ops and ownership as the layer that keeps these systems reliable in production. The philosophy that holds everything together is supervised autonomy. The system does the repetitive work. The human handles the dangerous part: strange data, attribution questions, business context, and judging whether the AI's explanation actually makes sense.
What the economics look like
Here is the math, as an example rather than a client result. At a $30 per hour fully loaded cost, every 10 hours a week you take off a team's reporting load is worth $15,600 a year in capacity.
The bigger value sits past the payroll math. Recovered hours can go back into strategy, optimization, and client communication, which is the work that retains accounts and grows them. Nobody needs to be fired to get there. I've made the longer case on whether AI agents can really replace your marketing team. The goal is a team that stops spending Thursday afternoons copying Meta numbers into spreadsheets. You can see how we apply this across everything we automate for operators.
Run the math on your own workflow before building anything: hours spent today, times the cost of that team's time, times frequency. If that number fails to justify the build, automate a different workflow.
Once a team trusts an agent to observe and interpret, the next level is an agent that acts. An ad ops agent should follow the same progression, starting with controlled permissions to flag wasted spend and recommend budget changes. Reporting agents observe and advise. Ops agents observe, decide, and act. Earn trust with the first before attempting the second.
Frequently asked questions about building AI marketing agents
Can I build an AI marketing agent without coding?
You can get surprisingly far with n8n alone, including scheduling, API calls, and an LLM step. Production reliability usually needs some custom code for KPI calculations, normalization, and validation. A hybrid of visual workflows plus small Python or TypeScript services is the practical middle ground.
How long does it take to build an AI marketing agent?
It depends on scope, and you get a date after scoping. For a production system serving many clients, most of the time goes to validation, per-client configuration, and running the agent in parallel with the human process.
Which LLM should I use for a marketing reporting agent?
We use the Claude API, and Tech Emulsion is an official Anthropic partner, so I'm open about that preference. More important than the model choice is the architecture around it. Any strong model will underperform if you feed it raw exports and ask it to do the math.
Do AI marketing agents hallucinate numbers?
They will if you make them responsible for numbers. Calculate every metric in code, validate the dataset, and hand the model finished figures to interpret. In the way we build these systems, the model never computes a KPI, so a hallucinated metric has no path into a report.
Should the agent send reports directly to clients?
Keep a mandatory human approval step, at least for the first several months. The account manager reviews the draft, adds context, and stays accountable for the recommendation. Clients care about accurate reports and useful insight, and they get a better version of both when review time is spent on judgment instead of data entry.
What should I automate first if reporting isn't my bottleneck?
Pick the workflow that eats the most hours of repetitive, rule-following work each week. The same four-layer pattern applies to lead routing, onboarding checklists, and QA. Software founders tend to start with internal ops for the same reason: high volume, low judgment, easy to verify.
Get a build plan for your agency
If you run an agency and want this system mapped against your own workflows, the fastest path is a short call. We'll walk your reporting process, sort it into the deterministic, AI, and human buckets, and give you an honest read on whether the math justifies the build. Start with how we work with marketing agencies, or book a call directly.




