Welcome to the MALDA Reference Manual
MALDA: The AI-First Programming Language is a modern, object-oriented programming language designed for building AI agents and automation workflows. With native support for LLM integration, agent orchestration, and multi-agent systems, MALDA makes it simple to create intelligent, autonomous applications.
MALDA: Multi Agent Language with Development Automation - The name MALDA reflects the core principles of the language: Multi Agent (native support for orchestrating multiple AI agents working together), Language (a complete programming language with syntax, runtime, and tooling), Development (a full toolchain - interpreter, compiler, IDEs, language server - for building and shipping real software), and Automation (coding agents can write MALDA thanks to the language pack in docs/llm/, and MALDA programs automate development work in turn, since prompts, agents, and durable workflows are language constructs).
Quick Start
If you already program, start with the characteristic constructs. -> Review binds the prompt to the schema. Without await, the call is a rendered template (no API key). validate("Review", …) is the same check await would run on the model JSON. Type annotations elsewhere are IDE/LSP hints, not runtime checks. Same file: Examples/Basics/first_look.malda.
1. First Look
schema Review {
summary: string;
issues: string[];
}
prompt codeReview(code, language) -> Review {
system: "You are an expert reviewer of {language}.",
user: "Review this {language} code:\n\n{code}"
}
var rendered = codeReview("function add(a, b) { return a + b; }", "javascript");
io.print(rendered.user);
var checked = validate("Review", {
"summary": "Looks fine",
"issues": []
});
if (checked.ok) {
io.print("schema ok: " + checked.data.summary);
} else {
io.print("schema failed: " + checked.error);
}
Then the syntax path, if you want the core language before agents and APIs. Prefer namespaced calls (io.print, math.sqrt, str.upper); flat print still runs.
2. Print Output
io.print("Hello, World!");
3. Variables and Arithmetic
var price = 12;
var quantity = 3;
var total = price * quantity;
io.print("Total: " + total);
4. Conditionals
var score = 82;
if (score >= 60) {
io.print("Pass");
} else {
io.print("Fail");
}
5. Loops and Functions
function printCountdown(start) {
var current = start;
while (current > 0) {
io.print(current);
current = current - 1;
}
io.print("Go!");
}
printCountdown(3);
6. Complete Starter Program
This example combines variables, arrays, a loop, a function, and an if statement in one linear program:
var cart = [12, 18, 7];
var total = 0;
for (var item in cart) {
total = total + item;
}
function describeTotal(amount) {
if (amount >= 30) {
return "big order";
}
return "small order";
}
io.print("Items: " + cart.length);
io.print("Total: " + total);
io.print("Summary: " + describeTotal(total));
For more runnable beginner programs in the same style, see Examples and Start Here.
Choose Your Path
Path 1: Learn Programming With MALDA
Start here if you are learning programming for the first time. Follow this sequence:
- First Look (
prompt+schema+validate) - Hello World
- Variables and Arithmetic
- Conditionals
- Loops
- Functions
- Complete Starter Program
- Input Example
See Examples for runnable beginner programs.
After the core path, branch into Testing and Quality, Data and Databases, and Browser Apps.
Path 2: Build AI Apps With MALDA
Start here if you already know the basics and want to reach prompts, agents, and full-stack AI apps quickly.
- Prompt blocks and reusable prompting
- Agents and tool-based workflows
- REST APIs and UI controls
- Full-stack web and API showcases
Key Features
Core Language
- Dynamic Typing - Variables can hold values of any type
- Object-Oriented - Classes, inheritance, polymorphism
- Actors - Native actor model for concurrent programming
- Functions - First-class functions with recursion support
- Arrays - Dynamic arrays with built-in methods
- Control Structures - if/else, while, for, foreach loops
AI-First Capabilities
- LLM Integration - Built-in support for OpenAI, OpenRouter, LMStudio, OLLAMA
- Local LLMs - LlamaCppClient for local inference with GGUF models
- Agent System - Create autonomous agents with roles and instructions
- Tool System - Define custom tools with @Tool decorator
- Multi-Agent Orchestration - Coordinate multiple agents working together, including hierarchical systems
- Conversation Management - Automatic tool call handling with parallel read-only execution (default on)
Web & API Features
- Web Server - Built-in HTTP server for serving HTML
- REST API - Create REST APIs with decorator-based routing
- UI Web Framework - Use
@PAGEand@AIPAGEwith component library support to build full-stack applications with MALDA backend and server-rendered UI - MCP Server - Expose MALDA functions as MCP tools
- UI Generation - Generate HTML interfaces using LLM agents
Table of Contents
Getting Started
To get started with MALDA, run malda Examples/Basics/first_look.malda from the CLI. The Desktop IDE is the Windows reference (WPF); the Web IDE is a browser playground (not Desktop parity); VS Code + LSP is the cross-platform editor. The Desktop IDE provides:
- Syntax highlighting
- IntelliSense/auto-completion
- Full debugger with breakpoints
- Error diagnostics
- Compiler to create standalone executables
- Built-in profiling for bottleneck analysis in interpreted and transpiled runs
If you are new to the language, work through the Quick Start examples above from top to bottom before jumping into agents and full-stack features.
When you are ready to tune runtime behavior, see Appendix for the command-line profiling flags (including optional periodic file snapshots for long runs) and report summary.
Example: Simple Agent
Here's a quick example of creating an AI agent in MALDA:
// Create an agent (pass a client; for remote models use OpenRouterClient)
var client = new OpenRouterClient();
var agent = new Agent("Assistant", "helper", "You are a helpful assistant.", client);
var response = agent.think("What is 2+2?");
io.print(response.content);
When you use await prompt(...) or specialized agents (e.g. CodingAgent) without passing a client, MALDA uses a default local LLM (Qwen/Qwen2.5-0.5B-Instruct, downloaded as a GGUF build from Hugging Face on first use—no API key required).