All articles
Guide 14 min read

How to Run Facebook & Instagram Ads with Your Codex AI Agent [2026]

A

Adspirer Team

Share Y
How to Run Facebook & Instagram Ads with Your Codex AI Agent [2026]
Summary

This is Part 3 of the AI marketing agent series. Your Codex agent is installed and your brand workspace is created. Now we build a Meta Ads specialist — teaching the agent your creative strategy, your audience insights, and your campaign patterns so it can monitor Facebook and Instagram ads autonomously and help you launch new campaigns grounded in what’s already working.

In Part 1, we covered why AI marketing agents are different from assistants. In Part 2, we installed Codex, connected your ad accounts, and created the brand workspace. Now comes the interesting part: making the agent genuinely useful for Meta Ads specifically.

A general-purpose agent connected to your ad accounts can pull performance data and create campaigns. But a Meta Ads specialist agent understands your creative strategy, knows which audiences convert for your business, monitors creative fatigue autonomously, and generates campaign ideas based on patterns it’s learned from your data.

The difference is knowledge. And knowledge comes from using the agent deliberately — feeding it findings, confirming discoveries, and building up STRATEGY.md with Meta-specific directives over time.

Info

This is Part 3 of a 3-part series.

Try it free →


Teaching Your Agent About Meta Ads

Your agent’s AGENTS.md already has a performance snapshot from setup. But a snapshot isn’t expertise. Expertise comes from understanding why certain campaigns perform — which creative formats work for your audience, which targeting combinations convert, which placements deliver the best CPA.

Let’s build that understanding.

Step 1: Deep Performance Analysis

Start by asking the agent to go beyond surface metrics and find the patterns:

Meta Ads Deep Analysis

Analyze my Meta Ads account for the last 60 days. I want to understand the deeper patterns, not just the headline metrics. Show me:

  1. Which ad formats perform best for me? (single image vs video vs carousel)
  2. Which placements consistently deliver the lowest CPA? (Feed, Stories, Reels, Explore)
  3. Which audience demographics convert best? (age, gender breakdowns)
  4. Which interest-based audiences have the highest ROAS?
  5. What’s my average creative lifespan before CTR declines by 20%?
  6. What’s my effective frequency threshold — at what frequency does CPA start increasing?

For each finding, tell me whether the pattern is strong (consistent across campaigns) or weak (only 1-2 campaigns show it).

This analysis uses Adspirer’s get_meta_campaign_performance, analyze_meta_ad_performance, analyze_meta_audiences, and detect_meta_creative_fatigue tools — all running through the same MCP connection. See the full Meta Ads tool reference for what’s available.

Step 2: Save the Findings to STRATEGY.md

When the agent presents its findings, you’ll see patterns emerge. Maybe video ads have 40% lower CPA than static images. Maybe women 25-34 convert at 3x the rate of other demographics. Maybe your creatives fatigue after 12 days on average.

These findings need to be saved so the agent remembers them across sessions:

Save Meta Strategy

Based on this analysis, save the following to STRATEGY.md under a ”### Meta Ads” section:

For each finding that’s strong (consistent across campaigns), create a directive. For example:

  • PREFER: video ads over static images for cold audiences (40% lower CPA)
  • TARGET: women 25-34 as primary demographic (3x conversion rate)
  • ROTATE: creatives after 12 days (average fatigue point based on CTR analysis)
  • PLACEMENT: prioritize Feed and Reels over Stories (Feed: $8 CPA, Reels: $10, Stories: $15)

Only save directives with strong evidence. Skip anything based on one campaign.

Now every future session — every campaign creation, every performance review, every ad copy generation — is filtered through these directives. The agent doesn’t need to re-analyze to know that video works better for you. It’s in the strategy file.


Autonomous Creative Fatigue Monitoring

Creative fatigue is the biggest silent budget killer in Meta Ads. Ads lose effectiveness gradually — CTR drops 2-3% per day, CPA creeps up — and by the time you notice in Ads Manager, you’ve overspent on tired creative for a week or more.

This is the perfect use case for an autonomous agent. It monitors continuously, catches fatigue early, and alerts you before the damage compounds.

Configure the Monitor

Add a Meta-specific autonomous workflow to your agent. Create or edit your agent config:

