Building Self-Optimizing AI Marketing Agents
Marketing Against the Graingo watch the original →
the gist
Marketing is shifting from manual campaign management to 'marketing engineering,' where AI agents use code, data pipelines, and iterative learning loops to manage ad creative and keyword optimization at scale.
The Shift to Marketing Engineering
Cody Schneider and Kipp Bodnar argue that modern marketing has evolved into a software engineering discipline. Rather than treating AI as a "black box" that magically solves problems, they advocate for building deterministic systems—code-based agents that utilize LLMs for specific inference tasks while relying on traditional software for execution. This approach prioritizes "outcome-ing" over "token-maxing," ensuring that AI is used only where it adds value, such as decision-making loops or data analysis.
The Infrastructure of an Agentic Stack
To move beyond basic automation like Zapier, marketers need a robust engineering stack. This includes a data pipeline, a data warehouse, cloud hosting, media storage, and a git-managed codebase. By treating every ad as a unique SKU (a JSON blob stored in a database), marketers can link performance data directly to specific creative assets. This allows agents to perform "learning loops" where they analyze which creative elements drive outcomes and iterate on them daily, rather than launching massive, static campaigns that get stuck in platform learning phases.
Managing Creative Control and Risk
One of the biggest hurdles for marketing teams is relinquishing creative control. The solution is to codify brand identity into a "taste profile"—a central file containing style guides, emotional triggers, and brand constraints. By implementing human-in-the-loop gates, teams can review agent-generated content while the agent learns from those approvals. This system is particularly effective in regulated industries, where specific language constraints can be hard-coded into the agent’s logic to prevent compliance issues.
Live Deployment and Workflow
In the demo, Schneider demonstrates using Claude Code to build an agent that researches target personas, generates creative via API, and uploads it to Meta. The agent functions as a "quant" trader for ad channels, constantly monitoring performance and adjusting bids or keywords. The process relies on a unified API gateway that abstracts complex toolsets (like SEO research or image generation) into simple, voice-activated commands, effectively turning the developer into an architect of automated marketing systems.
Key Takeaways
- Treat marketing as code: Store every asset as a unique ID in a database to enable granular performance tracking.
- Prioritize iterative loops: Launching 10 ads a day with constant feedback is more effective than dumping 300 ads at once.
- Codify your taste: Create a "taste profile" file that holds your brand's style, constraints, and emotional triggers to guide AI output.
- Use deterministic software first: Only use LLMs for inference; use standard code for data movement and logic to save costs and increase reliability.
- Implement human-in-the-loop gates: Use Slack or similar tools to approve agent-generated content until the system's performance earns your trust.
Notable Quotes
- "Your coding agent is now the smartest marketer, the best marketer in the world if you give it all the context that it needs to do its job." — Cody Schneider
- "All marketing is now code. You should build systems, monitor the systems, find things that work, build the workflow, automate the workflow, audit the workflow, and then improve the system." — Cody Schneider
- "We're anti-token maxing. We're all about outcome-ing. It's just trying to get to the best result, and that's a blend of tokens and a blend of deterministic traditional software." — Cody Schneider
People & Entities
- Cody Schneider: Co-founder of Graphed, marketing engineer.
- Kipp Bodnar: CMO at HubSpot, host of Marketing Against the Grain.
Tools, Products & Workflow
- Claude Code: Used as the primary interface for building and deploying agentic code.
- Graphed: Platform used for managing the marketing engineering stack and API endpoints.
- Data for SEO API: Used for automated keyword research.
- Workflow: (1) Define persona/pain points, (2) Generate creative via API, (3) Upload to ad platform, (4) Measure performance, (5) Feed results back into the agent for the next iteration.
Content References
- Book Loop: Outlearn. Outmarket. Outgrow by Kipp Bodnar and Kieran Flanagan (mentioned).