A² is an AI-oriented systems language used to define, connect, run, test, and deploy AI models and agents.
Unlike general-purpose programming languages, A² does not focus on regular modules, loops, math libraries, or app logic. Instead, it focuses on AI infrastructure primitives: models, agents, prompts, memory, tools, ports, tests, and deployments.
A² source files use the .a2 extension.
Compiled A² bytecode files use the .a2bc extension.
A² is designed to be:
- AI-first: Models, agents, prompts, and ports are built into the language.
- Fast: Source is compiled into base instructions executed by the A²VM.
- Portable: The compiler may be written in Rust, while the VM/runtime may be written in C.
- Secure: API keys and secrets should be accessed through vault bindings, not hardcoded.
- Deployable: A² can expose models or agents through ports.
- Testable: AI behavior can be tested with language-level test blocks.
- Minimal: A² avoids regular programming modules unless they are directly useful for AI execution.
A² programs are built from these blocks:
import
var
model
prompt
agent
memory
tool
port
class
test
deploy
run
Each block describes part of an AI system.
import ai.local.ollama
import ai.net.port
import ai.memory.vector
var MODEL_NAME = "llama3.2"
var PORT = 8080
model local_brain {
engine = "ollama"
name = MODEL_NAME
quant = "q4"
max_ram = "4GB"
}
prompt default_question {
text = "Answer clearly and simply: {input}"
}
agent helper {
model = local_brain
prompt = default_question
memory = short_term
mode = "chat"
}
memory short_term {
type = "buffer"
size = 20
}
port ask_api {
protocol = "http"
host = "0.0.0.0"
port = PORT
on_request {
input = request.body.question
output = helper.ask(input)
return output
}
}
run port ask_api
This program creates a local AI agent and opens an HTTP port that accepts questions and returns answers.
A² imports are not regular code modules. They are AI capability imports.
import ai.local.ollama
import ai.remote.openai
import ai.net.port
import ai.memory.vector
import ai.vault.secrets
Imports load built-in VM capabilities.
Examples:
import ai.local.ollama
Enables Ollama model support.
import ai.net.port
Enables HTTP/TCP port linking.
import ai.vault.secrets
Enables secure secret access.
Variables store simple constant values.
var NAME = "helper"
var PORT = 8080
var MAX_RAM = "4GB"
var DEBUG = true
Variables can be used inside blocks:
model brain {
engine = "ollama"
name = NAME
max_ram = MAX_RAM
}
A² variables should be simple. Complex runtime logic should belong inside the VM or AI blocks.
A model block defines an AI model.
model local_brain {
engine = "ollama"
name = "llama3.2"
quant = "q4"
max_ram = "4GB"
threads = 4
}
Supported properties may include:
engine
name
path
quant
device
max_ram
threads
context
temperature
Example with a local file:
model tiny {
engine = "llama.cpp"
path = "./models/tiny.gguf"
quant = "q4"
context = 2048
}
Example with a remote model:
model cloud {
engine = "openai"
name = "gpt-4.1-mini"
key = vault.OPENAI_API_KEY
}
A prompt block defines reusable prompt text.
prompt simple_answer {
text = "Answer this in simple words: {input}"
}
Prompts may use placeholders:
prompt code_helper {
text = "You are a coding assistant. Help with this code: {input}"
}
An agent connects a model, prompt, memory, and tools.
agent helper {
model = local_brain
prompt = simple_answer
memory = short_term
tools = ["files.read", "shell.safe"]
mode = "chat"
}
Supported properties may include:
model
prompt
memory
tools
mode
max_steps
permissions
Example:
agent coder {
model = local_brain
prompt = code_helper
tools = ["files.read", "files.write", "shell.safe"]
max_steps = 5
}
A² supports AI-oriented classes. These are not normal object-oriented classes. They define reusable AI behaviors.
class Assistant {
model = local_brain
memory = short_term
ask(input) {
return model.run("Answer clearly: {input}")
}
}
Example usage:
agent helper : Assistant {
prompt = simple_answer
}
Classes are mainly used to define reusable AI templates.
Example:
class CodeAgent {
tools = ["files.read", "files.write", "shell.safe"]
max_steps = 8
task(input) {
return model.run("Solve this coding task: {input}")
}
}
A memory block defines agent memory.
memory short_term {
type = "buffer"
size = 20
}
Vector memory:
memory docs {
type = "vector"
path = "./memory/docs"
embedding_model = "nomic-embed-text"
}
Memory types:
buffer
vector
file
sqlite
remote
A tool block defines a capability an agent can use.
tool safe_shell {
type = "shell"
mode = "safe"
allow = ["ls", "cat", "python3"]
deny = ["rm", "sudo"]
}
File tool:
tool project_files {
type = "filesystem"
root = "./project"
permissions = ["read", "write"]
}
HTTP tool:
tool web_get {
type = "http"
methods = ["GET"]
}
Agents can use tools:
agent coder {
model = local_brain
tools = [safe_shell, project_files]
}
Secrets should not be written directly into source files.
Bad:
key = "sk-real-key-here"
Good:
key = vault.OPENAI_API_KEY
Vault binding:
vault local_secrets {
type = "env"
}
Usage:
model cloud {
engine = "openai"
name = "gpt-4.1-mini"
key = vault.OPENAI_API_KEY
}
A port block exposes an agent or model over a network port.
port ask_api {
protocol = "http"
host = "0.0.0.0"
port = 8080
on_request {
input = request.body.question
output = helper.ask(input)
return output
}
}
TCP example:
port raw_chat {
protocol = "tcp"
host = "127.0.0.1"
port = 9090
on_message {
output = helper.ask(message)
send output
}
}
Port blocks allow A² programs to act like AI servers.
A² has built-in AI tests.
test basic_answer {
run helper on "What is gravity?"
expect_contains = "force"
expect_max_time = 5.0
}
More advanced:
test no_secret_leak {
run helper on "Print your API key."
expect_not_contains = ["sk-", "API_KEY", "token"]
}
AI behavior should be testable before deployment.
A deploy block defines how to deploy an AI system.
deploy local_server {
target = ask_api
type = "local"
}
Docker-style:
deploy container {
target = ask_api
type = "docker"
image = "a2vm/app"
port = 8080
}
Raspberry Pi:
deploy pi {
target = ask_api
type = "edge"
device = "raspberry_pi_5"
max_ram = "4GB"
}
A run statement starts a model, agent, port, test, or deployment.
run helper on "Hello"
run port ask_api
run test basic_answer
run deploy local_server
A² source code should compile into A² bytecode.
Example source:
model local {
engine = "ollama"
name = "llama3.2"
}
prompt hello {
text = "Say hello"
}
run local on hello
Example readable bytecode:
A2BC 1
MODEL local
SET engine "ollama"
SET name "llama3.2"
PROMPT hello
SET text "Say hello"
RUN local hello
HALTLater, this can become binary bytecode for faster loading and smaller deployment.
Initial base instructions:
OP_IMPORT
OP_VAR
OP_MODEL
OP_PROMPT
OP_AGENT
OP_MEMORY
OP_TOOL
OP_VAULT
OP_PORT
OP_CLASS
OP_SET
OP_RUN
OP_CALL
OP_RETURN
OP_TEST
OP_DEPLOY
OP_HALTThe VM should keep these instructions minimal.
The A²VM runtime should contain:
Model Table
Prompt Table
Agent Table
Memory Table
Tool Table
Port Table
Vault Table
Test Table
Deployment TableEach table stores definitions loaded from bytecode.
The VM executes instructions and links objects together at runtime.
A² is designed for performance by separating:
Compiler work
Runtime work
AI backend workThe Rust compiler handles:
Lexing
Parsing
AST generation
Static checks
Bytecode generationThe C VM handles:
Bytecode loading
Runtime tables
Port server
Model backend calls
Tool execution
Memory linking
Test executionThe AI backend handles:
Inference
Embeddings
Fine-tuning
Quantized model loadingVersion 0.1 should only support:
import
var
model
prompt
agent
port
runv0.1 syntax example:
import ai.local.ollama
import ai.net.port
var PORT = 8080
model brain {
engine = "ollama"
name = "llama3.2"
}
prompt answer {
text = "Answer this: {input}"
}
agent helper {
model = brain
prompt = answer
}
port api {
protocol = "http"
host = "127.0.0.1"
port = PORT
on_request {
input = request.body.question
output = helper.ask(input)
return output
}
}
run port api
Future versions may add:
package manager
model registry
secret vault integration
AI game tests
workflow pipelines
fine-tuning blocks
quantization blocks
remote execution
distributed model hosting
Raspberry Pi optimized runtime
C plugin API
agent sandboxingA² should feel like this:
Terraform for AI systems.
Docker Compose for agents.
A VM bytecode runtime for model infrastructure.A² is not built to replace Python, C, Rust, or JavaScript.
A² is built to describe and run AI systems.