Case study: building a cold outreach agent that only states facts it can prove
A case study of a researched cold-email agent that keeps a fact only when a fetched page quote backs it. 10/10 drafts verified; $0.08–$0.14 per lead.
I'm Moiz Ali. This is a case study of the cold outreach agent. You give it a company website and a person's role. It researches the company, drafts a short email, and keeps a fact only when a quote from a page fetched on that run backs it. Code — not the model — decides what stays in the email. A person still approves a real send.
You can run the same pipeline, stopping before send, in the live demo. The public demo runs on the Gemini free tier and does not send.
The problem
Sales reps know a researched email beats a template, but researching by hand is slow, so most teams send templates. Asking a model to personalise a note is fast, but it invents facts. One made-up funding round in a cold email costs the sender their credibility.
I wanted the speed of a model with the honesty of a person who actually read the page. The project is my own product, built for B2B sales teams. I designed, built and evaluated it over two weeks. The stack is Claude, Python, FastAPI, Postgres and Redis. It is still building.
The approach
The pipeline is a plain Python state machine, not a hidden graph inside a framework. It has six steps: a lead is submitted, code checks fit, a model researches the company, a model drafts the email, code proves every claim, and a person approves and sends.
Cheap checks run first. A poor-fit lead is rejected for about $0.0013, before any research is paid for. If the lead is a fit, only the research step loops on its own. That step has three tools, and none of them can send, write or delete. Fetched pages are wrapped as untrusted data, so a page cannot be treated as instructions.
The research loop is hand-written on the Anthropic SDK, with no framework, so cost, retries and turn limits stay visible. After the research, the system drafts a short email around a pain point, under 120 words. Unsupported claims go back. A person approves every email before it goes out. An opt-out in a reply is caught by plain code, even if the model is down. An email is claimed in one conditional UPDATE before sending, so it goes out at most once.
The public demo runs this same pipeline and stops before send. Code still rejects a claim it cannot source. A person would approve a real email before it went out. The research loop in the full system is written against the Anthropic SDK. The public live demo runs on the Gemini free tier. The rule does not change with the model: a claim still has to be proved, in code.
How verification works
Code makes the final call. A fact is kept only if its URL was fetched in this run and its quote appears in the page text. The verifier maps every claim in the email to a fact, and code decides pass or fail.
I learned not to let a model grade this. I once used an LLM judge. It said the drafts were 92% faithful. Reading the facts myself said about 75%. Changing only the judge moved the same 24 facts from 0.92 to 0.67. The score was following the method, not the truth of the emails. I rebuilt it so the model has to name a quote for each detail, and code derives the verdict from that. The model proposes a source. Code checks whether that source was actually fetched, and whether the quote is really on the page.
That is the same instinct I wrote about in what an AI agent engineer actually does: the prompt is the small part of the work. The check has to run in ordinary code, and a failed check has to refuse the claim.
Results
The results were measured over 10 real leads:
- 10/10 drafts passed the claim verifier.
- Cost per researched lead was $0.08 at the low end and $0.14 at the high end.
- It took 34–78 seconds from lead to draft.
- A poor-fit lead is rejected for about $0.0013, before research is paid for.
Those are the numbers I will stand behind. The sample is still small. How real sales people rate the emails, and reply rates, are not measured yet. I am not going to fill that gap with a guess.
Things also broke on the way, which is part of what the system is now. 240 tests passed, and the API could not start, because the tests injected their own dependencies and never ran real startup. A smoke test now boots the real server, worker, Postgres and Redis. A rate limit let 5 of 6 requests through, because "check, then create" is two steps. A Postgres advisory lock makes it exactly one of six.
What I'd do next
The next work is already written down on the case study, and I have not done it yet. I want one real email through the provider, a measurement of the reply classifier, a review screen, and a fit signal such as "do they already use a competitor?". Until those exist, the honest status is that the agent can research, draft and prove claims, and that a person still stands in front of send.
Try it, or get in touch
The live demo runs the research-and-draft pipeline and stops before send. You can read the fit check, the facts, the draft and the verification. You cannot send. The longer walkthrough of the system, the numbers, and the tradeoffs is on the cold outreach agent case study.
If you have work that should run itself, or you are hiring for a full-time remote role in Europe, use the contact form or download my resume.