Skip to content

How To Test An AI Agent Before It Can Write To Your CRM

Test a CRM agent before granting write access. Check duplicate actions, missing reads and failed sends, then name who owns repairs.

On this page
  1. How Our Agent Sent a Prospect a Second Email Nobody Checked
  2. Retry Protection Would Not Have Caught It
  3. Test It On One Record Before It Gets Write Access
  4. Read the Record Right Before Every Write
  5. Give the Agent Every Mailbox It Needs To Read
  6. What To Do When a Write Times Out
  7. Who Owns The Agent After The Test?
  8. Frequently Asked Questions

Empact Newsletter

One email a month on what is working in AI search and SaaS go-to-market.

Check your email for a link to confirm your subscription.

You are already subscribed.

Check your email address and try again.

We could not save your subscription just now; please try again.

An AI marketing pilot that works in a demo can write a good answer. The demo doesn’t test what happens when that answer becomes a write to your CRM, the system holding your sales contacts and deal records. In production, that write is how a prospect gets an extra email or a deal record ends up wrong.

Seven tests on one test record, with test credentials, show whether yours is ready to write to it.

When Empact Partners builds a custom AI agent for a SaaS sales or marketing team, we test its first real write to the CRM before anything else. A wrong update there reaches real buyers.

How Our Agent Sent a Prospect a Second Email Nobody Checked

We learned why on our own outbound. Our reply agent reads the replies to our outreach, writes to our CRM and drafts the answer. In October 2026 it sent a prospect two emails, and nothing reported an error. On 22 October a prospect replied to one of our outreach emails, interested, and asked for a brief on our services:

Scroll horizontally to see all columns when the table is wider than this page.

The incident on our own pipeline, 22 and 23 October 2026
When (UTC)What happenedWhat the CRM showed
22 Oct, 16:52The agent answers as the consultant who owns the conversation and promises a reportThe record updates
23 Oct, 08:15That consultant asks the agent in Slack to send the brief with the report attachedNo change
23 Oct, 09:39A job builds the report and sends a second email straight from the mailbox, the only route that could carry a fileNo change: the outreach platform cannot see a send like that
23 Oct, 13:40Four hours on, nothing has reached the CRMThe record still ends on the first email

The second email was wanted, and it built on our first reply. The failures were in how it went out and how it was recorded, and none of them raised an error:

  • No check. Nothing asked whether our side had already answered.
  • No record. Four hours later, the CRM still did not show the second email.
  • Wrong direction. One of our own emails on that conversation had been filed as the prospect writing back.
  • Wrong author. The CRM had no field for who acted, so the agent’s sends were posted as if a consultant had made them.

A demo rarely shows any of this, because only the agent writes to its test record. In production, colleagues, scheduled jobs and other tools write to the same place.

The CRM in this story is one we built for our own pipeline rather than HubSpot or Salesforce, so its names and limits differ from yours. The same failure can happen wherever a person, a job and an agent can all reach the same prospect.

Retry Protection Would Not Have Caught It

Engineers usually guard against duplicates with idempotency, which means running an operation twice has the same effect as running it once. You build it with an operation identifier (ID), a key that stays the same every time the same operation arrives. If one reply reaches your agent twice, both copies carry the same key, the agent checks it before writing, and the second copy is dropped.

Your agent needs that key, because a CRM can deliver the same event more than once. HubSpot sends webhooks, the messages that tell your other systems a record changed, and its guide says a failed one is re-sent up to 10 times over 24 hours 1. The same guide says the event ID on those messages is not guaranteed to be unique. So build the key from what triggered the write and the action it takes, store it, and check it before each write.

Now run that key on our failure. The first email answered the prospect’s message. The second answered a consultant’s request in Slack, on a different route, the next morning. Here is where a key like that helps, and where it cannot:

Scroll horizontally to see all columns when the table is wider than this page.

Where an operation ID helps, and where it cannot
SituationSame key both times?Does retry protection stop it?
Your CRM re-sends a webhookYes, if the key is built from the trigger and the action, not the event IDYes
A job restarts and repeats a writeYes, if the key comes from the trigger and not the runYes
A person asks for what the agent already didNoNo
A second tool picks up the same leadNoNo

