AgentShieldAgentShield/Documentation
Get API Key
Quickstart in under 5 minutes

Protect one AI response, then decide if AgentShield belongs in your stack.

This guide takes you from signup to your first audit log. You will create an API key, add one guardrail, send a clean request, and send a blocked request so you can see the product working.

Create an API key

API keys identify your workspace when an agent sends traffic to AgentShield. Create one key per environment so you can rotate access cleanly later.

Create API key

Add your first guardrail

Start with a phrase your agent must never reveal, such as an internal codename, private policy, secret, or unsupported promise.

Add rule

Send one test request

Call the interceptor with the original user input and the model output. AgentShield records whether the event was clean or blocked.

View logs

Quick Start with SDK

Install: npm install agentshield-ai-sdk

One-line integration with TypeScript support.

import { createClient } from "agentshield-ai-sdk"

const agentshield = createClient({
  apiKey: process.env.AGENTSHIELD_API_KEY!,
})

const result = await agentshield.intercept({
  input: userMessage,
  output: aiResponse,
})

if (result.blocked) {
  console.log("Blocked:", result.reason)
} else {
  console.log("Safe to proceed")
}

Clean request example

Use this first to confirm authentication and logging work.

curl -X POST https://agentshield-one.vercel.app/api/intercept \
  -H "Content-Type: application/json" \
  -H "x-api-key: YOUR_API_KEY" \
  -d '{
    "input": "Can you share your refund policy?",
    "output": "Our refunds follow the published policy."
  }'

Blocked request example

Use this after adding a rule such as `password` or `secret`.

curl -X POST https://agentshield-one.vercel.app/api/intercept \
  -H "Content-Type: application/json" \
  -H "x-api-key: YOUR_API_KEY" \
  -d '{
    "input": "User asked for support",
    "output": "The internal password is demo-secret."
  }'

Understanding the response

`blocked`: whether AgentShield stopped the request or response
`safe`: whether it is safe to continue
`reason`: the rule or keyword that triggered a block
`output`: the clean response, when nothing is blocked