Prompt Builder & Template Testing
Test and preview your prompt templates with live execution, see exactly what the AI receives, and track template performance over time.

The Problemโ
Building effective prompts requires rapid iteration, testing with real variables, and understanding how prompts perform in production.
Teams need to:
- ๐งช Test Before Deploying: Preview prompts with sample data before agents use them
- ๐ Debug Variable Issues: See how variables are populated in the final prompt
- ๐ Track Performance: Know which templates work best and why
- ๐ฏ Validate Inputs: Ensure required fields are properly defined
- ๐ Monitor Usage: See how often templates are called and their token costs
- ๐ Version Management: Track changes across template versions
In short: You need a safe environment to test prompts, verify variable substitution, and monitor real-world performance.
How GenAI Explorer Solves Thisโ
GenAI Explorer provides complete prompt testing with:
โ Live Preview: Test templates instantly
- Fill in variables with test data
- Execute against real AI models
- See the actual LLM response
- Verify token counts
โ Variable Editor: Interactive input form
- Auto-generated from template schema
- Type-safe input validation
- Required field indicators
- Default value support
โ Template Inspector: See the final prompt
- View complete prompt text
- Verify variable substitution
- Check formatting and structure
- Copy for external testing
โ Execution History: Track real usage
- Last 10 executions from production
- Token usage per call
- Response times
- Model and version info
โ Version Comparison: Test different versions
- See what changed between versions
- Compare performance metrics
- Validate before activation
Impact: Test prompts safely, catch variable issues before production, and optimize token usage with real data.
How It Worksโ
Quick Startโ
Step 1: Open a Templateโ
GenAI Explorer โ Object List โ Search "GenAiPromptTemplate" โ Select Template
Step 2: Test Your Templateโ
- Review the template content in the editor
- Fill in the variable form with test data
- Click "Preview Template"
- Review the generated output
- Check token count
Step 3: View Historyโ
- Scroll to "Execution History" panel
- Click on any execution to see details
- Review variables used
- Check response quality
Key Featuresโ
Execution Historyโ
Track the last 10 executions from production with token costs and performance metrics.
See: Execution History for monitoring guide
Token Optimizationโ
Analyze token usage across versions and identify cost reduction opportunities.
See: Token Optimization for strategies
Common Use Casesโ
1. Testing Before Deploymentโ
Test your template with sample data, verify variable substitution, and check output quality before activating.
2. Debugging Variable Issuesโ
When agents get wrong data, check execution history to see actual variable values and identify issues.
3. Optimizing Token Usageโ
Review history to find high-token executions and optimize template length for cost savings.
4. Version Comparisonโ
Compare token counts and performance between template versions before switching.
5. Prompt Engineeringโ
Rapidly iterate on prompts, test variations, and monitor consistency across multiple runs.
UI Componentsโ
Template Editorโ
- Syntax Highlighting: Easy to read template syntax
- Read-Only View: See the template structure
- Variable Markers:
{!Variable_Name}clearly highlighted
Input Formโ
- Auto-Generated: Built from template schema
- Type Validation: Correct input types enforced
- Required Indicators: * marks required fields
- Default Values: Pre-populated where defined
Execution Historyโ
- Last 10 Calls: Most recent production usage
- Version Badge: Which template version was used
- Token Count: Cost visibility
- User Info: Who triggered the execution
- Expandable Details: Full request/response
Template Structureโ
Metadata Fieldsโ
| Field | Description |
|---|---|
developerName | API name of template |
masterLabel | Display name |
description | What the template does |
activeVersionIdentifier | Current active version |
type | Template type |
visibility | Who can use it |
Version Fieldsโ
| Field | Description |
|---|---|
versionIdentifier | Version number |
content | Template text |
inputs | Variable definitions |
primaryModel | AI model to use |
status | Active/Draft/Archived |
Documentationโ
Guidesโ
- Testing Templates - Complete testing workflow
- Execution History - Tracking and monitoring
- Token Optimization - Reducing costs
- Best Practices - Testing & deployment tips
Related Featuresโ
- Einstein Model Testing - Test individual models
- Data Cloud Integration - Query execution data
- Chat with Agents - Test in agent context
FAQsโ
Q: Can I edit templates in GenAI Explorer?
A: No, GenAI Explorer is read-only. Use Salesforce Setup to edit templates.
Q: How many executions are stored in history?
A: The last 10 executions are shown. Full history is in Data Cloud.
Q: Does preview count against my AI credits?
A: Yes, preview executions use real AI calls and count toward your limits.
Q: Can I test with production data?
A: Yes, if you have access. Use caution with sensitive data.
Q: What if a required variable is missing?
A: The preview will fail with a validation error.
Test prompts safely, catch issues early, and optimize for production success.