rocketGetting Started

How to create and configure AI agents — from simple assistants to full-featured agents with custom models, tools, and v3.0 skills.

Basic Agent

// Simple agent with default settings
agent = aiAgent(
    name: "Assistant",
    description: "A helpful AI assistant",
    instructions: "Be concise and friendly"
)

response = agent.run( "What is BoxLang?" )
println( response )

Agent with a Custom Model

// Agent with a specific AI model
model = aiModel( provider: "claude" )

agent = aiAgent(
    name  : "Claude Assistant",
    model : model,
    params: { temperature: 0.7 }
)

💡 Use predefined providers in your module configuration to centrally manage model defaults without repeating credentials everywhere.

Agent with Tools

Tools enable agents to perform real-world actions:

Agent with Skills (v3.0+)

Skills inject domain knowledge into the agent's system context:

See Skills for the full skills guide.

Agent with MCP Servers (v3.0+)

Seed tools from external MCP servers:

See Tools & MCP for the full MCP integration guide.

Fluent Configuration

For runtime changes, use setter methods:

⚙️ Constructor Parameters

Parameter
Type
Description

name

string

Agent name (also used as identifier)

description

string

What this agent does (used in sub-agent delegation)

instructions

string

System-level instructions for the agent

model

AiModel / string

AI model instance or provider name

tools

array

Array of Tool / ITool instances

memory

IAiMemory / array

Memory instance(s) for conversation history

params

struct

Model parameters (temperature, max_tokens, etc.)

options

struct

Execution options (returnFormat, etc.)

subAgents

array

Child agents for delegation

skills

array

Always-on skills (v3.0+)

availableSkills

array

Lazy-loaded skills (v3.0+)

middleware

array

Middleware instances or structs (v3.0+)

mcpServers

array

MCP server configs { url, toolNames } (v3.0+)

checkpointer

IAiMemory

Memory backend for suspend/resume (v3.0+)

📤 Return Formats

Agents support five return formats: single (default), all, json, xml, and raw.

spinner

single (Default)

Returns just the assistant's content as a string:

all

Returns all messages including system, memory context, and response:

raw

Returns the full provider response structure with metadata:

json / xml

Asks the agent to return its response in the specified format and parses it:

Agent Introspection

Set Appropriate Parameters

Last updated