Your AI agent's riskiest call isn't the one you're watching
AI agents now read your CRM, Slack, email and code in the same chat. The risky action is rarely one bad call: it's a run of allowed calls that per-call checks can't connect. Here's how we judge each action against the whole conversation, with rules a security engineer can read and test on real history before switching them on.
AI agent security has to judge each action against the whole conversation, because the riskiest step an AI agent takes is usually a run of calls that are each allowed on their own. This post shows how that happens, why per-call checks miss it, and how we approach it with readable rules you can test on your own history.
The short version
- An AI agent can leak customer data in a chat where no single tool call would be blocked.
- Checks that judge one call at a time, and data loss prevention (DLP) that sees only content, can’t connect a CRM search to a later Slack post.
- We gather facts about each action (who is asking, what the call does, who could see the result, what the conversation already holds) and let readable rules decide.
- Prompt injection can be handled by where text came from, not by guessing what it looks like.
- Record with no policy, replay draft rules on real history, then enforce.
How does customer data leave an AI agent chat when every call is allowed?
Here is a chat that leaks customer data without a single tool call anyone would block on its own.
- A salesperson asks the AI agent: “Find our contacts at Orrin Bay Payments who opened last week’s email.” The agent searches the CRM. They’re allowed to, and it returns names and email addresses.
- “Draft a short update for the team.” The agent writes some text. Nothing leaves.
- “Post it in #partners.” The agent calls Slack and posts. It’s an ordinary Slack post in a shared channel, which they’re also allowed to do.
The message in step 3 contains the contacts from step 1, and #partners includes people outside the company.
Every call was authorised. A check that judges calls one at a time sees a CRM search, then a Slack post, and approves both. The risk wasn’t in any single call. It was in the conversation that connected them.
This is the shape of the agent risk security teams describe to us. As AI agents like Claude get the CRM, Slack, email, code and the local disk in the same session, the hard question stops being “may this caller reach this tool?”. It becomes “given everything this conversation has read, should this action happen now?”. That is the heart of agent governance.
Why do per-call checks and DLP miss it?
Most controls see part of the picture.
A check that judges one call at a time sees the call, who made it and which server it goes to. That check might run in a Model Context Protocol (MCP) gateway or in Anthropic Inference Hooks, and both are the right places to make the decision. But if the rule only looks at the call in front of it, it can’t know that the Slack post follows a CRM search in the same chat.
DLP looks at content. It might spot an email address in the Slack message. But it doesn’t know where that address came from, who is asking, or whether #partners is internal. So it either blocks every message that contains an email address, or lets this one through.
The result is a familiar compromise. Security teams can’t tell a risky write from a harmless one, so they turn writes off. The AI agent can read everything and do very little, and the business wonders why the rollout isn’t delivering.
What should an AI agent security decision know?
We’ve been building on a different split: small programs report facts, and readable rules decide. For every action an AI agent is about to take, we gather four kinds of fact.
| Fact | Example | Where it comes from |
|---|---|---|
| Who is asking | In the Sales group | The company directory |
| What the call does | Sends, writes code, destroys, or puts data where outsiders can see it | A grading of every tool on each server |
| Who could see the result | A public repository, an outside email domain | The server’s own data |
| What the conversation already holds | Contact emails read from the CRM, text written by an outsider | A record of what the conversation has read |
The last row is the one per-call checks can’t see. To know that a Slack message carries CRM contacts, we keep keyed fingerprints of the values each conversation read, never the values themselves. When a later call would carry one of them out, that becomes a fact: this call carries CRM contact emails.
Then a rule decides. (The rules in this post are simplified for reading.) We write rules in Cedar, so they read as “never … unless …”:
@id("no-crm-contact-details-out")
@advice("Share the CRM link or the record's ID instead.")
forbid (principal, action, resource)
when {
context has lineage &&
context.lineage.carried.containsAny([
"crm contacts.email", "crm contacts.phone", "crm contacts.full_name"
])
}
unless {
context has email && context.email.all_recipients_internal
};
That rule blocks the Slack post in the opening example, wherever the data is going: Slack, a file on a laptop, or a shell command. It still lets the AI agent email those contacts’ details to a colleague. When it blocks, the person sees which rule stopped them and, from the rule’s advice, what to do instead.
The rules are deterministic. A security engineer can read one, test it, and explain every decision it made, which is also what makes an audit trail worth having.
How can rules stop prompt injection without detecting it?
The same idea handles prompt injection, without trying to detect it.
A public GitHub issue, a web page or an inbound email can tell an AI agent to do something. Classifiers that try to spot “text that looks like an injection” are a guessing game, and attackers are good at that game.
We ask a plainer question instead: has this conversation read text that someone outside the company wrote? We know the answer from the source: a web fetch, a public repository, an issue by an outside author, an attachment on an inbound email. Once that’s true, a rule can say that writes the public could see stop for the rest of the conversation:
@id("no-public-writes-after-outside-text")
forbid (principal, action, resource)
when {
context has chat_memory && !context.chat_memory.outside_reads.isEmpty() &&
context has github && context.github.grades.contains("egress")
};
This rule is blunt on purpose. It doesn’t need to know whether the issue was malicious. It needs to know that an outsider’s words are now in the AI agent’s context, and that the next action would publish something. It’s predictable and easy to explain, and the person can start a fresh chat to do the write.
How do you test AI agent policy before you enforce it?
Security teams don’t enforce rules they can’t try first, and they shouldn’t. So we start with no policy at all:
- Record. Judge every action with no rules switched on, blocking nothing. Record each decision with all its facts, and never the content.
- Look. Read what the recording shows: which conversations moved CRM data into Slack, which ones read outside text and then wrote to a public repository.
- Draft a rule. Write it against the facts you’ve just seen.
- Replay. Play your real conversation history through the same judge with the draft rule on. The report shows each conversation the rule would have changed, by rule name, tool and count, without showing anyone’s messages.
- Enforce. Switch the rule on once the replay looks right.
Steps 3 and 4 form a loop. Editing a rule and replaying takes seconds, so you can tune a rule against last month’s real traffic instead of guessing.
In our own test environment, the first replay of six chats took under three seconds. It picked out two Slack posts of CRM contacts, made during testing earlier that day, that the draft rule would have blocked.
What’s still hard?
Some things we haven’t solved yet:
- Paraphrase. Fingerprints catch values that are copied out, not a summary of them. “We have 12 contacts at Orrin Bay Payments, mostly in procurement” gets through.
- Free text. Structured CRM fields are the easy case. Email bodies and Slack threads need classifiers, and that is where deterministic rules get harder.
- Blunt rules have a cost. Rules based on where text came from will sometimes block a harmless write. We think a clear explanation and an obvious workaround make that acceptable, but it’s a trade-off.
- The interception point. You need somewhere that sees the whole conversation before each action runs. MCP gateways and Inference Hooks cover different paths, and coverage varies by platform.
Key takeaways
- The riskiest AI agent action is often a sequence of allowed calls, not one bad call.
- A security decision needs four facts: who is asking, what the call does, who could see the result, and what the conversation already holds.
- Readable, deterministic rules let a security team explain every block and offer a better route.
- Judging text by its source makes prompt injection handling predictable.
- Record, replay on real history, then enforce: test policy before it touches anyone’s work.
We’re working with a small number of security teams who are rolling out AI agents with real write access. If you’d like to see what your last month of agent activity looks like under a rule you write, in your own cloud, with no content leaving it, get in touch. And if you think we’ve got the model wrong, we want to hear that too.
Frequently asked questions
- Why isn't checking each AI agent tool call on its own enough?
- Because the risk often sits in the sequence, not in any single call. An AI agent can search the CRM for contacts, which the user is allowed to do, and later post a message to a shared Slack channel, which they're also allowed to do. If the message carries the contacts, data has left the company, yet each call passed a per-call check. Catching it means knowing what the conversation already read when the later call is judged.
- How can you tell that a message carries data the AI agent read earlier?
- One way is to keep keyed fingerprints of the values each conversation reads from a sensitive source such as the CRM, never the values themselves. When a later tool call would carry one of those values out, to Slack, a file or a shell command, that becomes a fact a rule can act on. Fingerprints catch values that are copied out. They don't catch a summary or paraphrase.
- How do you stop prompt injection without trying to detect it?
- Judge text by where it came from rather than by what it looks like. If an AI agent's conversation has read text that someone outside the company wrote, such as a web page, a public GitHub issue or an inbound email, a rule can stop writes the public could see for the rest of that conversation. It doesn't need to decide whether the text was malicious, so it's predictable and easy to explain.
- How do you test an AI agent policy before enforcing it?
- Record first, with no rules switched on, so every decision is logged with its facts and nothing is blocked. Then draft a rule and replay your real conversation history through the same judge with the rule on. The report shows which conversations the rule would have changed, by rule name, tool and count, without showing anyone's messages. Edit, replay again, and enforce once it looks right.
- Does this replace an MCP gateway or Anthropic Inference Hooks?
- No. A Model Context Protocol (MCP) gateway and Anthropic Inference Hooks are the points where a decision can be made before an AI agent acts. This post is about what that decision should know: who is asking, what the call does, who could see the result and what the conversation already holds. The interception point and the context it judges with work together.