Duck
Tutorials8 min read

A Practical Guide to Building AI Agents for Marketing That Actually Work

Samet Turan— Editor··8 min read

Stop guessing. Learn the step-by-step process for building AI agents for marketing that generate leads and content without constant hand-holding. This guide covers the stack, the prompts, and what bre

What Most Guides on AI Agents for Marketing Get Wrong

Most of the advice out there on ai agents for marketing is theoretical junk. It’s written by people who’ve never shipped a production automation. They talk about fully autonomous agents that will run your entire marketing department while you sip mai tais. That’s a fantasy. It’s not how this works.

Real operators don’t build one god-like agent. We build small, stupid, single-purpose bots that do one thing reliably. Think of them less as a new employee and more as a very powerful macro. A bot that finds new businesses. A bot that drafts personalized email intros. A bot that categorizes support tickets. Each one is a simple, chained automation.

They are not truly autonomous.

The second thing these guides miss is the most critical part: the data. An AI agent is just a language model attached to a workflow. If you feed it garbage from a poorly scraped website or a messy CRM, it will give you articulate, confident-sounding garbage in return. The input quality determines everything.

The Operator’s Stack: Tools You Actually Need

You don’t need a complex, custom-coded AI agent framework. You need three things: a brain, a body, and senses. Here’s the stack I use to build these systems.

🤖
Recommended Reading

AI Side Hustles

12 Ways to Earn with AI

Practical setups for building real income streams with AI tools. No coding needed. 12 tested models with real numbers.


Get the Guide → $14

★★★★★ (89)

  • The Brain (LLM API): This is the language model that does the “thinking.” Your choice is basically between OpenAI‘s GPT models and Anthropic‘s Claude models. For most marketing tasks, I’m finding myself using Claude’s latest, Sonnet 3.5, more and more. It’s incredibly fast and its writing has a less robotic feel than GPT-4o, which is great for drafting copy. GPT-4o is still my go-to for tasks that require strict JSON output or complex logical reasoning. API costs for both are negligible when you’re starting out—a few dollars a month can run thousands of tasks.
  • The Body (Orchestrator): This is the no-code platform that connects the steps. It’s the workflow engine. The two serious contenders here are Make (formerly Integromat) and n8n. Make is beautiful and intuitive; you can build a workflow in minutes just by dragging and dropping modules. But their pricing is based on “operations,” and a single agent run can consume hundreds of them. Honestly, their $29/mo Core plan is a trap for any real automation; you’ll hit the limit fast. My personal preference is n8n. It’s more powerful, the logic is clearer for complex workflows, and you can self-host it for pennies. The learning curve is steeper, but you won’t get a surprise bill for a workflow that runs away from you.
  • The Senses (Data Input): This is how your agent gets information about the outside world. Usually, this means a web scraper. Don’t try to build this yourself. You’ll get IP-banned. Use a service built for this, like ScrapingBee. For a reasonable monthly fee (their $49/mo plan is plenty for a solo operator), you get access to a massive pool of rotating proxies and a headless browser that can handle modern JavaScript-heavy websites. My biggest gripe with scraping in general is how often sites change their layout, breaking your scraper. You need to build your agent with that failure point in mind.

Blueprint: Building a “New Business” Lead Research Agent

Let’s make this concrete. Here’s a simple but valuable agent you can build in an afternoon. The goal: find newly registered local businesses, research them, and prep the data for a cold outreach campaign.

We’ll build this in Make.com for simplicity, but the logic is the same in n8n.

  1. The Trigger: Schedule. The workflow starts once a day. Simple. It’s just a “Schedule” module set to run at 8 AM.
  2. The Search: Find a Source. This is the hardest part. You need a source for new businesses. This could be a government business registration portal, a local chamber of commerce website, or an industry directory. Let’s say we find a local directory that lists new plumbers in Austin, TX. We’ll use its URL.
  3. The Scrape: Get the Data. We send that directory URL to the ScrapingBee module. ScrapingBee visits the page and returns the raw HTML. We then use Make’s HTML parser to extract the links to each individual plumber’s website.
  4. The “Thinking” Chain: LLM Calls. Now we loop through each plumber’s website URL. For each one, we perform a series of chained calls to the Claude API. Don’t do this in one giant prompt. It’s unreliable. Break it down.

Chain Link 1: Data Extraction

First, we pass the scraped text from the plumber’s site to the LLM with a clear, structured prompt. I love this part—it feels like magic when it works.

