Prompt security
Prompt security is the practice of structuring and constraining model inputs to reduce unsafe behavior and protect against attacks delivered through prompts or other inputs.
AI Agents and Applications
A safe prompt is an instruction that restricts a language model to supplied information and directs it to acknowledge when an answer is unavailable.
- How it is used
- Reduces the chance of hallucinations in Q&A chatbots answering from supplied text.
- How deep it goes
- Defines a brief instruction and demonstrates it with a factual question about information missing from the supplied text.
- Examples
- Uses a question about the total columns in three temples, where the text does not give the answer.
- What you can do after
- Apply it via an instruction to rely only on supplied information and acknowledge when the answer is unavailable.
Read how AI Agents and Applications explains prompt security →
Prompt Engineering in Practice
Prompt security is the practice of protecting model behavior and sensitive information from attacks delivered through prompts or other model inputs.
- How it is used
- Protects model behavior and sensitive information by treating prompt design as a security control.
- How deep it goes
- Explains trusted versus untrusted input, three attack patterns, and prompt hardening, then identifies limits of prompt-only defenses.
- Examples
- Demonstrates a user instruction that coaxes a chatbot to reveal customer names, addresses, and contact details.
- What you can do after
- Apply it via prompt design to reduce prompt-level risks, and withhold sensitive data from context when disclosure must be prevented.
Read how Prompt Engineering in Practice explains prompt security →
Related concepts
- prompt engineeringuses · Prompt engineering is the deliberate design and refinement of instructions, context, examples, or other inputs to guide an AI model’s behavior or outputs.
- hallucinationaddresses · A hallucination is model-generated content that is false, fabricated, or unsupported by relevant evidence but presented as plausible or factual.
- system-level responsecontrasts with · A system-level response is a mitigation implemented in surrounding software, infrastructure, permissions, or operational controls rather than solely in prompt instructions.
- failure modeaddresses · A failure mode is a distinct way in which a system, component, process, or operation can fail or produce an undesirable result.
These guides are generated from the text of Manning books by Manning's knowledge graph and link to the sections they draw on. The full books are available on liveBook and at manning.com.

