Quick Start Guide
Complete quick start guide for BoxLang AI - from basic chatting to advanced agents, RAG, and pipelines.
Get up and running with BoxLang AI in minutes. This comprehensive guide walks you through everything from your first AI chat to building autonomous agents with memory, tools, and RAG capabilities.
📖 Table of Contents
📋 Prerequisites
BoxLang installed and configured
bx-ai module installed (Installation Guide)
At least one AI provider configured (Provider Setup)
API key for your chosen provider OR Ollama installed locally
💬 Your First AI Chat
The simplest way to use AI is with the aiChat() function:
🔄 Getting Started Flow
Run it:
Output:
📖 Understanding the Basics
The aiChat() Function
aiChat() Functionmessage: Your question or prompt (string or array of messages)
params: Model parameters like temperature, max_tokens (optional)
options: Provider, API key, return format (optional)
Simple Examples
Ask a question:
Get creative:
Use a specific model:
🌐 Working with Different Providers
☁️ Cloud Providers
Cloud Providers
OpenAI:
Claude:
Gemini:
Mistral:
Local AI with Ollama
No API key needed, runs on your machine:
Benefits of Ollama:
🔒 Privacy: Data never leaves your machine
💰 Cost: Zero API charges
🚀 Speed: No network latency
🔌 Offline: Works without internet
💭 Building Conversations
Multi-Turn Dialogue
Using Message Builder
🎛️ Controlling AI Behavior
Temperature (Creativity)
Response Length
💡 Practical Examples
Code Assistant
Content Generator
Translator
Smart Q&A
⛓️ Introduction to Pipelines
Pipelines let you chain AI operations together for more complex workflows. Here are some quick examples:
Simple Pipeline
FAQ Bot Pipeline
Multi-Step Pipeline
Why Use Pipelines?
Reusability: Create once, run many times with different inputs
Learn more about pipelines in the Pipeline Overview section.
📚 Document Loading & RAG
Loading Documents
Load documents from various sources:
Quick RAG System
Learn more in the RAG Guide and Document Loaders.
🤖 AI Agents Quick Start
🎯 What are AI Agents?
AI Agents are autonomous assistants that:
Remember context across conversations using memory systems
Use tools to perform actions and access real-time data
Reason about tasks and break them into steps
Maintain state across multiple interactions
Think of agents as AI assistants that can:
Answer questions while remembering previous context
Search databases or APIs when they need information
Execute functions to perform actions
Make decisions based on accumulated knowledge
🚀 Your First Agent
The simplest agent is just a conversation interface with memory:
Key Difference: Without memory, the AI would forget your name between calls!
🛠️ Agents with Tools
Give your agent the ability to perform actions:
What happens:
Agent receives: "What's the weather in Boston?"
Agent thinks: "I need to use the weather tool"
Agent calls:
get_weather("Boston")Tool returns:
{ temp: 15, conditions: "cloudy" }Agent responds: "The current weather in Boston is 15°C and cloudy."
💭 Different Memory Types
Window Memory (Default)
Keeps only recent messages in RAM - good for managing context limits:
Session Memory
Persists across requests in web applications:
File Memory
Saves to disk - persists across application restarts:
🧬 RAG Agents
Agents can access knowledge bases automatically:
🎯 Practical Agent Examples
Customer Support:
Code Review:
Learn more in the Agents Guide.
📊 Structured Output
Get type-safe responses by defining the expected structure using classes or struct templates.
With a Class
With a Struct Template
Extracting Arrays
Learn more in the Structured Output Guide.
⚡ Async & Streaming
Async Operations
For non-blocking AI calls:
Streaming Responses
Get responses in real-time:
Streaming Agent Responses
🎓 Next Steps
Now that you're comfortable with the basics, explore:
📚 Core Concepts
Basic Chatting - Master the fundamentals
Advanced Chatting - Tools, async, streaming
Service-Level Control - Direct service management
🤖 AI Agents
Agents Guide - Complete agent documentation
Agent Examples - Working code examples
Memory Systems - Conversation history
Tools - Function calling patterns
🧬 RAG & Documents
RAG Guide - Complete RAG workflow
Document Loaders - Load data from various sources
Vector Memory - Semantic search
⛓️ AI Pipelines
Pipeline Overview - Learn about composable workflows
Working with Models - Pipeline-compatible AI models
Message Templates - Reusable prompts
Transformers - Data processing
🔧 Advanced Topics
Event System - Intercept and customize AI operations
Custom Memory - Build custom memory implementations
Custom Loaders - Create custom document loaders
Custom Transformers - Build custom transformers
💻 Examples
Check the /examples folder in the repository for more complete applications.
❓ Common Issues
"No API key provided"
Set API key in
boxlang.jsonor pass directly in options
"Connection timeout"
Increase timeout in settings or pass longer timeout in options
"Model not found"
Check provider documentation for available model names
For Ollama: make sure you've pulled the model with
ollama pull <model>
Ollama not responding
Start Ollama:
ollama serveCheck status:
curl http://localhost:11434/api/tags
"Agent not remembering context"
Ensure memory is configured:
.setMemories( aiMemory(...) )Check memory isn't being cleared between calls
Verify session/key is consistent across calls
Last updated