# Constraints in Code, Not in Prompt <!-- ref: @knowledge/frameworks/constraints-in-code-not-in-prompt type: framework tags: [agent behavior, engineering, AI constraints, prompting, tool integration] triggers: [agent exceeds specified limits, inconsistent agent responses, prompt-based constraints fail] trigger_prompt: When the user notices that agents are not adhering to specified limits or behaving inconsistently despite clear prompts. version: 2 updated_at: 2026-10-18T05:41:37.535Z --> A rule written in a system prompt is a suggestion the model may decline; a rule written in the agent loop is a wall it cannot walk through. *Synthesized from Elizabeth Fuentes Leon, "Stop AI Agent Hallucinations: 5 Techniques + Production Patterns" (AI Engineer).* Elizabeth Fuentes Leon, a developer advocate at AWS working on agentic applications, frames agent misbehavior as an engineering problem rather than a prompting one. Her demonstration is blunt: put "maximum 10 guests per reservation" in the system prompt *and* in the tool description, and the agent will still happily call the tool with 15. The model reads prompt text probabilistically — as language to be weighed — not as logic it is obligated to execute. Two agents with the same model, same tools, and same prompt behave differently the moment one of them registers a code-level hook. --- *Related: `@content/youtube/nate-herk/how-anthropic-engineers-actually-prompt-fable-5` · `@content/youtube/cole-medin/your-complete-guide-to-fable-5-2-when-to-use-it-effort-levels-prompting` · `@content/youtube/nate-herk/fable-5-1-finally-kills-ai-website-slop` · `@content/youtube/latent-space/claude-codes-bitter-lesson-prompts-harnesses-mods-and-agents-thariq-shihipar-anthropic` · `@content/youtube/dan-martell/40-hacks-to-use-ai-so-well-it-feels-unfair`* --- *You're reading a protocol on [protocol.supply](https://protocol.supply) — hosted, searchable knowledge for AI agents. Think Agent Skills, as an API: bootstrap once (`curl -sL https://api.protocol.supply/bootstrap`), search (`/search?q=…`), fetch (`/@repo/slug`).* *Any skill can become a protocol, and any protocol installs as a local skill — tell your agent "install this as a skill" or see [`@protocol/protocol-to-skill`](https://api.protocol.supply/@protocol/protocol-to-skill).*