How to Build an AI Marketing Agent for Paid Media [2026]
Adspirer Team
AI marketing agents are fundamentally different from AI assistants. An assistant answers questions when you ask. An agent wakes up, checks your campaigns, catches problems, remembers what worked last month, and acts on your strategy autonomously. This is Part 1 of a series on building one for paid media — with setup guides for both Claude Code and OpenAI Codex.
Every morning, paid media managers do the same thing. Open Google Ads. Check spend vs. budget. Look at CPAs across campaigns. Open Meta Ads Manager. Check ROAS by ad set. Look at creative frequency. Open LinkedIn. Check lead costs by audience segment. Download data. Build a spreadsheet. Compare to last week. Find the problems. Decide what to change.
This takes 30-60 minutes. And it’s the same analysis, with the same structure, every single day.
Then there’s the weekly work — wasted spend audits, creative fatigue reviews, budget rebalancing. The monthly work — cross-platform performance reports, strategy reviews, audience expansion research. All repeatable. All structured. All following patterns that an experienced media buyer has internalized over years.
What if you could build a system that knows those patterns? Not just an AI you ask questions — but an agent that runs those analyses autonomously, remembers your brand’s context, persists strategic decisions across sessions, and only interrupts you when something needs a human judgment call?
That’s what an AI marketing agent is. And in 2026, you can build one.
This is Part 1 — choose your tool for Parts 2 & 3:
Claude Code CLI path:
- Part 2: How to Set Up Your AI Marketing Agent with Claude Code
- Part 3: How to Run Facebook & Instagram Ads with Your Claude Code AI Agent
OpenAI Codex path:
AI Assistants vs. AI Agents: What’s the Difference?
This distinction matters because it changes what you can expect from the system you build.
AI Assistants (ChatGPT, Claude)
When you use ChatGPT for Meta Ads or Claude for Meta Ads, you’re using an AI assistant. You start a conversation, ask a question, get an answer. You might say “show me my campaign performance” and get a table of metrics. You might say “create a campaign” and walk through the creation workflow.
This is powerful. It’s faster than clicking through dashboards. But it’s fundamentally reactive — the AI does nothing until you show up and ask.
Close the conversation, and the AI forgets everything. Open a new one tomorrow morning, and you start from scratch — re-explaining your brand, your targets, your strategy. Every session is a blank slate.
AI Agents (Codex, OpenClaw)
An AI agent flips this model. Instead of waiting for you, the agent operates autonomously. You define a task — “check my ad performance every morning and alert me if CPA spikes more than 30%” — and the agent runs it on a schedule. No human in the loop.
But the real difference isn’t just automation. It’s persistence. An agent maintains context across sessions:
- Brand knowledge — It knows your business, your audience, your brand voice, your competitors. This lives in a context file (Codex calls it
AGENTS.md) that persists across every conversation. - Strategic memory — When you analyze your competitive landscape and decide “don’t bid on broad match competitor terms — too expensive,” that decision gets saved to a strategy file (
STRATEGY.md). Every future campaign the agent creates follows that directive. - Specialized skills — The agent doesn’t guess which tools to use. It has proven workflows for each task type — campaign creation, performance review, wasted spend detection, ad copy writing. Each workflow enforces the right sequence: research before creating, validate before launching, confirm before spending.
- Safety rules — The agent can’t spend your money without permission. All campaigns launch paused. Budget changes require confirmation. Direct API calls to ad platforms are blocked, forcing everything through an authenticated pipeline.
AI Assistant
You ask → it answers. Each conversation starts fresh. No memory, no scheduling, no autonomy. Great for ad-hoc analysis and one-off tasks.
AI Agent
You define goals → it executes. Maintains brand context, remembers strategy, runs on schedule, catches problems autonomously. Great for ongoing campaign management.
The Advertising Brain: What You’re Actually Building
When you build an AI marketing agent, you’re not just connecting an AI to your ad accounts. You’re building what I think of as an advertising brain — a persistent system that accumulates knowledge about your brand’s advertising over time.
The Knowledge Layer
Every time the agent analyzes your campaigns, it learns something. Over weeks and months, this knowledge compounds:
- What keywords convert — Not just which keywords you bid on, but which ones actually drive revenue. The agent saves high-performing keywords to your strategy file with their CPCs, conversion rates, and match types.
- What creatives fatigue fastest — Some ad formats and visual styles wear out after 10 days. Others hold for 30+. The agent tracks these patterns and starts recommending creative rotation timelines specific to your account.
- Which audiences perform — For your business specifically, not based on industry averages. “Women 25-34 interested in sustainable fashion convert at 3x the rate of the broad audience” — that’s a finding the agent saves and uses in every future campaign.
- What copy works — Headline styles, CTA phrases, value propositions that consistently outperform. The agent builds a library of your brand’s proven messaging patterns.
- How to allocate budget — After seeing months of cross-platform data, the agent knows that your Google Search campaigns have 4x ROAS while your LinkedIn campaigns have 1.5x — and recommends budget shifts accordingly.
The Strategy Layer
Knowledge alone isn’t enough. The agent also persists strategic decisions that constrain its behavior:
### Google AdsAVOID: broad match "marketing software" — dominated by HubSpot/Salesforce, $15+ CPCPREFER: exact match "[specific feature] + software" — lower competition, $4-6 CPCNEVER: bid on competitor brand terms — company policy
### Meta AdsROTATE: creatives after frequency exceeds 2.5 (based on Q1 data)TEST: video-first for cold audiences, carousel for retargetingBUDGET: minimum $25/day per ad set to exit learning phase in < 5 days
### LinkedIn AdsTARGET: Director+ titles at companies with 200-2000 employeesAVOID: "Marketing" job function — too broad, low conversion ratePREFER: lead gen forms over landing pages — 3x completion rateThis strategy file is the agent’s playbook. Every campaign it creates, every recommendation it makes, every analysis it runs — all filtered through these directives. When a new team member joins, they don’t need to learn your advertising strategy from scratch. The agent already knows it.
The Execution Layer
On top of knowledge and strategy, the agent has skills — specialized workflows for each type of advertising task:
| Skill | What It Does | When It Runs |
|---|---|---|
| Performance Review | Cross-platform performance scorecard vs. KPI targets | Daily (scheduled) |
| Wasted Spend Detection | Finds spend with zero conversions, recommends fixes | Weekly (scheduled) |
| Ad Copy Generation | Writes brand-voice copy using proven patterns from your data | On demand |
| Campaign Management | Full campaign creation with research → validate → launch workflow | On demand |
| Brand Setup | Bootstraps the entire brand workspace from your docs and ad data | First-time setup |
The skills ensure the agent follows proven workflows instead of guessing. “Create a Meta campaign” doesn’t mean “call the campaign creation API and hope for the best.” It means: check connection → research audience → choose format → validate creative → create paused → verify structure. Every time, in the right order.
For a deeper look at how skills work, see the agent skills documentation.
Why Codex for Building Marketing Agents?
You could use any AI tool with MCP support to connect to your ad accounts. ChatGPT, Claude, Claude Code, Cursor, OpenClaw — they all work with Adspirer. So why build your marketing agent specifically with Codex?
Agent-First Architecture
Codex was designed for autonomous operation. While ChatGPT and Claude are conversation-first tools that can use tools, Codex is an agent-first tool that happens to support conversation. The difference shows up in three ways:
1. Agent config files. Codex uses .toml config files to define agent behavior — default prompts, tool permissions, scheduling parameters. You define the agent once and it runs repeatedly without re-prompting.
2. Safety rules at the system level. Codex uses .rules files that block dangerous operations before they reach the AI. The advertising safety rules block direct curl calls to ad platform APIs, ensuring everything goes through Adspirer’s authenticated pipeline. This is a deeper safety layer than skill-level instructions.
3. AGENTS.md for persistent context. While Claude Code uses CLAUDE.md and Cursor uses BRAND.md, Codex’s AGENTS.md serves the same purpose — a persistent context file that survives across sessions. The agent reads it at the start of every task, so it always knows your brand, your targets, and your strategy.
Autonomous Scheduling
This is the killer feature for paid media. You define a task and schedule it:
- Daily at 8am: “Pull yesterday’s performance across all platforms. Compare to 7-day average. Alert me if anything is off.”
- Every Monday: “Audit wasted spend across Google Ads. Find keywords spending without converting. Total up potential monthly savings.”
- Monthly on the 1st: “Generate a cross-platform performance report. Compare to previous month. Recommend budget reallocation.”
The agent runs these without you opening any tool. You wake up to a performance summary. You start your Monday with a wasted spend report. Your monthly review is already done before the meeting.
The 5 Skills System
Codex ships with 5 specialized advertising skills through Adspirer’s plugin — more than any other platform:
Campaign Management
Full lifecycle: research → validate → create → monitor. All 4 platforms, 100+ tools.
Performance Review
Cross-platform scorecard. Compares to KPI targets. Flags strategy drift.
Wasted Spend
Finds money leaks: zero-conversion keywords, dying creatives, poor audiences.
Ad Copy Writer
Brand-voice copy from real data. Uses proven patterns from your account.
Brand Setup
Bootstraps everything: scans docs, pulls data, creates AGENTS.md and STRATEGY.md.
Each skill is a proven workflow — not just tool access, but the right sequence of tools for each task. Learn more about each skill in the skill reference.
How It Compares
| Feature | ChatGPT / Claude | Claude Code / Cursor | Codex |
|---|---|---|---|
| Connect to ad accounts | Yes | Yes | Yes |
| Persistent brand context | No (per-session) | Yes (CLAUDE.md / BRAND.md) | Yes (AGENTS.md) |
| Strategy memory | No | Yes (STRATEGY.md) | Yes (STRATEGY.md) |
| Specialized skills | 1 (manual upload) | 1-5 (via plugin) | 5 (via plugin) |
| Autonomous scheduling | No | No | Yes |
| Safety rules (.rules) | No | No | Yes |
| Agent config files | No | No | Yes (.toml) |
| Direct API blocking | No | No | Yes |
Claude Code and Cursor are excellent for interactive advertising work — they’re the best tools for ad-hoc analysis and one-off campaign creation. But for building an autonomous marketing agent that runs on its own, Codex’s architecture is purpose-built.
Why Claude Code for Interactive Marketing Agents?
Claude Code takes a different approach. Instead of autonomous scheduling, it gives you sub-agents — specialized AI instances that spawn in their own context window with persistent memory. The marketing agent runs in isolation, does the heavy lifting, and returns a clean summary to your main conversation.
Three capabilities set Claude Code apart:
1. Persistent memory across sessions. Claude Code maintains MEMORY.md — a decision log that tracks campaign results, optimization outcomes, and strategic findings. After a few weeks, the agent knows your account’s patterns better than any dashboard. Codex doesn’t have cross-session memory.
2. Web research during workflows. The sub-agent has access to WebSearch and WebFetch, so it can crawl competitor landing pages, research industry benchmarks, and gather market intelligence as part of the same workflow that analyzes your ad data. Context and research happen together, not in separate tools.
3. Interactive drill-downs. When the agent flags an anomaly, you can immediately dig deeper — “Why is that campaign declining? Pull the keyword-level data.” The sub-agent continues the investigation without losing context. Scheduled Codex reports run, return, and stop.
Not sure which tool is right for you? If you want an assistant you talk to, use ChatGPT or Claude. If you want an interactive agent with persistent memory and web research, use Claude Code. If you want an autonomous agent that runs on a schedule, use Codex. They all connect to the same Adspirer MCP server with the same 100+ tools.
What the Agent Looks Like in Practice
Let’s make this concrete. Here’s what a day looks like with a fully configured paid media agent:
8:00 AM — Automated Performance Check
The agent runs its daily performance review. You haven’t opened any tool — this runs on schedule.
📊 Daily Performance Summary — March 30, 2026
Google Ads (2 active campaigns) Spend: $142.30 | Conversions: 8 | CPA: $17.79 | ROAS: 3.2x ✅ All metrics within targets
Meta Ads (3 active campaigns) Spend: $89.50 | Conversions: 12 | CPA: $7.46 | ROAS: 4.1x ⚠️ ALERT: "Spring Collection - Carousel" CTR dropped 35% vs first week → Frequency: 3.8 (above 2.5 threshold from STRATEGY.md) → Recommendation: Refresh creative or pause this ad
LinkedIn Ads (1 active campaign) Spend: $48.20 | Leads: 3 | CPL: $16.07 ✅ Within target (< $20 CPL)
Top action: Refresh Meta carousel creative (estimated $15-20/day being wasted on fatigued ad)9:15 AM — You Respond
You open Codex and say: “Pause that fatigued Meta carousel and create a replacement with the new product photos I uploaded to Google Drive.”
The agent already knows your brand voice, your target audience, your budget constraints, and your creative strategy (all from AGENTS.md and STRATEGY.md). It doesn’t ask you to re-explain any of this. It validates the new creative, creates the replacement ad set, launches it paused, and asks for your approval.
Monday Morning — Automated Wasted Spend Audit
💸 Weekly Wasted Spend Report — Week of March 24
Google Ads: 3 keywords spending with zero conversions (last 7 days): - "free marketing software" — $34.50 spent, 12 clicks, 0 conversions → Recommendation: Add as negative keyword - "marketing tools comparison" — $28.20 spent, 8 clicks, 0 conversions → Recommendation: Lower bid to $2 (currently $5.40) - "cheap crm" — $15.80 spent, 5 clicks, 0 conversions → Recommendation: Add as negative keyword (irrelevant to product)
Estimated monthly savings: $314
Meta Ads: 1 ad set with declining performance: - "Broad Interest - Fashion" — CPA increased 45% over 14 days → Recommendation: Narrow targeting or pause
Total estimated monthly savings: $380+You review, approve the negative keywords with one command, and the agent handles the rest.
The Compounding Effect
The most powerful aspect of an AI marketing agent isn’t any single capability — it’s how knowledge compounds over time.
In month one, the agent knows nothing. It creates campaigns based on your instructions and industry best practices. The strategy file is empty.
By month three, the strategy file has 20+ directives based on real data: which keywords to avoid, which audiences convert, which creative formats fatigue fastest, which budget allocations work. Every campaign the agent creates is informed by three months of accumulated learning.
By month six, the agent is effectively a junior media buyer who’s been trained specifically on your brand. New team members can onboard by reading AGENTS.md and STRATEGY.md — the agent’s knowledge base is your institutional advertising knowledge, documented and actionable.
This is what we mean by “advertising brain.” Not artificial general intelligence. Not magic. Just a system that remembers what works, follows your strategy, and does the repetitive analysis that eats up your mornings.
Getting Started
If this resonates, here’s how to move forward:
Already using Adspirer with ChatGPT or Claude? Your account works across all platforms. Same MCP server, same ad account connections. You can add Codex for autonomous workflows while keeping ChatGPT or Claude for interactive work. See all supported integrations.
Related Articles
- How to Set Up Your AI Marketing Agent with Claude Code — Claude Code setup (sub-agents, memory, web research)
- How to Set Up Your AI Marketing Agent with Codex — Codex setup (autonomous scheduling, .rules files)
- How to Run Facebook & Instagram Ads with ChatGPT — The assistant approach to Meta Ads
- How to Run Facebook & Instagram Ads with Claude AI — Claude’s deep reasoning for Meta Ads
- Adspirer Is Now an Official Claude Code Plugin — Plugin marketplace announcement
- Claude vs ChatGPT for Ad Management — Side-by-side comparison
- What Is MCP (Model Context Protocol)? — The protocol that makes all of this possible
More articles to read
How to Set Up Your AI Marketing Agent with Codex [2026]
Step-by-step guide to installing OpenAI Codex, connecting ad platforms, creating your brand workspace, and running your first autonomous ad performance check.
How to Set Up Your AI Marketing Agent with Claude Code [2026]
Install the Adspirer plugin, create your brand workspace, configure sub-agents, and run your first ad performance check — all from the Claude Code CLI.