Runtime security for AI agents
Put the decision where the action is
Block prompt injection, stop PII leaks, add guardrails to tools, APIs, and database calls, and block bots. Security & governance for AI agents.
1. Run: npx skills add arcjet/skills
2. Add Arcjet protection to my appNative SDKs and AI agent framework integrations
01 – the problem
Identity tells you who is asking.It cannot tell you what happens next.
How do I stop an AI agent from taking an unsafe or unauthorized action? You can't just ask this at the door, it has to be answered at every step.
Action 1
Read inbound support email – from a known address with a new cc email
Action 2
Query the customer database – returns names, emails, bank account...
Action 3
Send a reply – to the address in the original message, and the new one cc'd
Arcjet applies security policies across the sequence
Result
Unexpected personal data is emailed
without Arcjet
Risks in a single step are amplified across a workflow.
What your other controls miss
A prompt scanner sees tokens.
A gateway sees a packet.
A dashboard sees yesterday.
The action that actually makes the call is the new boundary.
Unauthorized tool calls
The request looks clean. Then the workflow issues a refund, opens a file share, or hits an internal API that was never in scope for this user. Arcjet enforces at the action boundary, inputs and outputs.
Data exfiltration
Sensitive data, including PII, slips out through prompts, tool outputs and third party calls. It rarely looks like theft at the moment it happens. Check inputs to stop leaking PII into the LLM context, and outputs before they're sent out.
Cost explosion
A runaway loop can burn a month of token budget in an afternoon. Without enforcement in the path, the first anyone hears about it is the invoice. Arcjet holds the quota in the loop itself.
Sequence drift
An agent that started a session reading records ends it writing to production. No single step crossed a line. Arcjet is judging the shape of each run over time, so the drift itself is the thing that trips the rule.
02 – how it works
Observe. Enforce. Audit.
Find everything, enforce policies, and prove you did.
IObserve
Every action an agent takes is captured and linked to sequences and session runs. Context is preserved throughout.
Sees: user, session, route, actor, tool label, typed arguments, prior steps
IIEnforce
Enforce policies at the action boundary. Deterministic checks executed in real-time and implemented in OPA/Rego. Checks: prompt injection, sensitive info, tool guards, MCP allowlists, bot signals, action policy, run history.
Returns: allow, block, redact, hold for review
IIIAudit
Every decision and the context behind it is kept as evidence, and available for auditing at any time. Pipe everything into your SIEM for detection and alerting.
Keeps: decisions, policy version, actor, inputs, run history
03 – the controls
What Arcjet enforces
Stop coding agents from making unsafe or unintended actions.
Return typed decisions to custom agents for handling before execution.
Protect web applications from abuse.
Prompt injection detection
Catch hostile instructions in user input, API responses, and tool output, before either reaches the model.
const arcjet = launchArcjet({ key: process.env.ARCJET_KEY!,});const injection = detectPromptInjection();
// What the user typed, and// what the agent's tool// fetchedconst page = await fetchPage(url);const decision = await arcjet.guard({ label: "agent.research", rules: [ injection(userMessage), injection(page.text), ], });
// Your callif ( decision.conclusion === "DENY") { return;}Agent tool controls
Scope what every agent may do by identity, role, route and typed input, then enforce it at the moment the tool is called rather than in the prompt that asks for it.
const arcjet = launchArcjet({ key: process.env.ARCJET_KEY!,});
// Wrap your agent tool callconst refund = guardTool( arcjet, refundTool, { action: "order.refunded", actor: user.id, inputs: ({ amount }) => ({ amount: policyInput.server .number(amount), role: policyInput.server .string(user.role), }), },);// on DENY, refundTool never runsSensitive information and Data Loss Prevention (DLP)
Strip names, addresses, national IDs, bank and card numbers before they reach model context, logs, or a third party tool.
const arcjet = launchArcjet({ key: process.env.ARCJET_KEY!,});// rampart() detects on device:// names, addresses, IDs, bankingconst pii = localDetectSensitiveInfo({ backend: rampart(), });
// Screen the record before it// becomes context or a tool callconst decision = await arcjet.guard({ label: "agent.support", rules: [pii(ticket.notes)], });
if ( decision.conclusion === "DENY") { return strip(ticket.notes);}Token and spend budgets
Cap tokens and calls per user, per org, and per agent. The budget belongs to the run, so a loop cannot spend it four times over by touching four different endpoints.
const arcjet = launchArcjet({ key: process.env.ARCJET_KEY!,});const budget = tokenBucket({ refillRate: 2_000, intervalSeconds: 3600, maxTokens: 5_000,});
// One budget per user, org,// or agent run — not per// endpointconst decision = await arcjet.guard({ label: "agent.run", actor: user.id, rules: [budget({ key: user.id, requested: estimatedTokens, })], });// DENY when it is spent,// before the model callBots and the classic surface
The AI stack still runs on HTTP. Shield WAF, bot detection with real time threat feeds across 25 tracked categories, email validation and signup protection, all from the same client and the same decision object.
const aj = arcjet({ rules: [ shield({ mode: "LIVE" }), detectBot({ mode: "LIVE", allow: [], }), validateEmail({ mode: "LIVE", deny: ["DISPOSABLE"], }), ],});
// Same decision object as// the agent guardsconst decision = await aj.protect(req, { email, });// Your callif (decision.isDenied()) return;04 – policy
Two routes to policy. Use both.
Engineers want rules in the repo, reviewed and tested like everything else. Security teams need to change policy without waiting for a release. Arcjet splits the policy from the inputs so both are true at once.
I – Owned by engineering
Rules in code
Rules live next to the handler they protect. They go through review, they are covered by tests, and they ship on your normal release path.
- 20 native SDKs & framework integrations
- Version controlled and diffable
- Unit testable with helpers for captured actions
- Dry run mode before anything blocks
II – Owned by security
Remote policies
Policy is managed in the cloud and takes effect immediately. Engineering supplies the inputs and handles the result. Nobody has to open a pull request to tighten a rule.
- Change policy in real time, no code deploy
- Consistent across every service and workflow
- Model the blast radius before you turn it on
- Every decision recorded, audit ready
05 – position
An import you ship this afternoonNot a control plane to roll out
No gateway, no proxy, no migration to get there – let your coding agent set it up. Arcjet runs in the code you already deploy, so your failure domain doesn't grow and coverage rolls out service by service.
Context is the thing you lose on the way out.
Anything in front of your application sees traffic. It does not see the function that moves the money, the arguments about to be passed to it, or the three steps that made this one risky.
Arcjet sees the arguments
A refund of $12,000 and a refund of $12 look the same from the network.
Arcjet works everywhere
Coding agents, queue consumers, scheduled jobs, and workflow steps. They all take actions.
Nothing new to keep alive
No sidecars or containers to run. Nothing to try to scale at 3am. Arcjet works through Coding agent hooks and SDK integrations in-code.
Network edgeSees packets
GatewayAllow/Deny
DashboardsAfter the fact
ArcjetSees the action
06 – proof
Ready for your stackwhatever and wherever you run.
LLM and framework agnostic. Deploy through coding agent hooks, OTel, provider integration, AI framework integrations, and native SDKs.
SOC 2
Type II, unqualified opinion.Security, availability and confidentiality.
< 1ms
Local decision overhead.20 to 30ms when the cloud API is needed.
20 SDKs
Claude Code, Codex, Copilot, JavaScript, Python and Go, across AI frameworks and runtimes.
600+
Bot types detected across 25 categories, without serving a CAPTCHA.
Evidence stored in Arcjet cloud, single tenant, private VPC, or your own storage.
Full detail on the trust page07 – FAQ
Frequently Asked Questions
Put the decisionwhere the action is
Add Arcjet to one route or one tool handler and watch it in dry run. Nothing blocks until you say so, and you get to see the decisions before you trust them.
1. Run: npx skills add arcjet/skills
2. Add Arcjet protection to my app














