Templates

Templates are pre-configured session configurations that streamline common automation workflows.

What are Templates?

Templates define:

  • System Prompt: Instructions for the AI model
  • Initial Message: Optional starting message
  • Required Tools: Tools needed for the workflow
  • Default Model: Recommended model for the task
  • Variables: Placeholders for customization

Benefits of Templates

Consistency

  • Standardized workflows across team
  • Reproducible results
  • Best practices encoded in prompts

Efficiency

  • Quick start for common tasks
  • No manual configuration needed
  • Pre-tested configurations

Sharing

  • Share effective prompts with team
  • Organization-wide templates
  • Public templates for community

Using Templates

Selecting a Template

  1. Go to Automation dashboard
  2. Click the template dropdown
  3. Browse or search templates
  4. Click a template to select it
  5. Review with Preview button

Template Preview

Preview shows:

  • Template name and description
  • Category and slug
  • System prompt content
  • Initial message (if any)
  • Required tools list
  • Default model

Executing a Template

  1. Select a gateway
  2. Select a template
  3. Choose a model (or use default)
  4. Configure tools (optional)
  5. Click Start Session

Via API

POST /api/automation/templates/:id/execute
Content-Type: application/json
Authorization: Bearer <your-api-key>

{
  "gatewayIds": ["gateway-uuid-1", "gateway-uuid-2"],
  "variables": {
    "project_name": "my-app",
    "target_language": "python"
  },
  "modelId": "groq/llama-3.3-70b-versatile",
  "disabledTools": ["web_search"]
}

Template Structure

Core Fields

Field Required Description
name Yes Display name for the template
slug Yes URL-friendly identifier
category Yes Category for organization
system_prompt Yes AI system instructions
description No Brief explanation
icon No Emoji or icon
initial_message No First message to send
required_tools No Array of required tool names
default_model No Recommended model ID
variables No Variable definitions
is_public No Whether template is publicly visible
is_active No Whether template is enabled

System Prompt

The system prompt instructs the AI model:

You are an expert code reviewer. Your task is to:

1. Analyze code for potential bugs and issues
2. Suggest performance improvements
3. Identify security vulnerabilities
4. Recommend best practices

Be thorough but constructive. Explain your reasoning clearly.

Variables

Templates support variable placeholders:

You are working on the {{project_name}} project.
The primary programming language is {{language}}.
Focus on {{focus_area}}.

Variables are replaced when executing the template.

Creating Templates

Via Web Interface

  1. Navigate to Automation Templates page
  2. Click Create Template
  3. Fill in template details:
    • Name and slug
    • Category
    • System prompt
    • Optional fields
  4. Save the template

Via API

POST /api/automation/templates
Content-Type: application/json
Authorization: Bearer <your-api-key>

{
  "name": "Code Review Assistant",
  "slug": "code-review",
  "category": "development",
  "icon": "🔍",
  "description": "Automated code review and suggestions",
  "system_prompt": "You are an expert code reviewer...",
  "initial_message": "Please share the code you'd like me to review.",
  "required_tools": ["read_file", "list_files", "search_files"],
  "default_model": "groq/llama-3.3-70b-versatile",
  "variables": {
    "language": {
      "type": "string",
      "default": "python",
      "description": "Primary programming language"
    }
  },
  "is_public": false,
  "is_active": true
}

Managing Templates

List Templates

GET /api/automation/templates?category=development&limit=50
Authorization: Bearer <your-api-key>

Get Template Details

GET /api/automation/templates/:id
Authorization: Bearer <your-api-key>

Update Template

PUT /api/automation/templates/:id
Content-Type: application/json
Authorization: Bearer <your-api-key>

{
  "name": "Updated Name",
  "system_prompt": "Updated instructions...",
  "default_model": "anthropic/claude-3-5-sonnet"
}

Delete Template

DELETE /api/automation/templates/:id
Authorization: Bearer <your-api-key>

Template Categories

Development

  • Code review
  • Bug analysis
  • Refactoring assistance
  • Documentation generation

DevOps

  • Deployment scripts
  • Infrastructure checks
  • Log analysis
  • Health monitoring

Data

  • Data transformation
  • Report generation
  • Analysis workflows
  • Batch processing

Research

  • Information synthesis
  • Summary generation
  • Comparative analysis
  • Trend identification

Template Variables

Defining Variables

