Back to learnings
LearningSeptember 22, 202613 min read

The marketing agent architecture I'd actually build in 2026

Most 'marketing agents' you see online are Zapier workflows with a fresh coat of paint. A real one is code in the cloud, wired to a data warehouse, making decisions off live business data with a feedback loop. Here's the architecture I'd actually build, plus the gotchas that get most people's Facebook Ads accounts banned.

Every marketing team I've talked to in the last quarter is either building a "marketing agent" or shopping for one. Almost all of them are being sold a Zapier workflow with a fresh coat of paint. That is not what a real marketing agent is, and if you deploy one thinking it is, you'll spend three months wondering why your Facebook Ads account got banned and your revenue didn't move.

Here's the architecture I'd actually build if I were setting up a marketing agent from scratch today. Six sections on the shape of the system, plus one on where I'd deploy it first.

What a marketing agent actually is (and isn't)

Most of what gets sold as a "marketing agent" is a Zapier automation with a language model tucked into one of the steps. A webhook fires, a prompt runs, an email goes out. It's linear. It doesn't reason about live data. It runs the same play every time it's triggered.

That isn't an agent.

An agent isn't an AGI either. You don't want a system that "thinks its way through your marketing plan" or improvises campaign strategy. You want something narrower and more reliable: code in the cloud, hosted anywhere, reading live business data on some cadence, making decisions inside a tight scope, and updating your marketing channels based on those decisions.

The mental model that keeps me out of trouble: a marketing agent is a virtual employee whose entire job is one channel and one outcome. Facebook Ads for new-customer acquisition. Google Ads for competitive intent. LinkedIn outbound for the top 500 accounts. Each agent has one job, one data view, one output surface.

The mistake people make is trying to build a single agent that runs the whole marketing stack. That produces something that's mediocre at every channel and gets stuck the moment any one channel throws a novel signal. One channel per agent is the pattern that scales.

Three requirements: unified data, autonomous action, feedback loop

A real marketing agent has three properties. Miss any one and you don't have an agent. You have a script.

1. Unified data. The agent has a single source of truth for every metric that affects its decisions. This is the property most "agents" fail on. If your agent is reading Facebook Ads results from Facebook, Analytics from Google, and lead status from HubSpot as three separate calls glued together in a Zapier step, it can't reason across them. It sees each channel in isolation.

2. Autonomous action. The agent can push changes to your marketing channels without a human clicking approve. If a human is in the middle of every loop, you don't have an agent. You have an assistant with a review queue.

3. Feedback loop. Results from the agent's actions flow back into the same data source it reads from. So when it makes a decision on Tuesday and the outcome lands on Friday, that outcome is visible to the agent's next decision cycle. Without this, the agent runs the same play forever and can't learn.

The three requirements for a real marketing agent: unified data (one source of truth across every channel), autonomous action (push changes without human review), and a feedback loop (outcomes flow back into the same source the agent reads from). Miss any one and you have a script or an assistant, not an agent.

If your "agent" is missing any of these, name it honestly. Missing unified data: it's a bot. Missing autonomous action: it's a dashboard. Missing feedback loop: it's a scheduled script. All useful. None are agents.

The data layer: pipeline + warehouse

Every real marketing agent starts with a data warehouse. There is no shortcut around this and there is no version where you skip it. If you don't have a warehouse, you don't have the substrate an agent needs to reason on.

The stack I'd stand up if I were doing this today, all open source and self-hostable:

  • Airbyte as the data pipeline. Pre-built connectors for every marketing data source you care about. You run it on Railway or Heroku or your own boxes. It syncs your channels into the warehouse on a schedule.
  • ClickHouse as the warehouse. Fast, columnar, absurdly cheap per query, handles the scale of a marketing agent trivially.

The sources you probably want piped in on day one:

  • Facebook Ads (creative, spend, delivery, results)
  • Google Analytics or PostHog (site behavior)
  • Your CRM (HubSpot, Salesforce, whatever)
  • Stripe or your billing system (real revenue attribution)
  • Google Search Console (organic signal)

The warehouse is what lets your agent ask questions your marketing dashboards can't answer. Facebook Ads Manager can tell you which ad had the best in-platform ROAS. It can't tell you which ad drove the most closed-won revenue over the last 90 days. The warehouse can, because it has the pipeline data and the CRM data and the billing data all sitting in the same store.

The full marketing agent architecture as a loop: five data sources (Facebook Ads, Google Analytics, CRM, Stripe, PostHog) flow through the Airbyte pipeline into a ClickHouse warehouse; the agent reads unified data from the warehouse, writes new ad creative to Facebook via the Marketing API, and Facebook's results flow back through the pipeline into the warehouse for the next cycle.

The reason I'm being specific about tools is that most "just wire it up" advice glosses over the piece that actually takes the longest and matters most. If you don't get the warehouse right, nothing downstream matters.

Facebook Ads as the case study, and why Andromeda made it the best B2B channel

The reason I'd stand up my first agent on Facebook Ads specifically is that Andromeda changed the economics of the platform in a way most marketers still haven't internalized.

Andromeda is Facebook's ad-serving algorithm rewrite that landed over the last 18 months. The mental model to understand:

Old model. You picked interests, custom audiences, lookalikes. Facebook served your ad to people matching that audience definition. The ad itself was almost secondary. What mattered was who you targeted.

New model. Facebook reads your creative directly: the video transcript, the on-screen text, the image content, the landing page you send people to. Then Andromeda figures out who the ad is talking to and finds them itself. Your targeting is your copy.

The Andromeda targeting flip. Old model: you picked interests and Meta served ads to that audience; targeting was defined at the ad-set level. New model: you write creative that describes a pain point or outcome, and Andromeda reads the video transcript, on-screen text, image content, and landing page, then finds the right audience itself. Targeting is now the creative.

This has two consequences most people underweight.

First, interest targeting basically stopped mattering. Broad targeting plus specific creative outperforms narrow targeting plus generic creative on almost every account I've audited in the last six months.

Second, Facebook became the best B2B ad channel that exists. The old wisdom of "Facebook is B2C, LinkedIn is B2B" is now the wrong instinct. Because Andromeda reads creative and finds people who match its description, you can write an ad that only makes sense to a Postgres DBA at a Series B startup and Facebook will find the eight of them in the country. LinkedIn's targeting can't get that specific.

The practical implication for your marketing agent: its most valuable output is variations of creative that describe the pain point and the outcome in the voice of the specific buyer. The audience-finding is Facebook's job now. Your job is to produce dozens of tightly-written creatives per week and let Andromeda sort them.

Publishing agent + the Facebook API "write-only" rule

Once the ideation agent has produced creative, the publishing agent pushes it into Facebook and manages the ongoing campaign. Concrete cadence I'd run:

  • Two new ad sets per day, five ads per ad set. Ten new ads live daily.
  • Each ad runs 2-3 days for initial signal
  • Bottom performers get killed automatically after that window
  • Winning ads advance to a "winners pool" that competes for future budget
  • Every publish action gets logged with the exact JSON prompt used, so you build a corpus of what worked

The publishing agent decision loop: agent publishes 10 ads per day (2 ad sets × 5 ads), each runs for a 2-3 day observation window, bottom performers get killed, winners advance to a winners pool that competes for future budget, and every action gets logged with the prompt used to build a corpus of what worked.

Now the gotcha that got most of the "my agent banned my Facebook account" stories you've seen on X into trouble. The Facebook Marketing API is for writes only. Never use it to read.

Every time I've seen an account get banned for agent activity, it wasn't the agent that caused the ban. It was someone using the Marketing API to pull performance data at scale. Facebook's rate limits on read operations are strict, and the platform interprets high-volume reads as scraping. Once you cross the threshold, the account gets flagged and often gone.

The correct pattern:

  • Writes go through the Marketing API. Publish ads, turn ads off, promote budget between ad sets. These are low-volume, transactional operations Facebook is happy with.
  • Reads come from your warehouse. Airbyte syncs Facebook Ads performance data on Facebook's terms (their own connector, their own rate limits, their own polite cadence). Your agent reads that synced data out of ClickHouse.

If you follow this rule, the agent can operate at arbitrary scale on the write side and the account stays healthy indefinitely. Break the rule and you'll be starting a new Business Manager in three weeks.

The entropy problem (agents get stuck writing the same ad every day)

Every marketing agent I've watched run for more than a month develops entropy. Symptom: the agent's creative starts looking suspiciously similar week over week. Same hooks, same angles, same visual style, slightly worse performance each cycle.

The cause is model entropy. The LLM in the ideation loop finds a local optimum in prompt space and stops exploring. It saw that "problem then solution" hooks worked in week two, so it makes 47 variations of "problem then solution" hooks in week five. The audience saw the first eight and stopped responding.

The fix is to inject fresh DNA into the agent's context on a schedule. Two sources I'd wire in:

Facebook Ads Library as a competitor signal. The Ads Library is a public, searchable index of every ad currently running on Facebook. Once a week, the agent pulls the top-running ads in your category and adjacent categories, extracts the copy and creative structure, and feeds that as reference material to the ideation prompt. This does two things: shows the agent what's working outside its own bubble, and gives it new angles to remix rather than variations of its own past output.

Long-form transcripts as a voice signal. Pull YouTube videos and podcasts from creators in your category. Extract the specific pain points, contrarian claims, and phrasing they use. Feed that into the ideation prompt as "here's how the audience actually talks about this problem." Your agent's copy starts sounding like the audience's own words, which is exactly what Andromeda rewards.

The entropy problem and the DNA-injection fix. The agent's creativity decays over time as it converges on a local optimum in prompt space. Weekly refresh injects two DNA sources into the ideation context: top competitor ads from the Facebook Ads Library, and pain points plus phrasing extracted from long-form YouTube and podcast transcripts. Fresh DNA breaks the loop and keeps performance from decaying.

There's a third fix that's more subtle but higher payoff over time: store every JSON prompt and every ad script alongside the performance data. Feed the winners back to the ideation agent as "these are the ones that worked." Over a few months you're not just injecting external DNA, you're training the agent on its own best output. That corpus becomes the single most valuable asset the agent produces.

Where I'd deploy this first (my angle)

If I were an operator with limited engineering time and wanted the fastest path from zero to a real marketing agent running production traffic, here's the sequence I'd run:

Pick one channel and one outcome. Facebook Ads and new-customer acquisition. Not brand, not remarketing, not "engagement." A single outcome the warehouse can measure end to end.

Stand up the data layer before you touch the agent. Airbyte plus ClickHouse plus the five source connectors above. If you skip this and try to shortcut with a Zapier workflow, you'll rebuild the whole thing in six weeks.

Build the ideation agent as a thin wrapper first. Prompt template that takes recent winners and current pain-point research and outputs 10 new ad concepts as JSON. Deploy it on a schedule with Claude Code and one file of prompts. Do not over-engineer this. The value is in the prompts and the DNA sources you feed it, not the framework.

Wire in the publishing agent last. Once ideation is producing ads a human would ship, connect the publishing layer to the Marketing API for writes only. Read from the warehouse.

Team shape that runs this well is three people if you have them: one owning ideation prompts and brand context, one owning the publishing agent and API integration, one owning the warehouse and attribution logic. Solo operator can absolutely do it too, on Claude Code deployed to Railway, over three or four focused weekends.

The moment marketing runs from a Git repo instead of a series of dashboards, everything else about how you work changes. That's the real shift. If you want to see the wider stack I run around this pattern, the current AI stack lives here. More posts in this shape live in Writing.