v2026.1 Open Portal ↗
On this page

Prompt Templates

Template System

StackFlow's prompt template system allows administrators and AI engineers to customize the instructions given to LLMs for every AI task in the platform. Templates are stored in Aurora PostgreSQL and versioned — changes create new template versions while existing AI interactions continue using their version until explicitly upgraded. Templates support Jinja2-style variable interpolation.

⚙️ Minimum Requirements
  • DynamoDB: StackFlow_PromptTemplate table with at least one record for each AI feature in use (triage, remediation, KB search)
  • Required Templates: incident-triage-v1, kb-rag-answer-v1, change-risk-assessment-v1 must exist
  • IAM: StackFlowAPIRole with dynamodb:GetItem on StackFlow_PromptTemplate
  • Versioning: Template updates must increment version attribute; old versions retained for audit

Built-in Templates

Template NameTaskEditable
incident_triage_systemIncident classification and routingYes
article_generation_systemKB article generation from incidentsYes
copilot_systemAI Copilot context and personaYes
rca_analysis_systemRoot cause analysis assistanceYes
change_risk_systemChange risk assessment reasoningYes
pir_generation_systemPost-incident review draft generationYes
Guardrails: Do not remove the security and scope guardrails from built-in system prompts. These prevent prompt injection attacks and scope the model's behavior to ITSM tasks. Removing them may result in the model performing tasks outside its intended scope.

Creating Templates

curl -X POST https://your-instance.stackflow-tech.com/prod/api/ai/prompt-templates   -H "Authorization: Bearer $ADMIN_TOKEN"   -H "Content-Type: application/json"   -d '{
    "name": "custom_sla_advisor_system",
    "type": "system",
    "content": "You are an ITSM SLA advisor for {{ tenant_name }}. When given an incident, recommend whether the SLA can be met based on current team capacity and historical resolution times. Always consider business hours ({{ business_hours_timezone }}) in your analysis.",
    "variables": ["tenant_name", "business_hours_timezone"]
  }'

Variables and Context

Template variables are automatically populated by the AI engine at runtime. Common variables include tenant_name, current_user_name, record_type, record_id, current_date, and module-specific context like incident_priority or article_category. Custom variables can be passed via the AI API for workflow-triggered AI calls.

Testing Templates

Test templates in the template editor by clicking Test Template and providing sample variable values and a test user message. The test sends a real Bedrock API call and displays the model's response alongside token usage and cost. Template tests are logged in the AI Observability module for review.