A retry key only catches the same operation arriving twice. Our second email came from a different request, so the key had nothing to match.

So an agent needs two checks before each write. The key answers whether this exact operation has run before. A fresh read of the record, made right before the write, answers what has happened since the agent last looked. When the write is an email, that read has to cover every mailbox that can reach the prospect. It would have held our second email until someone confirmed it was meant to follow the first.

Test It On One Record Before It Gets Write Access

The seven tests below check both of those, plus the other ways a CRM write goes wrong once other people and tools are involved. Each one forces a failure on purpose, so set them up where a mistake cannot reach a prospect:

Here are the seven tests. The second, “a person got there first”, is the one that would have caught our failure, because it checks that whatever sends next notices your side has already answered:

Scroll horizontally to see all columns when the table is wider than this page.

Seven tests before production write access
TestHow to run itA pass looks like
The same trigger twiceResend the webhook, or rerun the job on the same recordOne effect, and the run says why it stopped
A person got there firstReply by hand from a mailbox or tool the CRM doesn’t see, then trigger the agent or any other route that can sendIt finds that reply, refuses and names what it saw
Two at onceTrigger it twice within a secondOne write lands, and the other waits or refuses
A blind readRevoke a mailbox or read permission, or expire the credential mid-runIt stops with a reason and never takes no data to mean nobody acted
No answerKill the run after the write and before the confirmationOn restart it reads the record first and writes nothing new
The read-backCompare the ID you stored with the ID the CRM shows, and who the record says actedThey match, and the record names the agent, on whose behalf, and who asked
The stopTurn it off in the middle of a batchNothing else goes out, and someone who is not an engineer can do it

The read-back test comes from a second failure of ours. Four days after we fixed the first one, our email provider gave a sent email its own message ID instead of the one we had set. The record then showed that one email as two events. Store the ID the system returns, and match on that.

A pilot that fails the same-trigger test needs its repeat protection repaired and tested again. A pilot that fails the person-first test needs a fresh read before every write, covering the record and every mailbox that can reach the prospect. That changes how the agent is built, so it takes longer than fixing a key. A pilot that passes earns access step by step, and the same agent can hold different rights for different actions:

How a passing agent earns write access

  1. Replay.

    Run the last ten days of real events with nothing written, and have the integration owner read every draft for mistakes.

  2. Approve each one.

    Every proposed write waits for a person to accept or reject it.

  3. Alone on reversible writes.

    The agent acts unattended on writes a person can reverse, and everything else still waits.

Our own replay produced eight drafts with two faults, an empty “no reply needed” draft and a draft that claimed an attachment it did not have. In October 2026 our agent sat at the second step, because an email cannot be recalled. Moving it up was my call alone, and that is the kind of decision an agent’s owner should hold.

The playbook below helps you give the agent that owner on your team, someone who can switch it off and get a failed run going again without whoever built it.

Read the Record Right Before Every Write

An agent passes those tests because of how it sends, and a better prompt will not get it there. After the incident we rebuilt our own sending. Every email any agent sends now goes through one send function, plain code with no model in it, and the CRM itself has no right to send anything. An email reaches a prospect only after passing these gates:

The gates every email passes, in order

  1. One writer.

    Take a lock on the company, so only a single writer can act on it at a time.

  2. Live thread.

    Under that lock, read the conversation fresh from every source, and refuse if our side has written since their last message.

  3. Operation ID.

    The prospect’s message ID plus the action, stored in a send log with one row per send, so the same operation cannot go out twice.

  4. Stage.

    Once a meeting is booked, the deal belongs to the consultant and the agent stops.

  5. Content.

    The agent cannot waive these rules. It never quotes a price nobody asked for, never promises an attachment it does not carry and never names another partner.

  6. Caps and send window.

    Limits per inbox and per company, and follow-ups only inside the recipient’s working hours.

  7. Kill switch.

    A single command or Slack message stops everything.

