Duck
Tutorials5 min read

How to Build AI Agents That Actually Work for Your Business

Samet Turan— Editor··5 min read

Learn to build AI agents step‑by‑step, see real prompts and costs, and decide whether to DIY or grab the ready‑made blueprint at deepusecase.com for free today.

Many solopreneurs waste weeks trying to build ai agents that hallucinate, forget context, or rack up insane API bills.

After reading this guide you’ll have a working agent that qualifies leads, writes follow‑up emails, and logs every interaction in a Google Sheet.

You’ll also know exactly when it’s smarter to install a pre‑built blueprint instead of starting from scratch.

What most guides get wrong about building AI agents

Most tutorials start with a vague prompt like “act as a helpful assistant” and then jump straight to API calls.

They skip the part where you define the agent’s narrow job.

Without a clear scope the model tries to be everything and ends up doing nothing well.

I’ve seen guides that tell you to “just add more context” without explaining how to trim it, which blows up token usage.

The real fix is to write a tight system message that states the goal, the allowed tools, and the stop condition.

For a lead‑qualifier that goal could be: “You are a sales assistant that decides if a lead matches our ideal customer profile and returns a JSON with fields score and reason.”

Everything else — tone, formatting, fallback — goes in the user message.

When you keep the system message short the model stays focused and token cost drops.

How do you keep an agent from forgetting context after a few turns?

Short‑term memory is the biggest leak in many DIY agents.

If you feed the whole chat history back each call you’ll hit the token limit fast.

If you drop history entirely the agent loses the thread.

The trick is a sliding window that keeps the last N exchanges and discards older ones.

In practice I set N to three user‑assistant pairs.

That gives the model enough to remember the last question and answer while staying under 800 tokens for most prompts.

You implement this by trimming the messages array before each API call.

Here’s a tiny snippet that shows the idea:


function prepareMessages(history, newUserMsg) {
const window = 3; // keep last 3 turns
const recent = history.slice(-window * 2); // each turn = user + assistant
return [...recent, { role: "user", content: newUserMsg }];
}

Notice how we never send the full log — only the slice we need.

This simple pattern stops the agent from going mute after a handful of exchanges.

A concrete named example: building a lead‑qualification agent with Make and OpenAI

Let’s walk through a real scenario you can copy today.

We’ll use Make (formerly Integromat) as the workflow engine and OpenAI’s gpt‑4o model for reasoning.

The agent will:

  • Receive a new lead webhook from a Facebook Lead Ad.
  • Ask the model to score the lead from 0‑100 based on industry, company size, and job title.
  • If the score is above 70, send a personalized follow‑up email via Gmail.
  • Log the lead ID, score, and timestamp to a Google Sheet.

First, create a scenario in Make with a Webhook trigger.

Add an HTTP module that calls the OpenAI Chat Completions endpoint.

Use this system message (remember to keep it short):


You are a sales assistant that scores a lead from 0‑100. Return only JSON with fields "score" (number) and "reason" (string).

The user message contains the lead details in plain text:


Lead: {name}
Company: {company}
Industry: {industry}
Title: {title}

Set temperature to 0.2 for deterministic output.

Make will receive the JSON, parse it, and route to a Router.

If score > 70, go to the Email module; otherwise go straight to the Google Sheet logger.

For the email, use a simple template:


Hi {name},
I saw you work at {company} as a {title}. We help firms in {industry} automate outreach. Can we chat Thursday?

Now let’s talk cost.

Assuming 500 leads per month, each lead needs one OpenAI call (about 800 tokens total).

At $0.03 per 1k tokens for gpt‑4o that’s $0.024 per call.

500 × $0.024 = $12 per month for the model.

Make’s free tier gives you 1,000 operations, which covers the webhook, HTTP, Router, Email, and Sheet modules for this volume.

So the whole thing runs under $15/mo if you already have a Gmail and Google Workspace account.

If you need more than 1,000 operations, Make’s Core plan starts at $29/mo and gives you 10,000 operations — still cheap for this use case.

How to debug when this breaks

First, check the Make scenario log for the exact HTTP status from OpenAI.

A 429 means you hit the rate limit; pause the scenario for a minute and retry.

A 400 with “max_tokens exceeded” usually means the prompt grew too long — check that you’re not accidentally sending the full lead list instead of a single record.

If the JSON parser fails, look at the raw model output.

Sometimes the model adds extra text like “Here is the result:” before the JSON.

Fix that by tightening the system message: “Return only JSON. No extra explanation.”

When emails aren’t sending, verify the Gmail module’s connection status; a common hiccup is an expired refresh token.

Re‑authorize the module and the issue clears.

Finally, if the Google Sheet shows blank rows, make sure you’re mapping the correct fields from the Router output.

A quick test is to add a Text aggregator before the Sheet module and watch what it outputs.

Pricing opinion and when to buy the blueprint

I think $29/mo for Make’s Core plan is fair when you’re running a handful of automations like this.

The free tier is enough for solo work if you stay under 1,000 operations a month.

If you start hitting that limit, the jump to $29 feels reasonable — you get ten times the capacity for less than the cost of a single coffee a day.

On the other hand, I’ve seen vendors charge $199/mo for a “no‑code AI agent builder” that just wraps the same OpenAPI calls you can make yourself.

Honestly, that price is ridiculous for what you get.

You’re paying for a pretty UI, not for any magic.

We cover this in more depth elsewhere — 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 workflow as a blueprint 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.