Most people try to make ai agents by chaining a few API calls and hoping for the best. They end up with bots that hallucinate, miss data, or die silently when a webhook times out. After you finish this guide you’ll be able to sketch an agent, pick the right moving parts, and run a test that actually proves it works.
How do you keep an agent from hallucinating when it pulls live data?
Hallucination happens when the model fills gaps with plausible‑sounding nonsense. The fix is not more prompting; it’s grounding the model in a verifiable source before it generates anything. I use a two‑step pattern: first fetch the raw data, then feed only those facts into the LLM with a strict “answer only from the provided context” instruction.
Here’s the exact prompt I paste into Claude 3 after a GET request returns a JSON payload:
You are a precise assistant. Use ONLY the facts in the block below to answer the question. If the answer is not there, say “I don’t know”. Do not add any external knowledge.{{payload}}
The double curly braces are replaced by the scraped JSON before the call. This forces the model to stay honest.
One‑sentence paragraph: I’ve seen agents cut false claims by 80% just by adding that line.
What most guides get wrong about agent memory
Many tutorials tell you to slap a vector store onto every agent and call it “memory”. That works for chat bots but fails for task agents that need short‑term state, not semantic search. If you store every message in Pinecone you’ll pay for useless similarity searches and add latency.
Instead I keep a tiny JSON blob in a Redis list that holds the last five turns. Each turn is a simple object with role and content. When the agent needs context it reads the list, merges it into the prompt, and discards anything older. This costs pennies a month and stays under 100 ms.
What most guides miss is that you must version the schema. If you later add a new field, old blobs break the parser. I solve it by storing a version number and running a migration script on startup—something I wish I’d known earlier.
Concrete example: building a lead‑qualification agent with the Make platform and Claude
Let’s walk through a real agent I run for a freelance outreach business. It scrapes a LinkedIn search URL, extracts names and titles, then asks Claude whether each person fits a target persona.
- Make.com scenario starts with a Webhook trigger that receives a search URL from a Google Sheet.
- Next module: HTTP GET request to
https://nubela.co/proxycurl.com/v2/linkedinwith the URL and my API key (cost $0.005 per call). - The response is a large JSON; I use a Text parser to pull
first_name,last_name,headlineinto a temporary array. - For each item I send a Claude request via the Anthropic module. The prompt is the grounded version shown earlier, plus the question “Does this person likely need a freelance automation consultant? Answer yes or no.”
- Claude returns “yes” or “no”. I filter the array to only the “yes” entries.
- Finally I push the filtered list back to the Google Sheet via the Make.com Google Sheets module.
Cost breakdown: Proxycurl $0.005 per LinkedIn call, Claude $0.008 per 1k tokens (my prompt+response averages 600 tokens → $0.005), Make.com operations are free on the starter plan. Per lead I spend about $0.01. At 200 leads a week that’s $2—practically nothing.
Concrete gripe: the Proxycurl API sometimes returns a 502 error when LinkedIn throttles, and Make.com does not retry by default. I lost a whole batch of leads until I added a simple “Retry on 5xx” module with three attempts and a 2‑second delay.
Concrete love: I love how the grounded prompt eliminates the need for post‑processing regex to catch “yes” or “no”. Claude follows the instruction exactly, so the output is always clean and ready for the filter step.
Mild aside: (If you’ve tried Zapier automations, you know the frustration of missing webhook logs—Make.com gives you full execution history for free.)
