botserver/docs/src/chapter-09-api
Rodrigo Rodriguez (Pragmatismo) 48c1ae0b51 , dt.month, dt.hour, dt.is_weekend, etc.)
- Add startup wizard module for first-run configuration
- Add white-label branding system with .product file support
- Add bot manager for lifecycle, MinIO buckets, and templates
- Add version tracking registry for component updates
- Create comparison doc: BASIC vs n8n/Zapier/Make/Copilot
- Add WhatsApp-style sample dialogs to template documentation
- Add data traceability SVG diagram ```
2025-11-30 15:07:29 -03:00
..
compilation.md - From 8 to 13.5 2025-11-24 13:02:30 -03:00
external-apis.md - From 8 to 13.5 2025-11-24 13:02:30 -03:00
get-integration.md - From 4 to 7. 2025-11-23 20:12:09 -03:00
llm-rest-server.md , dt.month, dt.hour, dt.is_weekend, etc.) 2025-11-30 15:07:29 -03:00
mcp-format.md - From 4 to 7. 2025-11-23 20:12:09 -03:00
nvidia-gpu-setup.md - From 4 to 7. 2025-11-23 20:12:09 -03:00
openai-format.md - From 8 to 13.5 2025-11-24 13:02:30 -03:00
param-declaration.md - From 4 to 7. 2025-11-23 20:12:09 -03:00
README.md - Fix .svgs. 2025-11-24 14:15:01 -03:00
tool-definition.md - From 8 to 13.5 2025-11-24 13:02:30 -03:00

Chapter 09: APIs and Tools

General Bots transforms BASIC scripts into powerful tools that LLMs can discover and use automatically. This chapter explains how to create tools, integrate with external APIs, and build sophisticated AI capabilities without complex frameworks.

The Tool Revolution

In the LLM era, tools are not manually coded integrations - they're capabilities that AI can discover and use intelligently. General Bots makes this simple: write a BASIC script, it becomes a tool.

How Tools Work in General Bots

Traditional Approach (Complex)

// Define schema
const toolSchema = {
  name: "weather",
  description: "Get weather information",
  parameters: {
    type: "object",
    properties: {
      location: { type: "string" }
    }
  }
};

// Register with framework
framework.registerTool(toolSchema, async (params) => {
  // Implementation
});

General Bots Approach (Simple)

' weather.bas - This is a complete tool!
PARAM location AS STRING LIKE "New York" DESCRIPTION "City to get weather for"
DESCRIPTION "Gets current weather information"

weather = GET "api/weather/" + location
TALK "The weather in " + location + ": " + weather

That's it. The LLM can now use this tool whenever users ask about weather.

Core Concepts

Tools Are Just BASIC Files

Every .bas file in your .gbdialog folder is automatically a potential tool. No registration, no configuration, no boilerplate.

LLMs Orchestrate Everything

The AI decides when to use tools based on user intent. You don't write decision logic - you provide capabilities.

Parameters Drive Conversations

PARAM declarations tell the LLM what information to collect. The AI handles the conversation naturally.

What You'll Learn

Tool Creation

API Integration

Advanced Topics

Quick Example: Complete API Integration

Here's a real-world tool that integrates with an external API:

' translate.bas - Translation tool using external API
PARAM text AS STRING DESCRIPTION "Text to translate"
PARAM target AS STRING LIKE "es" DESCRIPTION "Target language code (es, fr, de, etc)"

DESCRIPTION "Translates text to another language"

' Get API key from secure storage
api_key = GET BOT MEMORY "translation_api_key"

' Call external translation API
result = GET "https://api.translator.com/v1/translate" WITH {
  "text": text,
  "target": target,
  "key": api_key
}

IF result.error THEN
  TALK "Sorry, translation failed: " + result.error
ELSE
  TALK "Translation: " + result.translated_text
END IF

The LLM will:

  1. Understand when translation is needed
  2. Collect the text and target language through natural conversation
  3. Call this tool with the right parameters
  4. Present the results conversationally

Why This Approach Works

No Glue Code

Traditional systems require layers of integration code. In General Bots, BASIC scripts directly become AI capabilities.

Natural Conversations

Instead of forms and wizards, users have conversations. The AI handles all the complexity of gathering information.

Rapid Development

Create a new tool in minutes, not days. Change it instantly. No compilation, no deployment process.

Universal Compatibility

Tools automatically work with any LLM that supports function calling - Groq, OpenAI, Anthropic, or local models.

Tool Ecosystem

Built-in Tools

General Bots includes ready-to-use tools for common tasks:

  • Email sending
  • Database queries
  • Web scraping
  • File operations
  • Calendar management

Custom Tools

Create your own tools for:

  • Business processes
  • API integrations
  • Data transformations
  • Workflow automation
  • External services

Tool Libraries

Share and reuse tools across bots. Build a library of capabilities for your organization.

Best Practices

Keep Tools Focused

Each tool should do one thing well. Let the LLM compose them for complex tasks.

Use Clear Descriptions

The DESCRIPTION helps the LLM understand when to use your tool:

DESCRIPTION "Books a meeting room for the specified date and time"

Handle Errors Gracefully

Always provide meaningful feedback when things go wrong:

IF NOT result.success THEN
  TALK "I couldn't complete that: " + result.message
END IF

Secure API Keys

Never hardcode credentials. Use BOT MEMORY:

api_key = GET BOT MEMORY "service_api_key"

Real-World Use Cases

Customer Service

Tools for checking orders, processing returns, updating accounts - all through natural conversation.

Data Analysis

Connect to databases, generate reports, visualize data - the AI guides users through complex queries.

Business Automation

Approval workflows, document processing, notification systems - replacing traditional forms with conversation.

Integration Hub

Connect legacy systems, modern APIs, and cloud services - unified through conversational AI.

Getting Started

  1. Create a simple tool - Start with a basic .bas file
  2. Add parameters - Define what information the tool needs
  3. Test with the LLM - See how the AI uses your tool
  4. Iterate quickly - Refine based on real usage

Summary

APIs and tools in General Bots are refreshingly simple. Write BASIC scripts that become AI capabilities. No frameworks, no schemas, no complex integrations. Just describe what you want in simple code, and let the LLM handle the rest.

The future of API integration isn't about writing more code - it's about providing capabilities that AI can orchestrate intelligently.

Next Steps


General Bots