Duck
AI Tools5 min read

Creating an AI Agent

Samet Turan— Editor··5 min read

Learn how to build a working AI agent from scratch with real prompts, tool examples, and debugging tips, then decide if the blueprint saves you time.

Creating an AI Agent

You’ve seen the hype around AI agents but you’re stuck trying to turn a prompt into something that actually runs. After reading this you’ll be able to sketch an agent, wire it to a no‑code platform, and spot the common failure points before they waste your time.

What most guides get wrong

Many tutorials start with a vague idea like “build an agent that helps with sales” and then jump straight to code. They skip the step where you define the exact input, the exact output, and the exact decision points. Without that clarity the agent will hallucinate, loop, or return useless text. I’ve seen teams waste weeks because they never wrote down the trigger condition.

A guide that jumps to prompting without a data map is setting you up for rework. The first thing you should do is list the fields you need in and out, then decide which tool will move the data between steps.

Why does the agent hallucinate when given vague prompts?

Hallucination happens when the model tries to fill gaps that you didn’t close with concrete instructions. If you tell it “summarize the lead” without saying what format, length, or tone you want, it will guess. The guess often sounds plausible but is wrong.

Fix this by giving the model a strict template. For example, you can ask for a JSON object with fixed keys: name, email, company, pain_point. Then you tell the model to output only that JSON and nothing else. Any extra text means the prompt wasn’t tight enough.

Here’s a real prompt I use in my lead enrichment agent:

Extract the following fields from the LinkedIn snippet below and return ONLY a valid JSON object with these keys: full_name, email, company, title, pain_point. If a field is not present, set its value to null. Do not add any explanation.

When I first tried a looser version the model would add a friendly intro like “Sure! Here is the summary:”. That broke the downstream parser because it expected pure JSON.

Concrete example: building a lead enrichment agent with the Make platform

I’ll walk through a working scenario I run every morning. The agent takes a new Google Sheet row with a LinkedIn URL, pulls the public profile text via a simple scraper, feeds it to OpenAI, and writes the enriched data back to the sheet.

First, I mention **Make.com** because it’s the visual workflow tool I rely on. In Make.com you create a scenario, add modules, and connect them with drag‑and‑drop lines.

The steps are:

  • Watch for new rows in a Google Sheet (trigger).
  • Call a simple HTTP GET to a scraper API that returns the raw LinkedIn text.
  • Pass that text to the OpenAI module with the prompt shown above.
  • Parse the JSON response (Make.com has a JSON parser module).
  • Update the original sheet row with the parsed fields.

Here’s what the OpenAI module looks like in the scenario editor (the prompt is pasted into the “User message” field):

Extract the following fields from the LinkedIn snippet below and return ONLY a valid JSON object with these keys: full_name, email, company, title, pain_point. If a field is not present, set its value to null. Do not add any explanation.

The scraper I use is a free endpoint from Apify that returns the public profile text for a given LinkedIn URL. It costs nothing for under 100 calls a day, which fits my solo use.

Cost breakdown: Make.com’s Core plan is $29/mo and gives you 10,000 operations. My scenario uses about 4 operations per lead (trigger, HTTP GET, OpenAI call, sheet update). At 50 leads a day I’m well under the limit, so $29/mo is fair for the automation I get. If you need more than 10k ops you’ll jump to the next tier at $79/mo, which feels steep unless you’re scaling to hundreds of leads daily.

I love the visual scenario builder because I can see each step’s output instantly. When something goes wrong I can click a module and view the raw data that flowed into it. That transparency cuts debugging time in half.

My gripe is that Make.com hides the full error log behind the paid plan. On the free tier you only get a generic “error occurred” message, which, yes, is annoying. You have to upgrade to see the exact HTTP status or the OpenAI error code, making early‑stage testing a guessing game.

That’s the trade‑off: you get a friendly UI and reliable hosting, but you pay for deeper insight when things break.

How to debug when this breaks

When the agent stops writing data to the sheet, start at the end and work backward. First, check the Google Sheet module’s output bundle in Make.com’s execution history. If it shows “no changes made”, look at the previous module — the JSON parser.

If the parser reports “invalid JSON”, open the OpenAI module’s output. You’ll often see the model added a preamble like “Here is the result:”. That means your prompt wasn’t strict enough. Go back to the prompt, add the “ONLY a valid JSON object” line, and rerun.

If the OpenAI module returns an error like “rate limit exceeded”, you’ve hit the API tier. In my case I stay under the free tier by limiting calls to 20 per minute; you can add a delay module between the scraper and OpenAI to throttle.

Sometimes the scraper returns empty text because the LinkedIn URL is blocked or requires login. In that case add a filter after the HTTP GET: if the response length is less than 100 characters, route the row to a “skip” path and log a note. That prevents the OpenAI call from running on garbage input.

Keep a small test sheet with three known‑good URLs. Run the scenario on those each time you tweak a prompt or add a module. If the test passes you know the core logic is still sound.

One‑sentence paragraph: That’s the feedback loop that keeps the agent reliable.

For more on this exact angle, 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.