Getting 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 Web Search (v3.2+)
Use the auto-registered webSearch@bxai tool when the agent needs current internet data.
See Web Search Tools for provider setup and options.
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.
Agent with the Agent Registry (v3.2.0+)
The Agent Registry provides centralized agent management for discoverability, observability, and analytics. Register agents once and resolve them anywhere.
💡 Default:
register: false— agents are NOT auto-registered by default to prevent memory leaks from sub-agents and throwaway agents.
See Agent Registry for the full registry API.
Fluent Configuration
For runtime changes, use setter methods:
Class-Based Agents
If you want reusable, encapsulated agents for larger applications, see:
⚙️ Constructor Parameters
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+)
register
boolean
Auto-register in the Agent Registry (v3.2.0+, default: false)
module
string
Module namespace for the registry (v3.2.0+)
checkpointer
IAiMemory
Memory backend for suspend/resume (v3.0+)
📤 Return Formats
Agents support five return formats: single (default), all, json, xml, and raw.
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
Related Pages
Last updated