Each send then leaves a row in the send log with who acted, whose name it went out under, who asked for it and which message ID it carried. The CRM gets the event at once.

A second email is still allowed when someone wants one, but it has to be declared as building on the earlier email. Our second email in October had no such declaration. Our test suite replays the original failure to prove that an undeclared one is refused. The kill switch works from Slack, so stopping the agent never waits for an engineer.

Before the repair, each route wrote straight to the prospect and the CRM found out afterwards, if at all. Now every route passes the same read first:

Every route that can email a prospect passes the same send function, which reads the record first and logs who acted.
Whichever route a send starts from, it reaches the prospect only after the record has been read and shows no answer from our side yet.

Between 23 and 29 October 2026 our send function handled the agent’s proposals, live and in rehearsal 2:

137emails proposed by the agent
9sent to prospects
74passed every gate and waited for a person’s approval
54stopped at a gate
Source: Empact Partners

Of the 137, nine were sent, 74 passed every gate and waited for a person’s approval, and 54 were stopped. Nothing went out that week without a person’s go, and none of the 54 stopped drafts ever reached that person. The chart splits them by the gate that made each stop:

What Stopped Proposed Emails At Our Send Function

54 stops among 137 proposed emails, live and rehearsed, our own pipeline, 23-29 Oct 2026

View the data
LabelValue
Content check21
Live thread check18
Send window11
No route2
Kill switch1
Error1
Idempotency key0
The content check caught the most, 21 of the 54 stops. The 11 send-window stops were holds, released once the recipient’s working hours began.Source: Empact Partners

The operation ID sits after the thread check, and with nine real sends that week it had nothing to repeat, which is why its bar is empty. Most thread stops, 15 of 18, came on the day the gates went in, as the check refused conversations where our side had already written since the prospect’s last message.

The content check stopped the most drafts. Of its 21 stops, eight drafts promised an attachment that was not there and six quoted a price nobody had asked for. An instruction in the prompt can only ask the model not to write those things. The send function refuses any email that still does.

As Empact Partners’ founder and CEO, I came out of that week knowing what any agent that writes to a CRM has to show me:

Before I give a CRM agent write access, I want to see it read the record fresh before every write, across every mailbox and tool that can reach the prospect. The operation ID still matters, because machines do repeat themselves. It just can’t see a colleague who answered first, so we keep both checks, and a person still approves every send.

Vlad ShvetsFounder & CEO @ Empact PartnersVlad Shvets on LinkedIn

Give the Agent Every Mailbox It Needs To Read

The fresh read covers only what the agent is allowed to read. On the day of the failure, the check would have needed the mailboxes of 13 people on our team. A prospect’s reply to any of them lands in that person’s own inbox. Seven had connected theirs fully, two read-only and four not at all, so a reply from one of those four would have been invisible. Everyone has been connected since 27 October.

When a mailbox the check needs cannot be read, the send now waits ten minutes and tries again. Until then, “nobody has answered” means little, because the answer could sit in a mailbox the agent has no access to. The dangerous version of this bug is code that treats a failed read as an empty result, because then the check passes. An expired credential or a rate limit opens the same blind spot, so treat it the same way.

Reading is half of it. The other half is what the agent may change, and that fits on one page per job. Give each job its own credential, so the record can say which job wrote, and fill in three lines:

The permission sheet for each agent job

  • Read: the objects and fields the check needs and nothing more, and the agent waits whenever a required read fails
  • Propose: what it may draft for a person to approve
  • Execute: what it may change alone, field by field, starting empty

Test each line through the API the agent writes with. A rule that lives only in the CRM’s screens does not stop a credential calling the API directly. Most readers run HubSpot or Salesforce rather than a CRM like ours, and HubSpot users on Reddit describe the same gaps from their side:

Tips from Reddit

What practitioners say about agents that write to a CRM

HubSpot sometimes accepts a value and stores something else, e.g., a dropdown option that doesn't exist.

r/hubspot, u/Consistent_Donut_113, October 2026

For high-impact CRM actions, I’d rather have a deterministic layer make that decision based on actual CRM data and explicit rules, then let the agent act on the result.

