AWS Builder Center

AgentShield: An Edge Firewall for AI Agents

A hackathon project on stopping autonomous browser agents at the edge — before they ever hit the backend.

AI agents no longer just scrape data — they run real browsers, execute JavaScript, and fill out forms, looking exactly like a human on Chrome. For a Next.js app on Vercel, a single rogue agent looping overnight can fire thousands of serverless invocations and drain database capacity before anyone notices. Standard firewalls check headers and IPs, both easily spoofed. AgentShield was built at the H0: Hack the Zero Stack Hackathon (Track 2: Monetizable B2B App) to judge agents by behavior instead.

How it works

AgentShield scores every visitor in real time using three independent behavioral signals:
  • Honeypot trap — an invisible input field, off-screen and unreachable by real users. Scripts that parse and interact with every form element on the DOM trigger it instantly.
  • Keystroke uniformity — humans type with natural rhythm variance; automated form-fillers often fire keys at near-fixed intervals. Standard deviation of keystroke gaps gives that away.
  • Mouse path linearity — human mouse movement is curved and noisy; the path length is always longer than the straight-line distance between start and end. Bots moving in a near-perfect line produce a ratio close to 1.
Any single signal can flag a session; all three combine into one composite score. Once a session crosses the threshold, its IP is written to a blocklist, and Vercel Edge Middleware enforces the block globally, returning a 403 before the request reaches a serverless function.

Where AWS comes in

Session data and the blocklist live in a single-table DynamoDB design:
PK
SK
Attributes
SITE#<domain>
SESSION#<sessionId>
honeypotTriggered, keystrokeScore, mouseScore, compositeScore, ip, timestamp
SITE#<domain>
BLOCKLIST#<ip>
blockedAt, reason
A live dashboard reads from the same table, showing real-time scores with a one-click unblock control.

Validation

A Playwright bot script simulates the kind of agent AgentShield is meant to catch — straight-line mouse movement, zero-variance keystrokes — confirming detection and blocking happen automatically.
The whole stack runs on free tiers (Vercel Hobby, DynamoDB Free Tier), proving the concept before it costs anything.


Built for the H0: Hack the Zero Stack Hackathon. Code :  https://github.com/SuchithraChandrasekaran/agentshield 
Any opinions in this article are those of the individual author and may not reflect the opinions of AWS.
Enjoyed reading this content? Let the author know!

Your likes, comments, shares, and saves help creators reach more builders.

Loading recommendations

Loading article