[agent.meta_creative_monitor]
schedule = "0 8 * * *" # Every day at 8am
prompt = """
Check my Meta Ads for creative fatigue. For each active ad:
1. Compare this week's CTR to the first week's CTR
2. Check if frequency exceeds the threshold in STRATEGY.md
3. Check if CPA has increased more than 25% vs first-week baseline
For any fatigued ads:
- Show current metrics vs first-week metrics
- Calculate how much I'm overspending per day (current CPA - first-week CPA × daily conversions)
- Recommend: refresh creative, pause and replace, or rotate to a new variation
Save any new fatigue patterns to STRATEGY.md (e.g., "carousel ads fatigue faster than video for this brand").
"""

What the Agent Catches

A typical alert looks like this:

⚠️ Creative Fatigue Alert — March 30, 2026
2 ads showing fatigue:
1. "Spring Collection - Carousel" (Campaign: Retargeting)
First week: CTR 3.2%, CPA $7.50, Frequency 1.4
This week: CTR 1.8%, CPA $12.30, Frequency 3.8
Decline: CTR -44%, CPA +64%
Daily overspend: ~$14.40 (based on 3 conversions/day)
→ RECOMMEND: Pause and replace. Carousel has run 21 days.
2. "Product Demo - Video" (Campaign: Prospecting)
First week: CTR 2.8%, CPA $9.20, Frequency 1.2
This week: CTR 2.1%, CPA $11.50, Frequency 2.6
Decline: CTR -25%, CPA +25%
Daily overspend: ~$6.90
→ RECOMMEND: Refresh creative (same script, new visuals).
Video still performing above average — hasn't fully fatigued.
📝 New pattern saved to STRATEGY.md:
"Carousel ads fatigue after ~14 days for retargeting audiences (3 data points).
Video ads last ~21 days for cold prospecting (2 data points)."

Notice the last part — the agent saves new patterns to STRATEGY.md. Over time, your fatigue thresholds become brand-specific, not generic industry averages.


Building a Campaign Ideation Pipeline

Great campaign ideas don’t come from nowhere. They come from understanding what’s already working and finding new angles to expand on it. Your agent has all the data to do this analysis — it just needs the right prompts.

Mine Winners for Expansion

Campaign Expansion from Winners

Look at my top 5 performing Meta ad sets from the last 30 days. For each one:

  1. What targeting is driving the results? (demographics, interests, behaviors)
  2. What creative format and messaging is working? (format, headline themes, CTA style)
  3. What placements deliver the best results?

Then suggest 3 new campaign concepts that build on these winners:

  • A new audience angle (similar interests I’m not targeting yet)
  • A new creative angle (same audience, different message or format)
  • A scaling play (expand geography or broaden a narrow audience)

Check STRATEGY.md before suggesting — don’t recommend anything that contradicts an existing directive.

Research New Audiences

Before launching a new campaign, the agent can search Meta’s targeting taxonomy for audiences that match your ideal customer:

Audience Discovery

Search Meta’s targeting options for audiences related to [your niche]. I want to find:

  • Interest categories I’m not currently targeting
  • Behavioral signals that indicate purchase intent
  • Lookalike-friendly audiences (high engagement, clear interest match)

Cross-reference against my existing campaigns — show me which audiences I’m already reaching and which are new opportunities.

Rank the new audiences by estimated relevance to my product and suggest which ones to test first.

This uses Adspirer’s search_meta_targeting and browse_meta_targeting tools to search Meta’s actual targeting options — not generic advice. For the full list of targeting tools, see the Meta Ads documentation.

Cross-Platform Audience Intelligence

If you’re running Google Ads alongside Meta, your search term data is a goldmine for Meta campaign ideas. Keywords people search for tell you exactly what they want — and that intent maps directly to Meta targeting:

Google-to-Meta Intelligence

Pull my Google Ads search term report for the last 30 days. Find my highest-converting search terms.

Now search Meta’s targeting options for audiences that match the intent behind those search terms. For example:

  • If “organic skincare for sensitive skin” converts well on Google, find Meta audiences interested in organic beauty, sensitive skin care, clean beauty
  • If “project management for remote teams” converts, find Meta audiences interested in remote work, team collaboration, productivity tools

Map my Google Ads winners to Meta targeting opportunities. This is demand I know exists — I just need to reach the same people on Meta.

This cross-platform intelligence is something no single ad platform can provide. Your agent sees all your data across all platforms through Adspirer’s unified MCP connection. See the platform comparison guide for more on cross-platform capabilities.


Campaign Creation with Brand Context

When your agent creates a Meta campaign, it’s not starting from zero. It reads AGENTS.md (brand voice, audiences, guidelines), checks STRATEGY.md (what works, what to avoid), and follows the 6-step workflow enforced by the Ad Campaign Management skill.

