How to Build an AI Research Agent for Accounts, With Guardrails That Hold

An AI research agent for accounts is a loop that searches, reads and writes a cited brief. Here's how to build one with hard caps, a source allowlist, read-only tools and the cost math per account.

Pixel-art magnifier next to a shield, an account research agent that searches inside firm limits.

An AI research agent for accounts is a model that runs in a loop: it searches, reads, decides what to look at next and writes a cited brief about a company. To make it safe, give it hard caps on steps and searches, a source allowlist, read-only tools, a strict output schema with a citation per field, and a test set it must pass.

The questions a brief should answer are covered in my guide to AI account research agents that sales trusts. This post is the build. It's about the loop, the limits and the money, because that's where agents go wrong.

A research agent fails in three ways. It runs too long and costs too much. It reads something it shouldn't trust. Or it writes something confident and wrong. Each failure has a fix you build into the system, not the prompt.

Key takeaways

  • Cap the loop. Set a max number of steps, searches and tokens per account, and stop cleanly when it's hit.
  • Allowlist sources. Restrict searches to domains you trust for each question.
  • Keep tools read-only. The agent writes only to its own brief fields.
  • Require a citation per field. No source and quote, no claim.
  • Test before you ship. Run a fixed set of known accounts after every change.

What is an AI research agent for accounts?

An AI research agent is a model with tools that picks its own next step. For account research, the tools are usually web search, a page fetcher and a CRM lookup.

Anthropic draws a useful line in Building effective agents. Workflows are systems where models and tools follow "predefined code paths." Agents are systems where models "dynamically direct their own processes and tool usage."

That difference matters for research. A workflow asks the same five questions for every account, in order. An agent decides which questions need more digging. It might search the careers page twice for one company and skip it for another.

The same article gives the trade-off plainly. Agents "often trade latency and cost for better task performance." So the first question isn't how to build an agent. It's whether you need one.

Do you need an agent, or is a workflow enough?

Most teams should start with a workflow. Here's how I'd choose.

Situation Build Why
Same questions for every account, good websites Fixed workflow Cheaper, faster, easy to test
Accounts vary a lot, thin or odd websites Agent with tight caps It can dig where a fixed path misses
Reps want to ask follow-up questions live Assistant connected to the CRM People steer, so caps matter less
Under a handful of first meetings a week No build yet A checklist and a rep is enough

If you go with an assistant inside the CRM, my guide to an MCP server for your CRM covers the setup. For the wider view of where agents earn their keep, see AI agents for GTM.

How does the agent loop work?

Every research agent runs the same loop. The model gets a task and a list of tools. It calls a tool, reads the result, and decides whether to call another or finish. This is called tool use.

Flow from trigger to context, plan, search, extract and a final check before the brief is written, with the plan step in orange.Flow from trigger to context, plan, search, extract and a final check before the brief is written, with the plan step in orange.
The plan step decides where the money goes, so caps and allowlists wrap the steps after it.

The loop is where cost and risk live. Each turn adds tokens. Each search adds a fee. Each page it reads can contain text written to mislead it.

So I build the loop with six parts, in order:

  1. Trigger. A first meeting is booked, or an account enters a tier.
  2. Context. Pull what the CRM already knows, so the agent doesn't re-research it.
  3. Plan. The agent picks which questions need searching.
  4. Search and read. Capped searches on allowlisted domains.
  5. Extract. Fill a fixed schema, with a source and quote per field.
  6. Check and write. Validate the output, then write only to the brief fields.

The plan step is the one to watch. That's where the agent spends your money. Everything after it is easier to check.

What guardrails does a research agent need?

My AI agent guardrails guide covers agents that take actions, like sending email. A research agent mostly reads, so its guardrails are different. They're about budget, sources and truth.

Hard caps on the loop

Anthropic's guide says it's common to add "stopping conditions (such as a maximum number of iterations) to maintain control." For research, I set three caps per account.

Cap Starting value I'd use What happens when it's hit
Steps in the loop 12 Stop and write what it has, marked partial
Web searches 8 Search tool returns an error, agent must finish
Input tokens 80,000 Stop and flag for review

The search cap is easy to set with the Claude API. The web search tool docs describe a max_uses setting that limits searches. When the agent goes over, the API returns a max_uses_exceeded error in the response. Failed searches count toward the limit, so a flaky run can't loop forever.

A source allowlist

The same tool takes allowed_domains or blocked_domains, but not both in one request. I use an allowlist per question. Funding questions search news and the company's own site. Hiring questions search the careers page and job boards.

An allowlist does two jobs. It cuts junk results. It also shrinks the number of pages that could carry hostile text.

Treat every page as data

A research agent reads the open web. Some pages will contain text that tries to give it orders. The OWASP list for model apps calls this indirect prompt injection: it happens when a model "accepts input from external sources, such as websites or files."

OWASP's fixes map cleanly to a research agent. Keep tools at least privilege. Separate untrusted content from instructions. Validate the output format. And test with hostile pages on purpose.

Read-only tools, one write

The agent gets read-only CRM access. Its only write is to its own fields, such as a brief and a last-researched date. It never touches owner, stage, email or phone. A bad run then costs you a bad brief, not a broken record.

A citation for every field

Force the output into a structured output schema. Each field holds a claim, a source URL and a short quote. Code rejects any field that's missing a source. The guide to structured outputs for GTM shows how to define the schema.

