This technical post walks through the design and implementation of Secure Playground: a local web app that simulates prompt-injection attacks against large language models and demonstrates simple defenses.
Goals
Provide a minimal, reproducible environment to test payloads and defensive strategies.
Make it easy to add new providers and run mutation-based red-team experiments.
Offer a leaderboard and scoring model so defenders can iterate on mitigations.
High-level architecture
Key components
secure_playground/app/engine/agno_pipeline.py — orchestrates a set of agents (prompting, defense, scoring) using an Agno-style pipeline.
secure_playground/app/engine/redteam.py — mutation utilities to create adversarial payload variants.
secure_playground/app/providers/client.py — adapter/factory for OpenAI-compatible clients (OpenAI, Ollama, Featherless).
secure_playground/app/scoring/resilience.py — heuristics that turn model output into a numeric risk score.
Provider integration (example)
Providers are…