The Informed Creation Flow

Meta Campaign from Data

Create a new Meta image campaign based on what’s working:

  1. Check STRATEGY.md for my best-performing targeting and creative insights
  2. Use my brand voice from AGENTS.md for the ad copy
  3. Target the audience demographic that converts best (from our analysis)
  4. Use the placement mix that gives the lowest CPA
  5. Budget: $30/day
  6. Creative URL: [your image URL]
  7. Objective: Website conversions

Write primary text and headline variations that match my proven messaging patterns. Launch as paused for my review.

Notice the difference from a generic “create a Meta campaign” prompt. The agent uses your accumulated knowledge — brand voice, winning audiences, proven placements, messaging patterns — all automatically because it’s in AGENTS.md and STRATEGY.md.

Creative Requirements

Your campaign will fail validation if the creative doesn’t meet Meta’s specifications:

FormatMinimum SizeFile TypesMax SizeAspect Ratios
Image1080x1080pxJPG, PNG30MB1:1 or 4:5
Video1080x1080pxMP4, MOV4GB1:1, 4:5, or 9:16
Carousel1080x1080px per cardJPG, PNG30MB/card1:1
Creative URLs Must Be Public

Adspirer can’t access private links. Use publicly accessible URLs from Google Drive (set to “Anyone with the link”), Dropbox, S3, or any direct URL. The agent validates dimensions, format, and accessibility before attempting to create the campaign.


Instagram-Specific Workflows

Instagram ads are managed through the same Meta Ads system — when you connect Meta Ads, you get Instagram automatically. The difference is in placement strategy:

  • Feed (1:1 or 4:5): Best for product images, carousels, considered purchases
  • Stories (9:16): Best for limited-time offers, flash sales, urgent CTAs
  • Reels (9:16): Best for brand awareness and discovery — content that feels native outperforms obvious ads dramatically
  • Explore: Best for cold audience prospecting — reaching people outside your followers
Instagram Placement Analysis

Analyze my Instagram-specific performance for the last 30 days. Break down by placement:

  • Instagram Feed: CPA, CTR, ROAS, frequency
  • Instagram Stories: same metrics
  • Instagram Reels: same metrics
  • Instagram Explore: same metrics (if applicable)

Which placements should I scale? Which should I reduce? Update STRATEGY.md with the findings.


Building Brand Voice for Ad Copy

One of the most powerful aspects of the agent system is brand-consistent ad copy generation. Instead of writing copy from scratch every time, the agent learns what messaging works for your brand.

Establish Your Copy Patterns

Copy Pattern Analysis

Analyze the ad copy across my top-performing Meta ads from the last 60 days. Find patterns:

  1. What headline structures work best? (question, benefit, urgency, social proof)
  2. What primary text length performs best? (short vs long-form)
  3. What CTAs drive the highest conversion rate?
  4. What value propositions resonate? (price, quality, convenience, exclusivity)
  5. Are there specific words or phrases that appear in my best-performing ads?

Save the patterns to STRATEGY.md under ”### Meta Ad Copy Guidelines” so the ad copy writer skill uses them.

Once saved, every future ad copy generation follows these patterns:

Brand-Voice Ad Copy

Write Meta ad copy for my [new product/campaign]. Use the copy guidelines from STRATEGY.md:

  • Follow the headline structure that works best for my brand
  • Use the primary text length that performs best
  • Include the value propositions that resonate with my audience
  • Match my brand voice from AGENTS.md

Generate 5 primary text variations and 5 headline variations. Show me which pattern each one follows.

This uses the $adspirer-write-ad-copy skill, which reads your brand context and strategy before generating anything. See the skill reference for details.


The Full Autonomous Cycle

Here’s what a fully configured Meta Ads agent cycle looks like once all the pieces are in place:

Daily: Creative Fatigue Monitor (8am)

Agent checks all active Meta ads for CTR decline, frequency spikes, and CPA increases. Alerts you with specific recommendations. Saves new fatigue patterns to STRATEGY.md.

Weekly: Performance Scorecard (Monday 9am)

Agent runs $adspirer-performance-review for Meta Ads. Compares against KPI targets in AGENTS.md. Identifies strategy drift vs. STRATEGY.md directives. Gives you a prioritized action list.

Bi-Weekly: Wasted Spend Audit (1st and 15th)

