Hrida AI Blog

Securing AI Agents: A Five Point Framework for Teams Shipping Agents

A practical framework for securing AI agents, built on Anthropic's five principles for safe and trustworthy agents, with a clear map of what your code must own and what a secure AI gateway like SPRO can enforce on every model call.

← Back to Blog

In April 2026, researchers at Forcepoint X-Labs found instructions hidden in ordinary web content that were written for AI agents, not for people. One told the agent to send $5,000 to a PayPal account. Another told it to delete a backup folder.

Once software can act on what it reads, the security question changes. With a chatbot, you mostly worry about what the model says. With an agent, you have to worry about what the model does, what it reads along the way, and who else gets to steer it.

An agent is only as safe as the controls around each model call and each action it takes.

The good news is that teams do not need to invent a framework from scratch. In August 2025, Anthropic published its framework for developing safe and trustworthy agents, and in April 2026 it followed up with Trustworthy agents in practice. In this post, we turn those five principles into a working checklist, and we show where SPRO helps and where your own agent code has to do the work.


Why Agents Need Their Own Security Plan

Agent attacks are no longer only a research topic. A Cloud Security Alliance research note from April 2026 says indirect prompt injection has crossed the line from proof of concept to live exploitation.

The same note collects some striking findings:

  • Google measured a 32% relative rise in malicious indirect prompt injection content on the web between November 2025 and February 2026.
  • Forcepoint X-Labs verified 10 live payloads. One hid an instruction for a fixed $5,000 PayPal transfer. Another hid a sudo rm -rf command aimed at a backup folder.
  • In the "GrafanaGhost" case, hidden instructions inside log entries led an assistant to leak data through Markdown image rendering.

None of these attacks needed to break into a server. They simply placed text where an agent would read it.

The industry has noticed. In December 2025, OWASP released the Top 10 for Agentic Applications, built with input from more than 100 contributors. Its list starts with Agent Goal Hijack and Tool Misuse and Exploitation, and goes on to cover identity and privilege abuse, memory and context poisoning, cascading failures and rogue agents.

There is also a business cost. Gartner has predicted that over 40% of agentic AI projects will be canceled by the end of 2027, and weak risk controls are part of that story. Security is not only about stopping attacks. It is also how an agent project survives its first real review.


The Framework: Five Points for Securing AI Agents

Anthropic's framework rests on five principles: human control, transparency, alignment with human values and expectations, privacy, and secure interactions. Below, each one becomes a practical question your team can answer.

Five principles for securing AI agents mapped to controls in the agent code and in the SPRO gateway

Figure 1. The five principles, split into what your agent code owns and what SPRO can enforce on every model call.

1. Keep Humans in Control

The question: Can the agent take a high stakes action without a person saying yes?

Anthropic's example is simple. An expense agent should ask before it cancels a software subscription. In Claude Code, the agent is read only by default and must ask before it changes code or systems. In the newer post, Anthropic describes per action settings such as "always allow", "needs approval" and "block".

What your team should do:

  • List every tool your agent can call and mark each one as safe, needs approval, or blocked.
  • Put approval checks in your agent code, not in the prompt. A prompt can be overridden. Code cannot.
  • Set hard limits so that a looping agent stops on its own.

Where SPRO helps: Approvals belong in your agent. SPRO adds the hard stops underneath it. Its Request Limit, Token Usage Limit and Cost Limit guardrails cap how much an agent can call and spend, and alerts such as Error Rate Spike and Low Balance tell you when something is off.

2. Make Agent Behaviour Visible

The question: When an agent does something odd, can you see every step that led there?

Anthropic stresses transparency. Claude Code shows a live to do list, and Plan Mode shows the whole plan up front so a person can review the strategy, not only single steps.

What your team should do:

  • Give every agent run a trace ID and keep it across all of its model calls.
  • Log which model actually answered, and whether a fallback happened.
  • Make traces easy for the person on call to read, not only for the developer who built the agent.

Where SPRO helps: SPRO groups calls into traces with the x-spro-trace-id header and names them with x-spro-trace-name. Each response carries headers such as x-spro-resolved-model and x-spro-attempts, so you know exactly which model served each step. For the OpenAI Agents SDK, SPRO also offers agent trace export (in beta) that stitches spans to usage logs.

from openai import OpenAI

client = OpenAI(
    base_url="https://spro.hridaai.com/v1",
    api_key="spro-xxxxxxxxxxxxxxxx",
)

