Skip to content

Custom Templates

Create custom pipeline templates for your specific use cases.

Overview

Custom templates let you define reusable pipeline configurations with specific models, prompts, and settings.

Template Structure

yaml
name: my-custom-template
description: Template for customer support voice interactions
version: "1.0.0"

# Speech-to-Text configuration
stt:
  model: whisper-1
  language: en
  streaming: false
  word_timestamps: true

# Language Model configuration
llm:
  model: gpt-5.2
  system_prompt: |
    You are a customer support assistant for TechCorp.

    Guidelines:
    - Be helpful and concise
    - Offer to escalate complex issues
    - Never share internal procedures
  max_tokens: 200
  temperature: 0.7
  tools: []

# Text-to-Speech configuration
tts:
  model: eleven_turbo_v2_5
  voice: friendly
  streaming: true
  voice_settings:
    stability: 0.5
    similarity_boost: 0.75

# Post-processing
processing:
  detect_pii: false
  format_output: text

# Compliance settings
compliance:
  audit_log: true
  data_classification: internal

# Cost limits
limits:
  max_audio_seconds: 300
  max_response_tokens: 500

Creating Templates

Via API

bash
curl -X POST https://api.gateflow.ai/v1/mcp/pipeline-templates \
  -H "Authorization: Bearer gw_prod_admin_key" \
  -H "Content-Type: application/json" \
  -d '{
    "name": "support-voice-bot",
    "description": "Voice bot for customer support",
    "stt": {
      "model": "voxtral-mini-latest",
      "streaming": true
    },
    "llm": {
      "model": "gpt-5-mini",
      "system_prompt": "You are a helpful support assistant.",
      "max_tokens": 150,
      "temperature": 0.7
    },
    "tts": {
      "model": "eleven_turbo_v2_5",
      "voice": "friendly"
    }
  }'

Response:

json
{
  "template_id": "template_xyz789",
  "name": "support-voice-bot",
  "version": "1.0.0",
  "created_at": "2026-02-16T10:00:00Z"
}

Via YAML File

bash
# Upload YAML template
curl -X POST https://api.gateflow.ai/v1/mcp/pipeline-templates/upload \
  -H "Authorization: Bearer gw_prod_admin_key" \
  -F "file=@my-template.yaml"

Template Sections

STT Configuration

yaml
stt:
  model: whisper-1              # STT model
  language: en                  # ISO language code or "auto"
  streaming: true               # Enable streaming transcription
  word_timestamps: false        # Include word-level timing
  prompt: "Technical discussion" # Hint for better accuracy

Available Models:

  • whisper-1 - OpenAI Whisper (best accuracy)
  • voxtral-mini-latest - Mistral Voxtral (low latency)

LLM Configuration

yaml
llm:
  model: gpt-5.2                # LLM model
  system_prompt: |              # System instructions
    You are a helpful assistant.
  max_tokens: 200               # Max response tokens
  temperature: 0.7              # Creativity (0-2)
  top_p: 1.0                    # Nucleus sampling
  presence_penalty: 0           # Discourage repetition
  frequency_penalty: 0          # Discourage common tokens
  tools: []                     # Function calling tools

TTS Configuration

yaml
tts:
  model: eleven_multilingual_v2 # TTS model
  voice: professional           # Voice ID or standard name
  streaming: true               # Enable streaming audio
  voice_settings:
    stability: 0.5              # Voice consistency
    similarity_boost: 0.75      # Voice matching
    style: 0.0                  # Style exaggeration
    speed: 1.0                  # Speech rate

Available Models:

  • eleven_multilingual_v2 - Best quality
  • eleven_turbo_v2_5 - Low latency
  • eleven_flash_v2_5 - Cost effective
  • tts-1-hd - OpenAI high quality
  • tts-1 - OpenAI standard

Processing Configuration

yaml
processing:
  detect_pii: true              # Scan for PII/PHI
  redact_pii: false             # Redact detected PII
  pii_categories:               # Categories to detect
    - email
    - phone
    - ssn
  format_output: json           # Output format
  extract_entities: true        # Named entity extraction

