Mitigate Prompt Injection with Workflow Guardrails
Explore how to design AI workflows that resist prompt injection by applying multiple guardrails including delimiting untrusted input, enforcing structured outputs, validating actions, allowing only approved tools, and requiring human approvals. Understand the layered defenses that keep workflows reliable and secure under adversarial conditions.
We'll cover the following...
A support workflow that ingests external email text has clear constraints. Classification and routing must stay above 95% correct on a held out set, end to end latency must stay under 2 seconds for automated steps, and the prompt plus retrieved context must fit within an 8k token context length budget. The system must stay under a $0.01 cost ceiling per email on average, and policy changes must ship weekly without retraining.
With those constraints, the risky design is the one that passes raw email text straight into generation and then executes whatever action the model proposes. A safer design fences the email as data, forces schema shaped outputs, allowlists tools, and gates side effects behind approvals. Prompt injection is the behavior where the output follows instructions embedded in the untrusted email that conflict with workflow rules.
This lesson assembles prompt level defenses and tool enforcement into workflow controls so no single layer has to be perfect. Where the earlier safety drill traced one bypass attempt through the ...