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

  • message: 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:

  1. Agent receives: "What's the weather in Boston?"

  2. Agent thinks: "I need to use the weather tool"

  3. Agent calls: get_weather("Boston")

  4. Tool returns: { temp: 15, conditions: "cloudy" }

  5. 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

🤖 AI Agents

🧬 RAG & Documents

⛓️ AI Pipelines

🔧 Advanced Topics

💻 Examples

Check the /examples folder in the repository for more complete applications.

❓ Common Issues

"No API key provided"

  • Set API key in boxlang.json or 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 serve

  • Check 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