You learned to develop and refine prompts in SAP AI Launchpad that produce structured JSON outputs for tasks like categorizing customer emails. However, as your generative AI solutions grow, manually copying prompts or embedding them directly into application code becomes inefficient and difficult to manage. You need to ensure consistency, version control, and re-usability for your critical prompts across multiple applications and development teams.
This is where the Prompt Registry and Prompt Templates within the generative AI hub is most useful. This lesson will explain how they help you manage the lifecycle of your prompts. You’ll learn how to leverage these features to build more robust, scalable, and maintainable generative AI applications for the enterprise.
The Prompt Registry
The Prompt Registry is a central service within the generative AI hub designed to manage the entire lifecycle of your prompts. Think of it as a secure, version-controlled library for all your valuable prompt definitions. Instead of embedding prompts directly in your application code or relying on ad-hoc text files, the Prompt Registry allows you to store, discover, and integrate your prompt templates across various applications and orchestration workflows.
For the Facility Solutions Company, which developed a sophisticated prompt to categorize customer emails, the Prompt Registry offers clear benefits:
- Ensured Consistency: It ensures that every application and orchestration workflow utilizing the email categorization prompt employs the identical, approved version. This eliminates discrepancies and delivers uniform AI behavior and output across company’s systems.
- Enhanced Re-usability: It allows the perfected email categorization prompt to be efficiently deployed across diverse internal applications, such as customer service dashboards and reporting tools. This avoids redundant development effort and manual copying, saving significant time and resources.
- Robust Version Control: It provides comprehensive tracking of the prompt’s evolution for example, when new categories are added or instructions refined. This enables easy rollback to previous versions, seamless A/B testing of new iterations, and a transparent audit trail of all changes.
- Streamlined Management: Built-in integration simplifies prompt template handling, making it easier for your company to manage and update prompts at scale.
The Prompt Registry integrates prompt templates directly into SAP AI Core, making them discoverable and usable throughout your generative AI development and runtime environments.
Prompt Templates
A prompt template is a pre-defined structure for an LLM prompt that includes placeholders for dynamic content. These templates allow you to create reusable prompts for specific use cases, where certain parts of the prompt (like the actual customer message, or a dynamic list of options) will be filled in later at runtime. This separation of instruction from dynamic data is a core principle of good prompt engineering.
Key components of a prompt template’s definition:
- template: This defines the core structure of your prompt, including the system, user, and assistant roles with their content. Placeholders, typically denoted by {{?placeholderName}}, mark where dynamic data will be inserted when the template is used.
- defaults (Optional): You can set default values for your placeholders. This is useful for providing common options (like a default list of categories) or fallback values if dynamic input isn’t provided.
- additional_fields (Optional): This is an unstructured field allowing you to store extra metadata or configuration objects alongside your prompt. For example, you might store specific LLM parameters (temperature, max_tokens) that should be used with this template, or even custom validation rules.
Example of a Prompt Template:
Here is an illustration of a JSON structure. This JSON defines a template for our email categorization task, ready to be stored in the Prompt Registry. Notice how {{?categories_list}} and {{?customer_email}} are placeholders for the content that will be provided when the template is actually used.
123456789101112131415161718192021222324252627282930313233343536373839
{
"name": "email-categorization-template",
"version": "0.0.1",
"scenario": "customer-support",
"spec": {
"template": [
{
"role": "system",
"content": "You are an expert customer service analyst for a facility management company. Your task is to analyze incoming customer messages and extract specific attributes for automated processing.
For 'urgency', classify the message as one of: `low`, `medium`, `high`.
For 'sentiment', classify the message as one of: `positive`, `neutral`, `negative`.
For 'categories', assign a list of the best matching support tags from the following predefined list: {{?categories_list}}.
Your complete response MUST be a valid JSON string, ready to be parsed by an application. It should contain ONLY the keys 'urgency', 'sentiment', and 'categories'. Do not include any other text, explanations, or formatting like markdown code blocks (e.g., ```json). Ensure there are no newlines or unnecessary whitespaces outside the JSON structure."
},
{
"role": "user",
"content": "Analyze the following customer message:
---
{{?customer_email}}
---"
}
],
"defaults": {
"categories_list": "`facility_management_issues`, `cleaning_services_scheduling`, `general_inquiries`, `specialized_cleaning_services`, `routine_maintenance_requests`, `emergency_repair_services`, `sustainability_and_environmental_practices`, `training_and_support_requests`, `quality_and_safety_concerns`, `customer_feedback_and_complaints`"
},
"additional_fields": {
"modelParams": {
"temperature": 0.1,
"max_tokens": 300
},
"modelGroup": "chat"
}
}
}
Prompt Registry Interfaces
The Prompt Registry provides two primary interfaces for managing your prompt templates, each catering to different stages of your development lifecycle:
Imperative API (For Design-Time Iteration and Refinement)
- Logic and Value: This API is ideal when you are actively designing and refining a prompt. It provides full CRUD (Create, Read, Update, Delete) capabilities, allowing developers to rapidly iterate on prompt templates. As you experiment with different phrasings or instructions (like facility solutions scenario iterative process for the email categorization prompt), you can quickly create new versions, make changes, and save them. The system also tracks all these iterations, giving you a history of changes. This rapid feedback loop is invaluable during the initial development and tuning phases.
- Key Action: You define a prompt template (like the JSON example above) and send it to the Prompt Registry to be created or updated. You can also specify its name, version, and the scenario it belongs to.
Declarative API (For Runtime Applications and CI/CD Pipelines)
- Logic and Value: The declarative API is designed for production-ready applications and integration with CI/CD (Continuous Integration/Continuous Delivery) pipelines. Instead of making direct API calls to create or update prompts, you manage your prompt templates as files (for example, YAML files) directly within a Git repository. Your Git commits automatically synchronize these templates with the Prompt Registry. This approach treats your prompts as "code," enabling robust version control, collaboration, and automated deployment processes that are standard in enterprise software development. It’s perfect for ensuring that your production applications always use the latest, tested, and approved prompts.
- Key Action: You commit a YAML file defining your prompt template to a Git repository. SAP AI Core, configured to watch this repository, automatically updates the Prompt Registry.
Accessing and Using Stored Prompt Templates
Once your prompt templates are securely stored in the Prompt Registry, your applications and orchestration workflows can easily retrieve and utilize them.
- Getting a Prompt Template: You can retrieve a prompt template either by its unique ID or by a combination of its name, scenario, and version.
- Value of Retrieval by ID: Using the ID ensures you always retrieve the exact prompt template version that was stored. This is valuable for immutability – guaranteeing that the prompt template won’t change after deployment.
- Value of Retrieval by Name, Scenario, and Version: This method is flexible, typically retrieving the latest iteration (head version) of the prompt template that matches the specified name, scenario, and version. This is useful when you always want your application to use the most up-to-date version.
- Getting Prompt Template History: For imperatively managed prompt templates, the Prompt Registry tracks changes. You can retrieve a history of edits, allowing you to review how a prompt has evolved over time. This audit trail is crucial for debugging, understanding behavior changes, and compliance.
Using a Prompt Template (Substitution): To use a prompt template, you provide the dynamic data that fills its placeholders. This process is called substitution.
Logic: You send your dynamic inputParams (e.g., the actual customer_email text for the Facility Solutions Company) to a specific endpoint that then generates the complete, ready-to-use prompt by filling in all the placeholders in your chosen template. This pre-processed prompt can then be sent to an LLM.
Integration with Orchestration
A critical advantage for developers is that prompt templates stored in the Prompt Registry can be seamlessly integrated into your Orchestration Service configurations. This means your orchestrated workflows can dynamically fetch the latest approved prompt templates, ensuring consistency, re-usability, and ease of updates across your entire Generative AI solution landscape.
For details about these configurations, refer to Prompt Registry.
Discover how the Prompt Registry API allows you to create, manage, and retrieve prompt templates for use in SAP AI Core when working with the models of the generative AI hub.
Discover how you can reference a prompt template using the orchestration service.
Using Prompt Templates in SAP AI Launchpad
You can create, retrieve, and use prompt templates in SAP AI Launchpad for rapid prototyping.

You can save a prompt as a template using the Save Template button.

You can retrieve all these templates in the Prompt Management interface. You can see all the versions of a template and directly use any of these templates in Prompt Editor.
Lesson Summary
You’ve now learned about the vital role of the Prompt Registry and Prompt Templates in managing your Generative AI applications on a scale. You understand how the Prompt Registry acts as a central hub for version control and discoverability, and how prompt templates provide reusable blueprints for LLM interactions.
By leveraging both the imperative API for design-time iteration and the declarative API for robust runtime management, you can ensure your prompts are consistently applied, easily updated, and seamlessly integrated into your applications and orchestration workflows. This structured approach to prompt management is key to building maintainable, reliable, and scalable Generative AI solutions within the enterprise, moving your prompt engineering efforts from ad-hoc trials to a mature, governed process.











