Why AgentShield
Why tool-calling agents need an enforcement point outside the model, and the design choices AgentShield makes to provide one.
An autonomous agent turns model output into actions: HTTP requests, refunds, emails, database changes. The model deciding which action to take is also the component most exposed to manipulation. Anything it reads, including a web page, a ticket, an API response, or a retrieved memory, can contain text written to steer it.
AgentShield starts from a simple position: the component that can be manipulated must not be the component that authorizes.
The problem with in-process guardrails
Most agent frameworks run tools inside the same process as the model loop. Safety is added as prompts, output filters, or wrapper functions in that process. Those measures help, but they share the agent's failure modes:
- A compromised prompt is a compromised guard. If the guard is a model instruction, indirect prompt injection can override it.
- The tool function is right there. Any code path that reaches the function, including a framework bug or a misconfigured callback, bypasses the check.
- Credentials live with the agent. API keys in the agent's environment can be exfiltrated by the same injection that misuses the tool.
- There is no independent record. Logs written by the agent describe what the agent says it did.
What changes with a gateway
AgentShield puts a separate process, the runtime gateway, between the agent and every tool.
| Concern | Inside the agent | With AgentShield |
|---|---|---|
| Who decides | Model, prompts, wrapper code | A deterministic policy evaluated by the gateway |
| What a decision is based on | Whatever the agent claims | The authenticated agent and the policies stored for it |
| Who holds tool credentials | The agent process | The gateway, injected per host from its own environment |
| How often a side effect runs | However often the code calls it | At most once per authorized decision |
| Who can approve | Anyone who edits the prompt | A human owner, admin, or approver, never the agent |
| Evidence | Agent logs | Append-only events in a per-organization hash chain |
Design principles
These principles are visible throughout the codebase and the rest of this documentation.
An error is never an allow. A failed policy load, a Redis outage, or an invalid stored document results in a deny or an error response, and the tool is not called. Readiness endpoints return 503 until the dependencies needed for enforcement answer.
Fields such as organization_id in a request body are claims. The gateway identifies the agent from the key that verifies the signature, loads its organization from PostgreSQL, and denies the request if the claim disagrees.
Policy evaluation is a pure function of the active policy documents and the requested action and resource. It does not read the clock, the network, or a model score. Every decision carries the rule that matched and the reason.
Content analysis can flag prompt injection or leaked secrets and open alerts. It never changes allow, deny, or require_approval, and an unavailable analyzer never blocks a call.
An execution is claimed in the database before the adapter runs. A crash, timeout, or failed final write leaves the execution claimed, so a retry is refused instead of repeating the side effect.
Services run as non-root on read-only filesystems with all capabilities dropped. Production mode requires a non-owner database role subject to row level security. Kubernetes manifests apply a default-deny network policy.
What AgentShield is not
AgentShield is an enforcement and evidence layer. It is deliberately honest about its scope:
- It does not make a model immune to prompt injection. It limits what an injected model can do and records what it tried.
- It does not decide whether content is safe. Detection rules produce advice that operators review.
- It does not replace the security of the tools behind it. The
http.requestadapter limits where calls go; the target API still enforces its own authorization.
The threat model lists the assumptions in detail.
Who it is for
- Platform teams running agents for many internal users who need one place to define what agents may do.
- Security teams who need a deterministic control and an audit trail for agent actions.
- Agent developers who want sensitive actions to pause for a human without building an approval system.
Was this page helpful?