response = client.chat.completions.create(
    model="<any model id from spro.hridaai.com/models>",
    messages=[{"role": "user", "content": "Summarise today's open tickets."}],
    extra_headers={
        "x-spro-trace-id": "run-2026-11-30-0042",
        "x-spro-trace-name": "support-triage-agent",
    },
)

3. Keep Agents Aligned With What You Meant

The question: Does the agent's output match what you asked for, in the shape you expected?

Anthropic gives a familiar example. Ask an agent to "organise my files", and it may delete files it thinks are duplicates. Its research also found that Claude checks in with users more often on complex tasks, which is the behaviour you want when a goal is unclear.

What your team should do:

  • Write narrow goals and clear success rules for each agent.
  • Validate every structured output before another tool uses it.
  • Treat refusals, apologies and made up facts as signals to log and review.

Where SPRO helps: SPRO's output guardrails check what comes back from the model. Improper Output Handling (JSON) catches broken structured output. Hallucination Detection (experimental) flags answers that may not be grounded. Model Refusal Detection and Model Apology Detection surface steps where the model did not do what you expected.

4. Protect Privacy Across Long Runs

The question: What sensitive data does the agent carry from step to step, and where does it end up?

Agents hold context for a long time. Anthropic notes that an agent may carry sensitive information from one task into another. Its answer for tools is careful access control, such as one time or permanent permission grants for connectors.

What your team should do:

  • Give each agent the least data it needs, for the shortest time.
  • Mask personal and financial data before it reaches a third party model.
  • Decide where prompts and completions are stored, and for how long.

Where SPRO helps: The Sensitive Information Disclosure guardrail detects PII, PHI, financial data and API keys, and can redact them into placeholders such as [EMAIL_ADDRESS] before the model sees them. Zero Data Retention can be turned on per workspace, so prompts and completions are not stored, while usage metadata is still kept for billing. Workspaces keep keys, guardrails and BYOK settings separate for each team or agent.

5. Secure Every Interaction

The question: If a web page, email or log line tells your agent to do something, will it obey?

This is prompt injection, and Anthropic names it as the main threat to agent interactions. Its message is clear: no single defence is enough. It layers model training, monitoring and red teaming, and it advises customers to limit tools, data and permissions.

What your team should do:

  • Treat every tool result and fetched page as untrusted data.
  • Keep powerful tools away from agents that read untrusted content.
  • Add a scanning layer between untrusted text and the model.

Where SPRO helps: When an agent sends what it read back to the model, that text passes through SPRO. Input guardrails such as Invisible / Hidden Text Detection, ASCII Art Attack Detection and Gibberish / Nonsensical Text Detection look for the tricks attackers use to hide instructions. A guardrail set to block returns HTTP 403, so the model never sees the input, and blocked requests use no tokens.


Where SPRO Fits, and Where It Does Not

It helps to be precise. SPRO is an AI gateway. It sits on the path between your agent and the model provider, so it sees every model call, in both directions, across 350+ models from 16+ providers.

  • SPRO can enforce: input and output guardrails on every call, data masking, spend and token limits, Zero Data Retention per workspace, tracing and alerts.
  • Your agent code must own: which tools exist, who approves risky actions, sandboxing, and permissions on the systems the agent touches.

A gateway does not replace good agent design. It gives you one place where every model call is checked, logged and limited, no matter which framework or model a team picks. That is exactly the layer Anthropic means when it says one defence is never enough.


Key Takeaways

  • Agents take actions, so their security plan must cover actions, not only answers.
  • Indirect prompt injection is now seen in the wild, with real payloads aimed at payments and file deletion.
  • Anthropic's five principles give a clear frame: control, transparency, alignment, privacy and secure interactions.
  • Put approvals and tool permissions in code. Put guardrails, masking, limits and tracing on every model call.
  • Layer your defences. No single control stops every attack.

The Bigger Lesson

Teams often ask which model is the safest for agents. It is the wrong first question. The model is only one layer. The harness, the tools and the environment matter just as much, and so does the path every request takes.

Safe agents are not built on trust in one model. They are built on checks around every step.

🚀 Explore SPRO

Ready to put guardrails, masking, limits and tracing around every call your agents make?

SPRO checks every agent request and response in both directions, so your team can ship agents with clear limits and a full trail.

🌐 Learn More

Every model. Every request checked.

HridaAI
Mon Nov 30 2026