{
  "variables": {
    "target_directory": {
      "type": "string",
      "required": true,
      "description": "Directory to analyze"
    },
    "max_files": {
      "type": "number",
      "default": 100,
      "description": "Maximum files to process"
    },
    "include_tests": {
      "type": "boolean",
      "default": false,
      "description": "Include test files"
    }
  }
}

Variable Types

Type Description
string Text value
number Numeric value
boolean True/false
array List of values

Using Variables in Prompts

Analyze the code in {{target_directory}}.
Process up to {{max_files}} files.
{{#if include_tests}}Include test files in the analysis.{{/if}}

Providing Variable Values

POST /api/automation/templates/:id/execute
Content-Type: application/json

{
  "gatewayIds": ["gateway-uuid"],
  "variables": {
    "target_directory": "/app/src",
    "max_files": 50,
    "include_tests": true
  }
}

Required Tools

Specifying Tools

List tools the template needs:

{
  "required_tools": [
    "read_file",
    "list_files",
    "search_files",
    "write_file"
  ]
}

Tool Validation

When executing:

  • Gateway must support all required tools
  • Warning shown if tools are missing
  • Session may still proceed

Common Tool Sets

Workflow Recommended Tools
Code Analysis read_file, list_files, search_files
Code Modification Above + write_file, create_directory
Web Research web_search, web_browse, read_url
System Admin execute_command, read_file, write_file

Best Practices

Writing System Prompts

  1. Be specific: Clearly define the AI's role and capabilities
  2. Set expectations: Describe desired output format
  3. Add constraints: Specify what not to do
  4. Include examples: Show expected responses

Example System Prompt

You are an expert Python developer specializing in code optimization.

Your responsibilities:
- Analyze Python code for performance issues
- Suggest specific optimizations with code examples
- Explain the impact of each optimization
- Consider memory usage and execution time

Output format:
1. Summary of findings
2. Prioritized list of optimizations
3. Code examples for each suggestion

Constraints:
- Only suggest changes that maintain functionality
- Do not modify external dependencies
- Preserve existing code style

Template Organization

  • Use consistent naming conventions
  • Group by category
  • Include descriptive slugs
  • Add helpful descriptions

Testing Templates

  1. Create template with test prompt
  2. Execute on test gateway
  3. Review results
  4. Iterate on system prompt
  5. Publish when satisfied

Maintenance

  • Review templates periodically
  • Update for new model capabilities
  • Remove obsolete templates
  • Gather user feedback

Sharing Templates

Organization Templates

Templates can be scoped to your organization:

  • Visible to all organization members
  • Managed by admins
  • Share team best practices

Public Templates

Make templates public for community use:

  • Set is_public: true
  • Add clear documentation
  • Include usage examples
  • Maintain actively

Template Examples

Code Review Template

{
  "name": "Code Review",
  "slug": "code-review",
  "category": "development",
  "icon": "🔍",
  "system_prompt": "You are a senior software engineer conducting a code review. Analyze the code for:\n\n1. **Bugs and Logic Errors**: Identify potential issues\n2. **Performance**: Suggest optimizations\n3. **Security**: Flag vulnerabilities\n4. **Best Practices**: Recommend improvements\n5. **Readability**: Suggest clarity improvements\n\nProvide specific line references and code examples.",
  "required_tools": ["read_file", "list_files", "search_files"],
  "default_model": "anthropic/claude-3-5-sonnet"
}

Documentation Generator

{
  "name": "Documentation Generator",
  "slug": "doc-gen",
  "category": "development",
  "icon": "📝",
  "system_prompt": "You are a technical writer. Generate comprehensive documentation for the provided code:\n\n1. Overview and purpose\n2. Installation instructions\n3. API reference\n4. Usage examples\n5. Configuration options\n\nUse Markdown format with clear headings.",
  "initial_message": "I'll analyze the codebase and generate documentation. Please specify the project directory.",
  "required_tools": ["read_file", "list_files", "write_file"],
  "default_model": "groq/llama-3.3-70b-versatile"
}

System Health Check

{
  "name": "System Health Check",
  "slug": "health-check",
  "category": "devops",
  "icon": "🏥",
  "system_prompt": "You are a DevOps engineer performing a system health check. Check:\n\n1. Disk usage and available space\n2. Memory utilization\n3. Running processes\n4. Network connectivity\n5. Service status\n\nReport issues with severity levels (critical/warning/info).",
  "required_tools": ["execute_command", "read_file"],
  "default_model": "groq/llama-3.3-70b-versatile"
}

Next Steps