Prompt-Injection Defense for Production LangGraph Agents by Suryansh ChaudharyPrompt-Injection Defense for Production LangGraph Agents by Suryansh Chaudhary

Prompt-Injection Defense for Production LangGraph Agents

Portfolio project
Suryansh Chaudhary
My role: AI Engineer. I handled threat modelling, guardrail design and evaluation.

The problem

Production LLM agents can leak their system prompts. Prompt injection isn't one problem, so one fix isn't enough.

What I built

Hard gates: deterministic checks that block known injection patterns before they reach the model
Soft gate: an LLM-as-judge that evaluates unclear inputs at runtime
Refusal hardening: I found that the agent's refusal message itself leaked prompt contents, so refusals became part of the threat model
Stack: LangGraph, LangChain, Python
I documented the whole build publicly at suryansh.work.

0 likes · 1 view · Nov 28, 2026

Layered prompt-injection defense for a production LangGraph agent: deterministic hard gates, an LLM-as-judge soft gate, and leak-proof refusals.

Tags