r/hubspot, u/TrueTax975, September 2026

An agent having CRM access doesn't necessarily mean it should have unrestricted write or export access.

r/hubspot, u/Growth_Natives, September 2026

What To Do When a Write Times Out

A call that times out after it succeeded is the other hole in retry logic. Most retry logic treats a write as done or failed. A timeout adds a third state, where you do not know, and that is the state a retry makes worse:

Scroll horizontally to see all columns when the table is wider than this page.

How our send function handles a write that breaks partway
When it breaksWhat we knowWhat happens
Before deliveryNothing leftThe key is freed, the caller is told, and trying again is safe
During deliveryThe request may have leftMarked as unknown and never resent automatically. The function looks for the email in the mailbox before anything else goes out
After delivery, before the recordIt went out and the send log did not take itReported as unknown, so nobody resends it

None of the 137 emails took the unknown path, so our test suite forces it on purpose. Whatever system you run, read the record after a timeout before you write again.

Who Owns The Agent After The Test?

Passing the tests does not finish the job. After launch, the owner has to keep the permissions right, look into every unknown outcome and repair what breaks, long after the pilot team has moved on. If nobody is named for that work, the first failure after launch has no one to fix it.

The tests settle some questions once, and others need that owner to keep them running:

Scroll horizontally to see all columns when the table is wider than this page.

What the tests settle, and what someone has to keep running
What the tests settleWhat someone keeps running
The agent refuses a repeat and a second trigger on a test recordOne send path that every route goes through, including routes added later
Every tool and mailbox that can reach a prospect, found and namedA live read across all of them, with access renewed when a credential expires
Which CRM rules exist only in its screensThose rules enforced in the API or the send function, where the agent’s credential meets them
A verdict on the pilotThe send log, a notice on every stop, and the repairs after launch

The owner also needs a number to watch, usually the runs somebody had to rescue or the hours the agent gives back. Estimate those hours before anyone builds, because they decide whether the agent is worth its upkeep.

The calculator below starts from a made-up SaaS company of 100 people that answers 400 replies a month. Each reply takes 8 minutes to write by hand, against 3 minutes to check the agent’s draft, and an hour is valued at $54. On those inputs the agent saves 400 hours of staff time a year.

At that hourly value, less $100 a month for the model, hosting and the CRM connection, the time saved is worth $20,400 a year. A $10,000 build pays for itself in 5.9 months. The build figure is only there for comparison and is not a price, so replace every input with your own.

CRM Reply Handling ROI Calculator

What Each Reply Costs You To Answer And Log, And With An Agent

Every reply to an email, a form or a sequence that someone reads, answers and records in the CRM. The example's 400 is an assumption for a 100-person SaaS company with two SDRs.
Reading the thread, looking up the account in the CRM, writing the answer and logging what happened. The example's 8 minutes is an assumption. Unit: minutes.
A person still reads every drafted answer and CRM update before it goes out or is saved. The example's 3 minutes is an assumption. Unit: minutes.
The example's $54 is the US median pay for sales representatives in May 2025, $36.76 an hour (BLS), with benefits added: wages were 68.5% of what a full-time private-sector employee cost in June 2026. Unit: dollars.

Saved Per Year

$20,400

400 hours handed back, after $1,200 a year to run it

Hours Handed Back
400 hours a year
Agent Running Cost (Estimate)
$100 a month
Payback Per $10,000 Of Build
5.9 months

On these numbers, each reply costs $2.95 instead of $7.20, the agent saves $20,400 a year after its own running cost, and every $10,000 of the build is earned back in 5.9 months.

Example numbers. Type over them with yours.

If you have a task in mind but no plan for its agent yet, describe the task to the blueprint below in a paragraph. It sends back a proposed agent for it, step by step, with where a person approves and what each run would cost.

If someone on your side can keep those controls running after launch, you can run these tests without us. Where you want help with the build, we would start with the routes, because a route nobody checked is what failed us. That means finding every route that can email a prospect and making each one read the record before the agent’s first real write. The rest of the work keeps that agent tied to your CRM and to one owner:

