Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Bot Templates

BotServer includes pre-built bot templates for various use cases. Each template is a complete .gbai package ready to deploy.


Complete Template List (Flat Reference)

#TemplateCategoryFolderKey Features
1DefaultCoredefault.gbaiMinimal starter bot
2TemplateCoretemplate.gbaiReference implementation
3AnnouncementsCommunicationsannouncements.gbaiCompany news, multiple KB
4AI SearchSearchai-search.gbaiQR codes, document search
5API ClientIntegrationapi-client.gbaiREST API patterns
6BackupAdministrationbackup.gbaiServer backup scripts
7BIAnalyticsbi.gbaiDashboards, role separation
8BroadcastCommunicationsbroadcast.gbaiMass messaging
9CrawlerSearchcrawler.gbaiWeb indexing
10CRMSalescrm.gbaiCustomer management
11EducationEducationedu.gbaiCourse management
12ERPOperationserp.gbaiProcess automation
13LawLegallaw.gbaiDocument templates
14LLM ServerAIllm-server.gbaiModel hosting
15LLM ToolsAIllm-tools.gbaiPrompt engineering
16MarketingMarketingmarketing.gbaiCampaign tools
17Public APIsIntegrationpublic-apis.gbaiWeather, news APIs
18ReminderProductivityreminder.gbaiTask reminders
19StoreE-commercestore.gbaiProduct catalog
20Talk to DataAnalyticstalk-to-data.gbaiNatural language SQL
21WhatsAppMessagingwhatsapp.gbaiWhatsApp Business
22OfficeProductivityoffice.gbaiDocument processing
23Employee ManagementHRhr/employees.gbaiEmployee CRUD
24IT HelpdeskITit/helpdesk.gbaiTicket management
25Sales PipelineCRMcrm/sales-pipeline.gbaiDeal tracking
26Contact DirectoryCRMcrm/contacts.gbaiContact management

Templates by Category

Core Templates

TemplateFolderPurpose
Defaultdefault.gbaiMinimal starter bot for learning
Templatetemplate.gbaiComplete example structure

HR & People

TemplateFolderKey Files
Employee Managementhr/employees.gbaistart.bas, add-employee.bas, search-employee.bas
Leave Managementhr/leave.gbaistart.bas, request-leave.bas, approve-leave.bas
Recruitmenthr/recruitment.gbaistart.bas, post-job.bas, add-applicant.bas

IT & Support

TemplateFolderKey Files
IT Helpdeskit/helpdesk.gbaistart.bas, create-ticket.bas, update-ticket.bas
Asset Trackingit/assets.gbaistart.bas, add-asset.bas, checkout-asset.bas

CRM & Sales

TemplateFolderKey Files
CRMcrm.gbailead-management.bas, opportunity-management.bas
Sales Pipelinecrm/sales-pipeline.gbaistart.bas, create-deal.bas, update-stage.bas
Contact Directorycrm/contacts.gbaistart.bas, add-contact.bas, search-contact.bas

Finance & Accounting

TemplateFolderKey Files
Invoicingfinance/invoicing.gbaistart.bas, create-invoice.bas, send-reminder.bas
Expense Trackerfinance/expenses.gbaistart.bas, submit-expense.bas, approve-expense.bas

Operations

TemplateFolderKey Files
ERPerp.gbaiProcess automation, integrations
Warehouseoperations/warehouse.gbaistart.bas, receive-stock.bas, ship-order.bas

Template Structure

All templates follow this standard directory layout:

template-name.gbai/
  template-name.gbdialog/    # BASIC dialog scripts
    start.bas                # Entry point (required)
    *.bas                    # Tool scripts (auto-discovered)
    *-jobs.bas               # Scheduled jobs
  template-name.gbkb/        # Knowledge base collections
    collection1/             # Documents for USE KB "collection1"
  template-name.gbdrive/     # File storage (not KB)
    uploads/                 # User uploaded files
    exports/                 # Generated files
  template-name.gbot/        # Configuration
    config.csv               # Bot parameters
  template-name.gbtheme/     # UI theme (optional)
    default.css              # Theme CSS

Quick Start Guide

1. Choose a Template

Select based on your needs:

  • Simple chat: Use default.gbai
  • Business app: Choose crm.gbai, bi.gbai, or erp.gbai
  • AI features: Pick ai-search.gbai or llm-tools.gbai
  • Communication: Select broadcast.gbai or whatsapp.gbai