You are an expert data extraction assistant. Your task is to pull specific information from the provided website text. Extract the following fields: business_name, contact_person (if listed, otherwise null), email, phone_number, and a one_sentence_summary of their primary service (e.g., 'Specializes in residential drain cleaning.').

Respond ONLY with a valid JSON object. Do not add any commentary.

Website Text: [Insert scraped text here]

Chain Link 2: Qualification

The data from the first step might be for a supplier or a commercial-only plumber. We need to filter. So, we take the JSON output from the first step and feed it to a second, simpler LLM call.

Based on the following data, is this business a residential plumbing service? Answer only with the single word 'YES' or 'NO'.

Data: [Insert JSON from step 1 here]

Chain Link 3: Personalization

If the answer is ‘YES’, we proceed. Now we write the part that saves our sales team hours: the personalized opening line for a cold email. This is where Claude’s Sonnet 3.5 shines.

You are an expert cold email copywriter. Using the provided data, write a single, compelling opening line for an email. The line must mention a specific service from their website summary. It should be casual and under 20 words.

Data: [Insert JSON from step 1 here]

The result is something like: “Saw on your site you handle emergency water heater repairs in Austin.” That’s infinitely better than “Hope you’re having a great week.”

  1. The Output: Save to a System. Finally, we take the clean JSON data and the personalized line and save it as a new row in a Google Sheet or as a new item in Airtable. This becomes the task list for a human salesperson.

How Do You Handle Hallucinations and Bad Data?

Your agent will eventually fail. The LLM will misunderstand the context, the scraper will pull garbage data, or the website will be in a foreign language. Expect it. Plan for it. Here’s how you make your system more resilient.

  • Aggressive Validation: Don’t trust the LLM’s output. After the extraction step, use a Router module in Make.com to check if the `email` field is properly formatted and if the `phone_number` field isn’t empty. If the data is bad, don’t continue the workflow for that lead. Just drop it or flag it for manual review.
  • Few-Shot Prompting: If you’re getting inconsistent JSON, edit your prompt to include examples. This is called few-shot prompting. Just add a section that says: `Here are two examples of correct output:` followed by perfect JSON objects. This anchors the model’s response and dramatically improves reliability. It’s the single best trick for getting structured data from an LLM.
  • Human in the Loop: This is the most important rule for any `operator playbook`. The goal of this agent isn’t to automatically email 1,000 people. It’s to produce a high-quality list of 20 leads for a human to review and then use. The final output should always be a spreadsheet or a task in a project management tool, not a direct connection to your email sending service. The human is the final quality gate.

What Breaks at Scale?

Building a demo that processes one URL is easy. Building a system that processes 500 URLs every day is hard. Here’s what will bite you as you scale up your use of ai agents for marketing.

First, you’ll hit API rate limits. OpenAI and Anthropic don’t let you make infinite requests per minute. Your workflow will start throwing errors. The default error handling in Make.com is, frankly, terrible. It will just stop the scenario. You have to manually build in a “repeater” with an incremental delay (exponential backoff) to handle this, which is a huge pain. It’s one of the main reasons I prefer n8n for production systems, as it has better built-in retry logic.

Second, your scrapers will fail more often. Websites will identify your scraper’s IP block and start serving CAPTCHAs or just blocking you outright. This is why paying for a service like ScrapingBee is non-negotiable. Their whole business is managing that cat-and-mouse game so you don’t have to.

Finally, you’ll have state management problems. If your workflow fails on lead #342 out of 500, how do you restart it without re-processing the first 341? A simple Google Sheet can’t handle this. You’ll need to move your output to a more serious database like Airtable or even a real SQL database, where you can set a `status` field for each lead (`processed`, `failed`, `pending`) to manage the state of your pipeline properly.

Building these systems takes work. It’s a process of constant refinement and debugging. But a well-built agent can be a massive force multiplier for a small team, handling the repetitive research and prep work that no one wants to do.

Adjacent reading: deeper coverage of AI agent platforms.

If you’d rather skip the build and deploy a working version in an afternoon, we’ve packaged this entire workflow as a pre-built ai automation blueprint. You can find it in the Vault at deepusecase.com/vault/ai-agent-builder-kit.

— The Colophon

One AI tool. Tested. Reviewed.
In your inbox every Sunday.

~3 minute read. Real outcomes from operators, not marketers.

Free. One email per Sunday. Unsubscribe in one click.