AI-agent guardrails

AI agents turn text into actions. Guard what happens between.

An AI agent can read untrusted content, then use tools, edit files, run commands, reach credentials, or send data. Guardrails add checks before those local actions without pretending every instruction can be proven safe.

What is prompt injection?

Prompt injection is text from an untrusted source that tries to make an AI agent follow instructions other than yours. It can hide in a web page, repository, issue, documentation, package, tool response, or project rules file.

It becomes a threat when the agent treats that text as an instruction and uses its tools to run a command, edit a file, read credentials, or send data.

Why are permission prompts not enough?

A permission prompt tells you that an agent can use a tool, not whether its next action belongs to your task. Once broad access is granted, untrusted content the agent reads can influence what it does.

Guardrails consider the context around each action: who started the agent, what it read, which file or credential is involved, and where data is about to go.

Where can guardrails intervene?

Checks can happen at several points, with evidence from each point supporting the final decision.

  • When the agent starts: distinguish one started by you from one launched silently by another process.
  • When it fetches content: inspect untrusted responses before they become agent instructions.
  • When files change: protect credentials, startup settings, agent configuration, and CI workflows.
  • Before tools or commands run: consider the process, command, origin, and intended target.
  • Before data leaves: check where the agent or a related process wants to send it.

Why do project rules need protection?

Coding agents are designed to follow project instructions. Rules files, tool configuration, hooks, and repository guidance can quietly shape what an agent does and remain active across sessions.

Who changed the file and when matters. A developer updating project guidance is expected. An install script adding hidden instructions is not.

Detection is not proof of safety

Prompt injection can be ambiguous, hidden, or outside the available coverage. Guardrails provide an additional layer of safety, but they do not replace reviewing changes, limiting permissions, or protecting credentials.