Vaikora › Blog › Product Updates
LLM policy enforcement: what happens to a request between the agent and the model, step by step
Policy enforcement for LLM calls is not a firewall rule or a prompt wrapper. It is a sequence of decisions made inline, before the model receives input or before an action executes, and the order of those checks determines what actually gets blocked versus what slips through.
This article walks through what a policy engine does to each request, where the checks happen, and what the output of each decision looks like in practice.
The request lifecycle from agent to model
An AI agent generates a request. That request might be a prompt to an LLM, a tool call to an external API, or a write operation against a database. Without an inline enforcement point, the request goes directly to its target. With one, the request is intercepted before execution.
At interception, the policy engine receives the full request context: the action type, the calling agent identity, the content of the prompt or tool call, the target resource, and any session state carried from prior turns. That context is what every subsequent check runs against.
Content inspection
The first class of checks is content-based. The engine inspects the prompt or tool call payload for patterns that the policy prohibits: credential strings, PII fields, prompt injection patterns, jailbreak attempts, instructions to ignore prior context. Each inspection module returns a signal. The policy engine collects signals across all modules before making a decision.
A concrete example: an agent calls a file-read tool with a path argument that resolves to `/etc/shadow`. A content inspection module flags the path pattern. The policy engine receives that signal, matches it against a rule that blocks OS credential file access, and issues a block decision. The file-read never executes. The agent receives a structured denial response.
That decision happens at P50 around 8ms. The agent experiences a fast synchronous denial, not a timeout.
Identity and scope checks
After content inspection, the engine checks whether the calling agent is authorized to perform this action at all. This is not a replacement for existing IAM controls. Vaikora adds an enforcement layer on top of Azure RBAC, AWS IAM, and Snowflake roles, not in place of them. The policy engine checks the agent's declared identity against a policy that scopes which tools, models, and data targets that identity may reach.
If the identity check fails, the engine issues a block before the content ever reaches the model or tool. This matters because content inspection alone does not catch a legitimately-structured request from an agent that has no business making it.
The four decision outputs
Every request gets exactly one of four decisions:
- Allow: the request is clean against all checked policies and proceeds to the target.
- Block: the request violates at least one policy. The engine returns a denial to the agent. The target never receives the request.
- Modify: the engine rewrites the request before forwarding it. A common use case is redacting a PII field from a prompt before it reaches the model, then forwarding the sanitized version.
- Require-approval: the engine holds the request and routes it to a human reviewer queue. The action does not proceed until a reviewer approves or denies it.
The decision is deterministic. Identical input against identical policy produces identical output, every time. That property is what makes enforcement auditable rather than probabilistic.
Writing the audit record
Every decision, regardless of outcome, is written to a SHA-256 hash-chained audit log. The chain means that any modification to a past record breaks the chain at that point, making tampering detectable. The record includes the full request context, the signals each inspection module returned, the policy rule matched, and the decision issued. That is the minimum needed to reconstruct an incident without ambiguity.
If the decision is a block, the record shows exactly which rule triggered and what content matched it. If the decision is a modify, the record holds both the original and the rewritten payload. That detail matters during investigation: you need to know what the agent tried to send, not just what the model received.
Where signals go after the decision
A blocked or high-severity event does not need to stay inside the enforcement platform to be useful. Vaikora pushes AI agent threat signals into SentinelOne as Threat Intelligence indicators with severity mapped numerically (Critical=100, High=75, Medium=50, Low=25). High-severity events promote into Azure Security Center and Microsoft Defender for Cloud as native incidents. SOC analysts see the event in their existing tooling without a custom pipeline.
What to check next
If you are evaluating inline policy enforcement for an LLM deployment, the two questions that surface problems fastest are: what happens to the request if the enforcement point is unavailable, and does the audit record capture the original payload or only the post-decision state. Both answers tell you whether the control is real or whether it disappears under load or failure.
The Vaikora Guard MCP proxy is MIT-licensed and published on PyPI, so you can run a local enforcement point against your own agent traffic and inspect the audit output directly before committing to anything else.
See Vaikora enforce policy on your AI
Open-core AI runtime control. Self-host the MIT gateway free, or run the hosted Control Plane.
Get a demo Self-host the gateway
Vaikora