Software Tools

Securing AI Agents from the Inside: A Step-by-Step Guide to Deploying Arcjet Guards

2026-05-11 11:40:53

Introduction

As artificial intelligence agents take over more application logic—reading files, fetching web pages, processing queue messages—traditional security tools built around HTTP boundaries are no longer effective. Web application firewalls (WAFs), proxies, and middleware assume a request boundary exists, but modern agentic systems operate through tool calls, queue consumers, and workflow steps that never touch an HTTP request. This leaves a critical gap: untrusted input arrives as function arguments, not request bodies, and security context like identity, session, and budget is invisible to external gateways. Arcjet, a runtime security company, addresses this with its Guards capability, which enforces security policy directly inside agent tool handlers, queue consumers, and workflow steps. This guide walks you through deploying Arcjet Guards to protect your agentic systems from prompt injection, data exfiltration, and other risks that bypass traditional defenses.

Securing AI Agents from the Inside: A Step-by-Step Guide to Deploying Arcjet Guards
Source: thenewstack.io

What You Need

Step-by-Step Guide to Deploying Arcjet Guards

Step 1: Identify Untrusted Input Points in Your Agentic System

Begin by mapping all entry points where untrusted data enters your agent. These include:

Note that these inputs never cross a network boundary visible to a WAF or proxy. For example, a prompt injection can occur when an agent fetches a malicious webpage that instructs it to send content to an attacker—a WAF protecting the chat interface upstream sees nothing because the fetch happens server-side inside the tool call. Document each input point and its associated risk (e.g., data exfiltration, unauthorized actions).

Step 2: Integrate the Arcjet SDK into Your Project

Add the Arcjet SDK to your application. The SDK provides the framework for defining and enforcing security rules inline with your code. Follow the official installation instructions:

  1. Run your package manager to install @arcjet/sdk (or equivalent for your language).
  2. Initialize the SDK with your Arcjet API key in your application bootstrapping code.
  3. Ensure the SDK is imported in every module that contains untrusted input handlers.

Arcjet’s model is “security lives where the code lives,” so placing the SDK in each relevant file aligns with your existing pull request and code review workflows.

Step 3: Define Security Rules Closest to the Input

Use Arcjet’s rule definitions to specify what should be checked. For each untrusted input point, decide what policies to apply. Common rules include:

Write these rules as code within the same file as your tool handler. For example, if a tool reads a web page, define a rule that checks the fetched URL against a blocklist before processing the content. This makes protection explicit and reviewable in every pull request.

Step 4: Place Guards Inside Tool Handlers, Queue Consumers, and Workflow Steps

Now implement the actual guard. For each identified input point, wrap the input handling logic with an Arcjet guard call. The guard intercepts the untrusted input, evaluates it against your defined rules, and either allows the operation to proceed or rejects it with a clear error.

// Example (pseudo-code):
function fetchWebsite(url) {
  // Arcjet guard evaluates URL against allow/block list and budget
  if (!arcjet.check({ input: url, context: { userId, session } })) {
    throw new SecurityException("Blocked by Arcjet Guard");
  }
  // Proceed with actual fetch
}

For queue consumers, place the guard immediately after retrieving the message. For multi-agent pipelines, add guards at each step transition where state is passed. The key is that the enforcement point moves to where untrusted input arrives—inside the application, where full context (identity, business logic, budget) is available.

Securing AI Agents from the Inside: A Step-by-Step Guide to Deploying Arcjet Guards
Source: thenewstack.io

Step 5: Test with Real-World Attack Scenarios

Simulate attacks that bypass traditional proxies. For instance:

Document test results and adjust rules as needed. Remember: the guard sees the full context (identity, session, budget) that a proxy cannot.

Step 6: Deploy and Monitor with Code Review

Because guards are defined in code alongside features, they become part of your normal deployment pipeline. When you create a pull request, the guard rules are reviewed together with the feature logic. This ensures security policies evolve with the application. After deployment, monitor logs from Arcjet for blocked events and adjust rules based on false positives or emerging threats.

Continuously update the input points as your agentic system grows. If new tool handlers, queue consumers, or workflow steps are added, follow steps 1–5 to integrate guards. This proactive approach keeps your security posture aligned with the expanding attack surface.

Tips for Success with Arcjet Guards

By following these steps, you shift security from the perimeter to the point of action, closing the gap that traditional WAFs and proxies cannot address. Arcjet Guards empower you to protect your agentic applications from the inside out.

Explore

From 80 Days to 5: How Banco Bradesco Transformed Infrastructure Delivery with HCP Terraform Orchestration Windows 11's April Update: Unforeseen Impacts on Backup Software Understanding GRASP: A Robust Approach to Long-Horizon Planning with World Models Unlocking Hearing Health: A Comprehensive Guide to Apple's AirPods Features Backed by New Research Massachusetts Locks in $1.4 Billion in Savings Through Offshore Wind Contracts