work in progress

Lumen for AI agents

tools are functions. decisions are data. an experimental AI-powered next step connects the two.

more structure

tools, plans and results as plain lists and maps — easy for an agent to write and for a human to read.

clearer instructions

a small, strict syntax with line-numbered errors, so an agent knows exactly what went wrong.

bounded execution

tools stay inside the sandbox. AI runs only with your permission; no files or terminal commands.

new possibilities

agents that generate, run and repair Lumen programs in a loop, step by step.

try the idea today

run agent demo →
// Tools are plain functions; unknown tools are rejected.
let tools = {
  add: fn(a, b) { a + b },
  shout: fn(t) { upper(t) + "!" },
  count_words: fn(t) { len(split(t, " ")) }
}
let plan = [
  { tool: "add", args: [20, 22] },
  { tool: "shout", args: ["hello agents"] },
  { tool: "count_words", args: ["lumen makes agents readable"] },
  { tool: "fly", args: [] }
]
for step in plan {
  if !has(tools, step.tool) {
    print("✗ unknown tool:", step.tool)
    continue
  }
  let f = tools[step.tool]
  let result = if len(step.args) == 1 { f(step.args[0]) } else { f(step.args[0], step.args[1]) }
  print("✓", step.tool, "→", result)
}

let the model choose

experimental · ai_next(goal, tools, history) returns one decision. the program checks the tool, runs it, and feeds back the result.

AI runs only when you choose run with AI. Requests use workspace AI credits; leave out secrets. Ordinary Lumen programs and the four-line demo stay offline.

open AI agent demo →
// Ask the model for one decision, then feed back the result.
let tools = {
  add: fn(a, b) { a + b },
  shout: fn(t) { upper(t) + "!" },
  count_words: fn(t) { len(split(t, " ")) }
}
let descriptions = [
  { name: "add", description: "Add two numbers. args: [a, b]" },
  { name: "shout", description: "Uppercase text with !. args: [text]" },
  { name: "count_words", description: "Count space-separated words. args: [text]" }
]
let goal = "Add 20 and 22, shout hello agents, and count words in lumen makes agents readable. Do each task once, then finish."
let history = []
for turn in range(4) {
  let step = ai_next(goal, descriptions, history)
  if step.done { print("✓ done"); break }
  if !has(tools, step.tool) { print("✗ unknown tool:", step.tool); break }
  let f = tools[step.tool]
  let result = if len(step.args) == 1 { f(step.args[0]) } else { f(step.args[0], step.args[1]) }
  print("✓", step.tool, "→", result)
  push(history, { tool: step.tool, args: step.args, result: result })
}

AI choices can vary. ai_next is available in the web playground; the desktop kit runs offline programs.