Skip to content
47% off: the complete course for $79 (reg. $149)Order now →
AI Builder

AI builder glossary

Prompt template

A reusable prompt with placeholders that your code fills with per-request data, such as a ticket, user details, or retrieved documents, at runtime.

Real features don't send hand-typed prompts. They send a template, a fixed structure of instructions with slots that your code fills on each request: the user's message, the record being processed, search results, today's date. The template is the part you design and test; the variables change every call.

Good templates separate instructions from data clearly, usually with labeled sections or XML-style tags, so the model can tell which text is a command and which is material to work on. They also keep the stable parts first and the variable parts last, which lets prompt caching reuse the prefix.

The big risk is interpolation. When you paste user-controlled text into a template, that text can contain instructions of its own, and naive string building can let a document or message steer the model. Delimiters help the model keep things apart, but they are not a security control on their own; you still need permission checks and output validation in code.

Treat templates as product code: store them in version control, give them names and versions, and log which version produced each output so you can trace a regression back to the change that caused it.

Example

A summarization template wraps each request's ticket text in a ticket tag, adds the customer's plan in an account tag, and puts both after the fixed instructions, so the cached prefix stays identical across thousands of calls.

Learn more in the course

Related terms

Go from definitions to doing

Learn to build AI-powered apps in 132 practical lessons.