2. Deploy the Template

# Templates are auto-deployed during bootstrap
# Access at: http://localhost:8080/template-name

3. Customize Configuration

Edit template-name.gbot/config.csv:

name,value
bot-name,My Custom Bot
welcome-message,Hello! How can I help?
llm-model,gpt-4
temperature,0.7

4. Add Knowledge Base

Place documents in .gbkb folders:

  • Each folder becomes a collection
  • Use USE KB "folder-name" in scripts
  • Documents are automatically indexed

5. Create Tools

Add .bas files to .gbdialog:

  • Each file becomes a tool
  • Auto-discovered by the system
  • Called automatically by LLM when needed

Required Files for Each Template

start.bas (Required)

' Template Name - Start Script

' Setup Tools
ADD TOOL "tool-name-1"
ADD TOOL "tool-name-2"

' Setup Knowledge Base
USE KB "template-name.gbkb"

' Set Context
SET CONTEXT "context name" AS "You are a [role]. You help with [tasks]."

' Setup Suggestions
CLEAR SUGGESTIONS
ADD SUGGESTION "action1" AS "Display text 1"
ADD SUGGESTION "action2" AS "Display text 2"

' Welcome Message
BEGIN TALK
    **Template Title**
    
    Welcome message here.
    
    **What I can help with:**
    • Feature 1
    • Feature 2
END TALK

BEGIN SYSTEM PROMPT
    Detailed instructions for the AI...
END SYSTEM PROMPT

Tool File Template

PARAM paramname AS STRING LIKE "example" DESCRIPTION "What this parameter is"
PARAM optionalparam AS STRING LIKE "default" DESCRIPTION "Optional parameter"

DESCRIPTION "What this tool does. Called when user wants to [action]."

' Business logic
let result = "processed"

' Save data (field names = variable names)
SAVE "table.csv", paramname, optionalparam, result

' Store in memory
SET BOT MEMORY "last_item", result

' Response
TALK "✅ Action completed successfully!"

config.csv Template

name,value
episodic-memory-history,2
episodic-memory-threshold,4
theme-color1,#1565C0
theme-color2,#E3F2FD
theme-logo,https://pragmatismo.com.br/icons/general-bots.svg
theme-title,Template Name - General Bots

Syntax Rules for Templates

DO ✅

' Variable names (no underscores in names)
let ticketnumber = "TKT001"
let useremail = "user@example.com"

' SAVE with field names = variable names
SAVE "table.csv", ticketnumber, useremail, status

' Keywords with spaces
SET BOT MEMORY "last_ticket", ticketnumber
SET CONTEXT "name" AS "description"
ADD SUGGESTION "key" AS "Display text"
CLEAR SUGGESTIONS
USE KB "myknowledge"
USE TOOL "mytool"

' GET BOT MEMORY as function
let lastticket = GET BOT MEMORY("last_ticket")

DON’T ❌

' NO: Complex object operations
SET object.field = value  ' WRONG
SAVE "table", object.id, object  ' WRONG

Creating Custom Templates

To create your own template:

  1. Copy template.gbai as starting point
  2. Define clear purpose - one template, one job
  3. Structure folders properly:
    • .gbdialog for scripts
    • .gbkb for knowledge collections
    • .gbdrive for general files
    • .gbot for configuration
  4. Include examples - sample data and dialogs
  5. Test thoroughly - verify all features

Best Practices

Template Selection

  1. Start small: Begin with default.gbai
  2. Match use case: Choose aligned templates
  3. Combine features: Mix templates as needed
  4. Keep originals: Copy before modifying

Customization Strategy

Minimal BASIC Approach

Instead of complex dialog flows, use simple LLM calls:

' Let system AI handle conversations naturally
TALK "How can I assist you?"
' System AI understands and responds appropriately

Tool Creation

Only create .bas files for specific actions:

  • API calls
  • Database operations
  • File processing
  • Calculations

Knowledge Base Organization

  • One folder per topic/collection
  • Name folders clearly
  • Keep documents updated
  • Index automatically

Performance Tips

  • Remove unused template files
  • Index only necessary documents
  • Configure appropriate cache settings
  • Monitor resource usage

Support Resources

  • README files in each template folder
  • Example configurations included
  • Sample knowledge bases provided
  • Community forums for discussions