Skip to content

7500: AI Agent Security

⏱ 5 min read·📅 Last updated: 2026-10-22

Module Overview

This module covers security and safety considerations for AI agents, including prompt injection defense, PII redaction, and protection against adversarial attacks. You'll learn to build secure, trustworthy agent systems.

Why This Matters:

  • Agents are high-value targets for attacks
  • Prompt injection can leak sensitive data
  • PII exposure has legal and ethical implications
  • Security is critical for production deployment

Learning Objectives

After completing this module, you will be able to:

  • Prompt Injection Defense: Identify and prevent injection attacks
  • PII Redaction: Automatically redact sensitive information
  • Adversarial Defense: Protect against malicious inputs
  • Abuse Prevention: Throttle, authenticate, and monitor agent traffic
  • Secure Design: Build security-first agent systems
  • Compliance: Meet privacy and security regulations
  • Deterministic Testing: Pin decoding for reproducible security tests

Module Contents

7501: Prompt Injection Defense

Protecting Against Malicious Prompts

  • Prompt injection taxonomy
  • Attack vectors
  • Defense strategies and defense in depth
  • Testing
  • The security checklist

Experiments:

  • Implement injection detector
  • Build input sanitizer
  • Create output filter
  • Test with adversarial prompts

7502: PII Redaction

Sensitive Information Protection

  • PII categories
  • Detection
  • Redaction
  • Secure handling
  • Production deployment and testing

Experiments:

  • Build PII detector
  • Implement redaction system
  • Create compliance reports
  • Test with real data

7503: Adversarial Attacks

Understanding and Defending Against Attacks

  • Attack types
  • Common attack methods
  • Defenses
  • Robustness evaluation
  • Production considerations

Experiments:

  • Simulate adversarial attacks
  • Test defense mechanisms
  • Build monitoring system
  • Create response playbook

7504: Agent Abuse Prevention and Identity Threats

Sustained Abuse and Identity Threat Mechanics

  • Rate limiting shapes: fixed window vs token bucket
  • Agent identity: signed envelopes and replay protection
  • Egress beacon detection and payload entropy signals
  • Defense in depth on one campaign

Experiments:

  • Break a fixed-window limiter at the seam
  • Forge an agent identity on an unsigned bus
  • Detect beacon periodicity with the coefficient of variation
  • Run the composed campaign pipeline

7505: Temperature Zero and Deterministic Security Testing

Deterministic Decoding for Reproducible Security Tests

  • The decoding fork: softmax temperature mechanics and the argmax limit at T=0
  • The flapping suite: identical-code runs split 33 red / 17 green at serving temperature
  • What temperature zero does not buy: batch noise and the provider fingerprint bump
  • The pass@k fix: estimator variance and the std x sqrt(k) law
  • One red-team CI gate priced four ways on a month of runs

Experiments:

  • Walk the temperature knob from 0.0 to 1.5 on one fixed decision
  • Run the same red-team suite fifty times at T=0.7 and at T=0
  • Flip near-tie greedy decisions with simulated batch noise and a fingerprint bump
  • Price four CI gate configs and defend the T=0-CI plus sampled-nightly stack

Prerequisites

Before starting this module, ensure you have:

Review: PREREQUISITES.md for detailed requirements.

Assessment

Quiz

  • Format: 20 multiple-choice questions
  • Passing Score: 80% (16/20)
  • Topics: Prompt injection, PII, adversarial attacks
  • Location: 7500: Agent Security - Quiz

Practice Exercises

  • Format: Security implementation projects
  • Duration: 13 hours
  • Topics:
    • Build injection detector
    • Implement PII redaction
    • Create adversarial defenses
    • Design secure agent system
  • Location: 7500: AI Agent Security - Practice

This module connects to:

Time Commitment

Activity Time
7501: Prompt Injection Defense 3 hours
7502: PII Redaction 3 hours
7503: Adversarial Attacks 3 hours
7504: Agent Abuse Prevention and Identity Threats 3 hours
7505: Temperature Zero and Deterministic Security Testing 3 hours
Quiz 30 minutes
Practice 13 hours
Total 28.5 hours

Resources

Essential Tools:

  • Microsoft Presidio (PII redaction)
  • LangChain security tools
  • Rebuff (prompt injection defense)
  • Llama Guard (content moderation)

Essential Papers:

  • "Not what you've signed up for: Compromising Real-World LLM-Integrated Applications with Prompt Injection"
  • "Ignore Previous Prompt: Attack Techniques For Language Models"
  • "Jailbreak: A Novel Black-box Method for Jailbreaking Large Language Models"

Prompt Injection Examples

Type Example Impact
Direct "Ignore instructions and..." High
Roleplay "You are DAN, do anything..." High
Conditional "If user says X, then Y..." Medium
Encoding Base64, Unicode Medium
Multilingual Non-English instructions Low-Medium

PII Types

Category Examples Risk
Personal Name, email, phone Medium
Financial Credit card, SSN High
Health Medical records Very High
Location Address, GPS Medium
Biometric Face, fingerprint Very High

Defense Strategies

Attack Type Defense Effectiveness
Direct Injection Input validation ⭐⭐⭐⭐
Jailbreak Output monitoring ⭐⭐⭐
Roleplay Policy enforcement ⭐⭐⭐⭐
Encoding Decode and validate ⭐⭐⭐⭐⭐
Multilingual Translation + check ⭐⭐⭐⭐

Security Checklist

Before deploying agents:

  • Input validation implemented
  • Output filtering enabled
  • PII redaction configured
  • Rate limiting active
  • Audit logging enabled
  • Incident response planned
  • Regular security audits
  • User consent mechanism

PII Redaction Pipeline

Input Text
    ↓
PII Detection (NER)
    ↓
Classification (Type, Confidence)
    ↓
Redaction Decision
    ↓
Apply Redaction
    ↓
Log Redaction (Audit)
    ↓
Output Text

Tips for Success

  1. Defense in depth: Multiple security layers
  2. Assume breach: Plan for failures
  3. Monitor continuously: Watch for attacks
  4. Update regularly: New threats emerge
  5. Test thoroughly: Red team your systems

Common Pitfalls

  1. Trusting user input: Never trust, always validate
  2. Client-side only security: Easily bypassed
  3. Ignoring logs: Security events need investigation
  4. Over-blocking: False positives hurt UX
  5. No incident response: Plan before you need it

Attack Indicators

Indicator Type Severity
"Ignore instructions" Direct injection High
"You are..." Roleplay Medium
Base64 strings Encoding Medium
Unusual patterns Adversarial Low-Medium
Repetitive attempts Brute force High

When to Apply Security

Scenario Security Level
Internal tool Standard
Customer-facing High
Healthcare data Very High
Financial data Very High
Public API Maximum

Compliance Requirements

Regulation Scope Requirements
GDPR EU Data protection, right to erasure
HIPAA US health PHI protection, audit logs
CCPA California Privacy rights, opt-out
SOC 2 Global Security controls, audits

Phase 7 Complete! 🎉

Previous Module: 7400: Agent Memory Systems

Questions? Review the PREREQUISITES.md or check Phase 7 documentation.