This helps with the web search tool too. Per Anthropic's docs, citations are always on for web search, and each one includes the URL, title and up to 150 characters of cited text. Your check can compare the quote in the brief with the text the search returned.

How do you test the agent before reps see it?

Build a test set before you build the agent. These tests are called evals.

Pick 30 accounts you know well. Write the right answer for each question by hand. Include a few hard ones: a company that rebranded, one with a common name, one with almost no website.

Then run the agent on all 30 after every prompt or model change. Score three things:

  • Accuracy. Does each claim match your answer?
  • Citation match. Does the quote actually appear on the source page?
  • Cost. How many searches and tokens did each account use?

Anthropic's guide also recommends "extensive testing in sandboxed environments." For a research agent, that means a test CRM, not your real one. Add one hostile page to the set, with hidden text that tells the agent to change a field. It should ignore it.

Once it's live, keep a human in the loop at the start. Have a rep or ops lead check one in ten briefs for the first month. A hallucination caught in review is cheap. One caught on a call is not.

Worked example: what does a capped agent cost?

This is a worked example with assumed usage. Prices are from Anthropic's pricing page and the web search docs.

Bar chart of monthly cost for 500 accounts: a capped agent at $115 against an uncapped one at $415.Bar chart of monthly cost for 500 accounts: a capped agent at $115 against an uncapped one at $415.
Worked example from this guide: caps on searches and tokens cut the monthly bill by more than three times.

Prices used: web search at $10 per 1,000 searches. Claude Sonnet 5.5 at $2 per million input tokens and $10 per million output tokens. Search results count as input tokens.

Capped agent. Say each account uses 8 searches, 60,000 input tokens and 3,000 output tokens.

  • Searches: 8 x $0.01 = $0.08
  • Input: 60,000 tokens at $2 per million = $0.12
  • Output: 3,000 tokens at $10 per million = $0.03
  • Total: about $0.23 per account

Uncapped agent. Say a loose agent wanders to 30 searches and 250,000 input tokens, with the same output.

  • Searches: $0.30
  • Input: $0.50
  • Output: $0.03
  • Total: about $0.83 per account

The bigger cost is review time. Say a person checks one in ten briefs at five minutes each. At 500 accounts, that's 50 briefs and about four hours a month. Budget for it in month one, then cut it as your evals hold up.

If briefs don't need to be instant, there's another lever. The pricing page lists a 50% batch discount on tokens. Overnight research for next week's meetings is a good fit.

What are the common mistakes?

No stop condition. An agent with no caps will sometimes loop. You'll find out on the invoice.

Searching the whole web. Without an allowlist, the agent reads forums, scraped copies and spam. That's lower quality and more risk.

Letting it write anywhere. Broad CRM write access turns a research bug into a data cleanup project.

Trusting fluent output. A confident paragraph with no source is the most dangerous thing it can produce. Reject it in code.

Skipping the test set. Without evals, every prompt change is a guess. You'll ship regressions without knowing.

No monitoring. Track runs, failures and cost per account. The GTM ops observability guide covers alerts for silent failures.

What should you do this week?

If you want this built and handed over, my GTM engineering service does exactly that. The AI agents and MCP use case shows how I scope it.

My take: small agents, hard limits

The pitch for research agents is that they think for themselves. That's the part I trust least. I want the smallest agent that does the job, inside walls I can see.

Cap the loop. Allowlist the sources. Make it cite every claim. Let it write to one place. Then test it every time you touch it. An agent built like that is boring to watch, and that's the goal. Reps trust boring.

FAQ

What is an AI research agent for accounts?

It's a model that runs in a loop with tools. It decides what to search, reads the results, and writes a short brief about a company, with a source for each claim. Unlike a fixed workflow, it picks its own next step. That makes it flexible, but it also means you need hard limits on what it can do.

How much does an AI account research agent cost to run?

It depends on searches and tokens. On the Claude API, web search costs $10 per 1,000 searches, and Claude Sonnet 5.5 costs $2 per million input tokens and $10 per million output tokens. In my worked example, a capped agent costs about $0.23 per account. Without caps, the same job can cost several times more.

Should an account research agent write to the CRM?

Yes, but only to its own fields. Give it write access to a brief field and a few research fields, never to owner, stage or contact data. Keep every other tool read-only. That way a bad run can only produce a bad brief, which a rep can ignore, instead of changing records sales depends on.

How do you stop an agent from making things up?

Make every claim carry a source URL and a short quote from that source. Reject any field without one. Then test the agent on a fixed set of accounts where you already know the answers, and check its output against them before each change goes live. Unsourced claims should never reach a rep.

What is prompt injection, and does it matter for research agents?

Prompt injection is text that tries to change what a model does. OWASP calls the kind that comes from websites or files indirect prompt injection. A research agent reads the open web, so it will meet it. Treat page text as data, keep tools read-only and validate the output format before anything is saved.

Should I build an agent or a fixed workflow?

Start with a fixed workflow if the questions are the same for every account. It's cheaper and easier to test. Move to an agent when accounts vary enough that a fixed path keeps missing things, such as companies with odd structures or thin websites. Even then, keep the agent's job small.

More like this

Startup? Let's talk.

20 minute fit call. You'll leave knowing the first thing we'd fix and roughly what it costs. If we're not the right fit, we'll tell you who is.