How Message Placeholders Work
Define placeholder in prompt template
Create a chat prompt and insert a message placeholder at the desired position. The placeholder is a special message object with The placeholder sits between the system message and final user message, ready to accept chat history at runtime.
type: "placeholder" and a name you’ll reference at runtime.Fetch prompt at runtime
In your application, fetch the prompt using the ABV SDK. The SDK retrieves the template with placeholders intact, ready for compilation.The fetched prompt contains the template structure, including all placeholders and variables.
Compile with message arrays
Use the The SDK injects the
.compile(variables, placeholders) method to resolve both template variables and message placeholders. Pass a dictionary mapping placeholder names to message arrays.chat_history array at the placeholder’s position while resolving the {{criticlevel}} variable.Send compiled messages to LLM
The compiled result is a complete message array ready for the LLM API. ABV handles ordering, role consistency, and variable interpolation automatically.
Best Practices
Use Descriptive Placeholder Names
Use Descriptive Placeholder Names
Name placeholders based on their semantic purpose, not their position.Good:Avoid:Clear names make templates self-documenting and prevent compilation errors.
Validate Message Arrays Before Compilation
Validate Message Arrays Before Compilation
Ensure message arrays passed to placeholders have valid structure (role, content fields) to avoid LLM API errors.This catches errors early rather than failing at the LLM API call.
Order Placeholders Thoughtfully
Order Placeholders Thoughtfully
Place placeholders in the message sequence that matches conversation flow: system context → examples → history → current input.This order matches how conversations naturally unfold and how LLMs process context.
Combine Variables and Placeholders
Combine Variables and Placeholders
Use template variables for simple string substitution and message placeholders for dynamic message arrays.Compilation:This combination provides maximum flexibility for both static and dynamic content.
Handle Empty Placeholders Gracefully
Handle Empty Placeholders Gracefully
Design your application to handle cases where placeholder arrays might be empty (e.g., first message in a conversation has no history).ABV handles empty arrays gracefully—the placeholder simply doesn’t insert any messages. Your prompt template works for both first messages and ongoing conversations.
Implementation Examples
Create Prompt with Placeholders via UI
Create Prompt with Placeholders via UI

- Navigate to Prompt Management in ABV dashboard
- Create a new chat prompt or edit an existing one
- Click Add message placeholder button
- Enter a descriptive
name(e.g.,chat_history,examples) - Position the placeholder in your message sequence
- Save the prompt
Create Prompt with Placeholders via Python SDK
Create Prompt with Placeholders via Python SDK
Install ABV SDK:Create prompt with message placeholder:Fetch and compile at runtime:
Create Prompt with Placeholders via JavaScript/TypeScript SDK
Create Prompt with Placeholders via JavaScript/TypeScript SDK
Install ABV SDK:Set up environment variables:Create Create prompt with placeholder:Fetch and compile at runtime:Alternative: Constructor parameters instead of environment variables:
.env file:.env
Next Steps
Get Started with Prompt Management
Complete quickstart guide for creating, versioning, and deploying prompts
Prompt Data Model
Deep dive into prompt structure, fields, and versioning
Version Control
Deploy and rollback prompts safely using labels and versions
Prompt Composability
Build complex prompts by composing reusable prompt components