Running an agency means juggling pitches, client reports, and endless follow‑ups. You want an AI agent that can pull leads, score them, and draft a first email without you babysitting every step.
After you finish this guide you’ll be able to spin up a working agent, spot the usual failure points, and decide whether to assemble it yourself or grab a pre‑built blueprint.
Why do AI agents keep stalling after the first few steps?
Most tutorials show you a nice flowchart: scrape → summarize → email. In practice the agent stops after the scrape because the next step expects a JSON blob that the scraper never returns.
The real bottleneck isn’t the AI model; it’s the data contract between each node. If the output of step A doesn’t match the input schema of step B, the whole chain halts and you get a vague timeout error.
I’ve seen teams waste days tweaking prompts when the fix was simply adding a validation wrapper that converts raw HTML into the expected structure.
One‑sentence truth: the agent is only as strong as its weakest data hand‑off.
What most guides get wrong
They treat the AI model as a magic black box and ignore the plumbing. Guides will tell you to “just give the model a prompt and let it work.” That advice works for a single‑shot chat but falls apart when you need chained actions.
Prompt Engineering for Profit
50 tested prompt templates for content, copywriting, and automation. Copy, paste, earn.
Get the Templates → $17
They also skip error handling. A demo might run fine on a clean dataset, but real‑world leads come with missing phone numbers, weird characters, or empty fields. Without fallback logic the agent crashes and you have to restart manually.
Finally, many examples hard‑code API keys into the script. That’s a security nightmare and makes the agent impossible to share or deploy across environments.
Building a simple lead‑qualification agent: tools, prompts, cost
Let’s walk through a concrete stack I use for a solo agency that needs to qualify inbound form submissions.
Tool list
- Apify (for scraping the form‑confirmation page) – $49/mo for the basic plan
- OpenAI GPT‑4o (for summarizing and scoring) – $0.06 per 1k tokens
- Make.com (to glue the steps together) – $9/mo for the core plan
- Google Sheets (as a lightweight CRM) – free with a Google account
The workflow looks like this:
- Apify runs a scraper that pulls the raw HTML of the thank‑you page after a lead submits the form.
- The scraper outputs a JSON field called “raw_html”.
- Make.com takes that field, strips tags, and passes the clean text to a GPT‑4o prompt.
- Prompt: “You are a senior sales analyst. Given the following lead description, output a JSON object with two keys: score (0‑100) and reason (one sentence). Description: {clean_text}”
- The model returns JSON, which Make.com writes to a Google Sheet row alongside timestamp and source.
- If the score is ≥ 70, a second Make scenario sends a templated cold email via SendGrid.
Here’s the exact prompt I store in Make as a variable (note the triple braces for escaping):
{"model": "gpt-4o", "messages": [{"role": "system", "content": "You are a senior sales analyst."}, {"role": "user", "content": "Given the following lead description, output a JSON object with two keys: score (0-100) and reason (one sentence). Description: {clean_text}"}], "temperature": 0.2, "max_tokens": 150}
Cost per lead: Apify call ~ $0.005, GPT‑4o ~ $0.004 (≈70 tokens), Make operation ~ $0.001. Roughly $0.01 per qualified lead, which lets me process thousands for under $15/mo.
What I love about this stack is the visibility: each step logs its input and output, so I can see exactly where a lead dropped out.
My gripe? Apify’s free tier only gives you 1000 scraper runs a month, and the UI hides the usage meter behind three clicks—annoying when you’re trying to stay under budget.