Compliance Configuration

yaml
compliance:
  audit_log: true               # Log all invocations
  data_classification: internal # Classification level
  retention_days: 90            # Log retention
  hipaa: false                  # HIPAA compliance
  matter_id: null               # Legal matter tracking

Using Custom Templates

In MCP Tools

python
from gateflow_mcp import MCPClient

client = MCPClient(agent_id="agent_abc123", api_key="gf-agent-...")

result = client.call_tool(
    name="voice/pipeline",
    arguments={
        "audio": audio_b64,
        "template": "support-voice-bot"  # Your custom template
    }
)

With Overrides

python
result = client.call_tool(
    name="voice/pipeline",
    arguments={
        "audio": audio_b64,
        "template": "support-voice-bot",
        "overrides": {
            "llm": {
                "max_tokens": 300  # Override for this call
            }
        }
    }
)

Template Versioning

Create New Version

bash
curl -X POST https://api.gateflow.ai/v1/mcp/pipeline-templates/support-voice-bot/versions \
  -H "Authorization: Bearer gw_prod_admin_key" \
  -H "Content-Type: application/json" \
  -d '{
    "version": "1.1.0",
    "changes": "Updated system prompt",
    "llm": {
      "system_prompt": "You are an improved support assistant..."
    }
  }'

List Versions

bash
curl https://api.gateflow.ai/v1/mcp/pipeline-templates/support-voice-bot/versions \
  -H "Authorization: Bearer gw_prod_admin_key"

Use Specific Version

python
result = client.call_tool(
    name="voice/pipeline",
    arguments={
        "audio": audio_b64,
        "template": "support-voice-bot@1.0.0"  # Pin to version
    }
)

Template Management

List Templates

bash
curl https://api.gateflow.ai/v1/mcp/pipeline-templates \
  -H "Authorization: Bearer gw_prod_admin_key"

Get Template

bash
curl https://api.gateflow.ai/v1/mcp/pipeline-templates/support-voice-bot \
  -H "Authorization: Bearer gw_prod_admin_key"

Update Template

bash
curl -X PATCH https://api.gateflow.ai/v1/mcp/pipeline-templates/support-voice-bot \
  -H "Authorization: Bearer gw_prod_admin_key" \
  -H "Content-Type: application/json" \
  -d '{
    "llm": {
      "max_tokens": 250
    }
  }'

Delete Template

bash
curl -X DELETE https://api.gateflow.ai/v1/mcp/pipeline-templates/support-voice-bot \
  -H "Authorization: Bearer gw_prod_admin_key"

Assigning to Agents

bash
curl -X PATCH https://api.gateflow.ai/v1/mcp/agents/agent_abc123 \
  -H "Authorization: Bearer gw_prod_admin_key" \
  -H "Content-Type: application/json" \
  -d '{
    "permissions": {
      "pipelines": ["support-voice-bot", "voice-agent-fast"]
    }
  }'

Example Templates

Meeting Transcription

yaml
name: meeting-transcription
stt:
  model: whisper-1
  word_timestamps: true
llm:
  model: gpt-5.2
  system_prompt: |
    Summarize this meeting transcript:
    - Key decisions made
    - Action items with owners
    - Follow-up required
  max_tokens: 500
processing:
  format_output: markdown

Language Learning

yaml
name: language-tutor
stt:
  model: whisper-1
  language: auto
llm:
  model: gpt-5.2
  system_prompt: |
    You are a language tutor.
    Correct grammar mistakes gently.
    Respond in the same language as the user.
  temperature: 0.8
tts:
  model: eleven_multilingual_v2
  voice: friendly

Best Practices

  1. Version your templates - Track changes over time
  2. Test thoroughly - Validate before production use
  3. Document purpose - Clear descriptions help maintenance
  4. Set appropriate limits - Prevent cost overruns
  5. Use meaningful names - Descriptive template names

Next Steps

Built with reliability in mind.