From the first audit to an agent your team runs

  • An audit of the CRM work your team repeats by hand, to pick the job an agent should take first
  • An agent for that job, built around your CRM and the mailboxes your team already uses
  • One owner on your side for the agent and its CRM controls, trained by us, with the workflow around it rebuilt

Frequently Asked Questions

Can we test an agent before it touches our live CRM?

Yes. Start with the seven tests on a test record with test credentials. After them, replay real events from the last ten days with nothing written and read every draft, which is the first step toward real access. The read-back test still has to be confirmed through your real systems, because only they show which ID the CRM keeps. The agent earns write access to real records only after it passes, and then only for the actions the tests covered.

Does passing the seven tests mean it can send alone?

No. Passing earns the next step. First every write waits for a person, then the agent acts alone only on writes a person can reverse, such as a field update or a note. An email cannot be recalled, so under these steps it always waits for a person. Many teams keep it that way for good, because the approval queue is also where the owner sees which drafts still need fixing.

Do we need a different CRM to do this safely?

Not necessarily. Check that yours can issue the agent a credential of its own, with only the reads the check needs and no execute rights to start. Check too that its records can show which credential made each change. If it can’t, raise that with the vendor before the agent gets access. The send function and the log can live outside the CRM, which is how we run ours, so the CRM only needs to accept the event and show who acted.

What permissions should the agent’s credential have on day one?

Read access to the objects and fields the fresh read needs, including every mailbox that can answer a prospect, and nothing else. Propose rights for the drafts a person will approve. Execute rights empty. Add execute rights field by field, each after a test that forces that write and checks the read-back. Keep deletes, exports and owner changes out of the agent’s reach entirely.

What if a send times out?

Treat the outcome as unknown. Read the mailbox and the record before anything else is sent, and if the email isn’t there, have a person check rather than retrying. A retry after a timeout is how a prospect gets the same email twice. Log every unknown outcome with the time and the message, so the owner can see whether timeouts cluster around one inbox or one hour.

How do we stop an agent in the middle of a batch?

Give it a kill switch that sits in the send function, not in the agent, so stopping it doesn’t depend on the model obeying. A single command or Slack message should stop every send that hasn’t gone out yet. Test it during the seven tests, with someone who isn’t an engineer pressing it. Afterwards, check that every stopped send is logged, so nothing is resent when the switch comes off. Write down who may use it, and make sure that person knows where it is.

Should the CRM record the agent as the author of its writes?

Yes. Each write should name the agent, the person on whose behalf it acted and the person who asked, if anyone did. Without that, the agent’s work looks like a consultant’s, which hides mistakes and confuses whoever reads the record later. If your CRM has no field for it, add one before the agent writes, because rebuilding authorship afterwards from logs is slow and incomplete.

Who owns the agent after launch?

A named person who sees every stop, owns the repairs and can turn it off. In your team it can be whoever owns the integration, as long as the name is written down and they have the time. The owner also decides when the agent earns a new right, using the stops and the review queue, not the agent’s own confidence. When the owner changes jobs, the agent pauses until a new name is written down.

Can we run these tests ourselves without a consultancy?

Yes, if someone on your side will own the controls after launch. The tests need a test record, test credentials, the person who owns the integration and a few hours to force each failure on purpose. The harder part comes after the tests, when you build the single send path and the live read across every mailbox and then keep up with the repairs. Outside help pays off there, and even then the agent needs an owner on your side.

What should we measure before building?

Start with the paid hours your team spends handling replies today and the review time the agent’s drafts would still need. Add the monthly running cost of the model, hosting and the CRM connection. The calculator above weighs them with your own numbers. Record the current error rate too, such as replies that went out late, twice or to the wrong person. After launch, that rate shows whether the agent fixed a problem or created one.

Sources (2)
  1. HubSpot, "Webhooks API guide" (2026)↩1
  2. Empact Partners, "Send log of our outbound reply agent, aggregated from the send ledger" (2026)Empact Partners' own data↩1↩2↩323 to 29 October 2026.

Ready
To Connect?

Let's Partner