Agent runs $adspirer-wasted-spend for Meta Ads. Finds ad sets spending without converting, audiences with declining ROI, placements underperforming. Estimates monthly savings.

Monthly: Strategy Review and Refresh (1st of month)

Agent re-runs the deep analysis from Step 1 of this guide. Compares month-over-month trends. Updates STRATEGY.md with new findings. Refreshes AGENTS.md performance snapshot. Recommends budget reallocation.

On Demand: Campaign Creation

When you’re ready to launch something new, the agent creates campaigns informed by everything it’s learned — audiences that convert, creative formats that last, copy patterns that perform, budget levels that work.


The Compounding Effect: Month 1 vs Month 6

Month 1

  • STRATEGY.md is mostly empty
  • The agent creates campaigns based on your instructions and general best practices
  • Creative fatigue detection uses industry-standard thresholds (frequency > 3, CTR decline > 20%)
  • Campaign suggestions are generic — “test these interest audiences”

Month 3

  • STRATEGY.md has 15-20 directives based on real data
  • The agent knows that video ads last 21 days for your brand while carousels fatigue at 14
  • Audience targeting uses proven demographics (women 25-34 at 3x conversion rate)
  • Copy generation follows your brand’s proven headline structures and CTA patterns
  • Budget allocation is informed by 3 months of cross-platform ROI data

Month 6

  • STRATEGY.md is a comprehensive playbook — 40+ directives covering targeting, creative, copy, budget, and placement strategy
  • The agent is effectively a junior media buyer trained specifically on your brand
  • New team members can read AGENTS.md and STRATEGY.md to understand your entire advertising strategy in 10 minutes
  • Campaign creation quality is significantly higher because every decision is informed by 6 months of accumulated learning
  • Fatigue thresholds, audience preferences, and copy patterns are all brand-specific, not generic

This is the advertising brain we described in Part 1. Not artificial general intelligence. A system that remembers what works, follows your strategy, catches problems early, and compounds knowledge over time.


FAQ

Can the agent create Meta campaigns without my approval?

No. All campaigns are created PAUSED by default. The agent analyzes, recommends, and builds — but you approve before anything goes live. This is enforced by Adspirer’s safety rules. See the capabilities documentation.

What if I also run Google Ads and LinkedIn?

The same agent handles all platforms. The setup, performance review, and wasted spend skills work across Google Ads, Meta Ads, LinkedIn Ads, and TikTok Ads. You can build channel-specific STRATEGY.md sections for each platform. See the platform comparison.

Does the agent generate images or videos?

No. Adspirer manages campaigns, not creative production. You provide creative URLs from Google Drive, Dropbox, S3, or any public URL. For AI-generated creatives, use Midjourney, DALL-E, or Runway first.

How many tool calls does this use?

A daily creative fatigue check uses 2-3 tool calls. A weekly performance review uses 3-5. Campaign creation uses 4-6. On the Pro plan (600 calls/month, $99/mo), you can run daily monitoring plus weekly reviews plus 10-15 campaign operations per month. See pricing →

Can I use Claude Code or Cursor instead of Codex?

For interactive work — yes. Claude Code and Cursor support the same skills, STRATEGY.md, and brand context. But they don’t support autonomous scheduling. For the autonomous monitoring workflows (daily fatigue checks, weekly audits), you need Codex. Many users use Claude Code for ad-hoc work and Codex for scheduled automation.

What if I'm starting from scratch with no campaign history?

The agent still works — it just has less to learn from. Start with the setup, run your first campaigns manually or through the agent, and let STRATEGY.md build up naturally. After 2-3 weeks of campaign data, the deep analysis becomes meaningful.


Conclusion

Building a Meta Ads specialist agent isn’t a one-time setup — it’s an ongoing process of teaching the agent what works for your brand. The setup takes 10 minutes. The value compounds over months.

Start with the deep performance analysis to understand your current patterns. Save the strong findings to STRATEGY.md. Configure autonomous creative fatigue monitoring. Use the campaign ideation pipeline to turn data into new campaign ideas. And let the agent build your brand’s advertising knowledge base over time.

The agents that perform best aren’t the ones with the most sophisticated prompts. They’re the ones with the most accumulated knowledge — months of strategic decisions, creative patterns, audience insights, and performance benchmarks, all saved in files that persist across every session.

Info

Ready to build your Meta Ads agent? Start with Part 1 if you haven’t read it yet, then Part 2 for installation. Adspirer is free to start with 15 tool calls/month.

Get started free →


AI Agents Meta Ads Automation MCP

More articles to read