This blog is a perspective on how to protect agents using a framework that includes intent alignment, behavioral alignment, and action sequence risk

Most AI security tooling today was built for a simpler world: a user sends a prompt, a model returns text, and a firewall in the middle that checks for jailbreaks, toxicity, or leaked secrets. Agents break that model. An agent takes a goal, builds a plan, calls tools, reads documents, chains actions across systems, and produces an outcome. A single user request can become dozens of LLM calls and tool invocations, any of which can go wrong.
Inspecting prompts alone can’t tell you whether that chain of actions is safe. The question isn’t “is this prompt malicious?” It’s “is this agent doing what the user wanted, in the way it was designed to, without taking dangerous actions?” That’s the shift we argue for here: from prompt-focused security to intent-based security.
This post covers two things: the foundation (discovering your agents and capturing their traces) and a three-dimensional framework for evaluating agent behavior at runtime.
Part 1: The foundation is the agent trace
Discovery first: you can’t secure agents you don’t know about
Agents are appearing faster than security teams can track them. They show up in managed cloud services (Bedrock Agents, Vertex AI Agent Builder, Azure AI Foundry), in application code built on frameworks like LangGraph, CrewAI, or Google ADK, and inside SaaS copilots. Many are built by teams without any security review. Some are built by individual developers as side projects that quietly end up with production credentials.
Discovery needs to pull from multiple sources, because no single one sees everything.

Figure 1. Discovery sources feed an agent inventory, which enables trace capture and security evaluation.
The output of discovery is an inventory: every agent, the models it uses, the tools and MCP servers it can call, the data it can reach, the identity it runs as, and who owns it. That inventory is valuable on its own for posture management. Over-permissioned agents, agents with write access to production databases, and agents calling unvetted MCP servers can all be flagged before anything goes wrong.

Figure 2. Harness builds the agent dependency graph using Agent Traces
Next: Tracing, where the trace is the unit of security
Once you know an agent exists, the next step is capturing what it actually does. A trace is the full record of one agent execution:
A prompt filter sees the first row and the last. Everything in between, which is where agents actually cause damage, is invisible to it. Every evaluation described below runs on the trace.

Figure 3. Harness Agent Trace
Part 2: A three-dimensional framework for agent security
We evaluate every agent execution along three dimensions. Each catches a different class of failure, and none is sufficient alone.

Figure 4. Each trace is scored on three dimensions that combine into a single policy decision.
What (and who) we’re defending against
Each signal is better against some threats than others:
Two cases need extra care:
- Malicious user: The agent is doing exactly what it was asked, so an intent judge won’t flag it. The real check is whether this user is allowed to do this at all.
- Malicious insider: Whoever designs the agent also defines what “normal” looks like. Fixed limits on high-risk actions and review of agent changes are the remaining safeguards.
Dimension 1: User intent alignment
Is the agent's plan, tool usage, and output aligned with what the user asked for?
This is where indirect prompt injection shows up. The attack rarely appears in the user's prompt. It appears as a gap between what the user asked for and what the agent did.
Example: A user asks an email assistant to "summarize my unread emails." One email contains hidden text instructing the agent to forward recent invoices to an external address. The user's prompt is clean, so an input filter sees nothing wrong. The trace, however, shows a send_email call to an external recipient, which has nothing to do with summarizing.
An LLM intent judge can catch this. An intent judge is a separate model that compares the user's stated goal against the agent's plan, tool calls, and output. It looks for three things:
- Goal deviation: the agent pursued something the user didn't ask for.
- Malicious intent: the user's goal is itself harmful.
- Injection markers: the agent followed instructions found in retrieved content.
Two considerations apply. First, the judge should evaluate intermediate steps, not just the final output, because the damaging tool call happens before output is produced. Second, the judge reads untrusted content, so it must be hardened against injection itself, and it remains a probabilistic control rather than a standalone defense.
Dimension 2: Agent design and guardrail alignment
Is the agent behaving the way it was designed to, according to its system prompt, tools, policies, and business logic?
An action can match the user’s request and still break the agent’s design. A customer asking for a $5,000 refund may be a legitimate request. But if the agent was built to refund up to $200 and escalate anything larger, issuing $5,000 is a guardrail violation. The cause could be a jailbreak, a manipulated tool response, or a bug.
These guardrails are hard to enforce directly. Rules written in natural language aren’t machine-enforceable, and many business rules live in application code the security layer can’t see.
The alternative is to learn the agent’s design from its behavior. Over many executions, a well-functioning agent settles into consistent patterns, and those patterns form a behavioral baseline. Significant deviations from the baseline are flagged as anomalous.

Figure 5. A support agent’s learned tool sequence versus an observed execution that deviates from it.
A useful baseline combines several signals:
- Tool call sequences: which transitions are common, rare, or never seen.
- Parameter distributions: refund amounts, record counts, recipient domains.
- Data access scope: which tables, files, or records the agent normally touches.
- Volume and rate: reading 40,000 records when the norm is one is anomalous regardless of intent.
System prompts and tool schemas, when available, strengthen the baseline, but the model works without them.
Dimension 3: Tool and action category risk
How much damage can this action cause?
Reading a document is a different event from deleting data, granting access, or sending information outside the organization. Intent and behavioral signals tell you something is off. The action category tells you how much it matters.
Classification is per call, not per tool. The same tool can fall into different categories depending on its parameters: send_email to an internal address is an internal send, while the same tool to an outside domain is an external send.
Risk modifiers
- Data sensitivity: A call touching sensitive data (PII, secrets, credentials) moves up one level.
- Session context: Once a session has read sensitive data or processed untrusted content, external sends move up one level. This catches exfiltration even when the outgoing payload has been summarized or reformatted.
Detection is one layer, not the whole defense. Any detector that reads attacker-controlled content can be bypassed, so these signals work best on top of architectural controls: least-privilege tool scopes, separating an agent’s plan from untrusted data, and hard limits on risky combinations, such as external sends after processing untrusted input. Detection catches what the architecture still allows, and repeated alerts show where the architecture needs tightening.
What the agent firewall of the future looks like
Several properties separate an agent security layer from a prompt filter:
- Operates on traces, not messages: evaluates each step, especially before tool calls with side effects
- Understands intent, not just content: checks whether actions serve the user’s goal, which catches injections that contain no obviously malicious text
- Learns design from behavior: uses behavioral baselines to model guardrails without parsing system prompts
- Weighs consequences: scores risk by action category and data sensitivity, so blocking focuses on real harm
- Has more than two answers: beyond allow and block, it can confirm, reduce scope, downgrade permissions for the session, or log for review
- Closes the loop: feeds runtime findings into posture management and red teaming.
A practical path to intent-based agent security
Teams don't need all three dimensions on day one. Each stage below is useful on its own, and each builds on the one before it.
Closing thought
Securing agents means moving from inspecting prompts to evaluating intent: whether each action serves the user's goal, fits the agent's design, and is worth the risk. Teams can start with simple, deterministic controls on high-risk actions and add intent and behavioral evaluation as their agent footprint grows.
To see how Harness approaches agent discovery and the agent firewall in practice, check out Harness AI Security.




