Wait for an approval or message, then resume in a new process. Confirmed work is reused; a write with an unknown outcome stays blocked.
Agent programming language
Software that accumulates competence.
ALGAL is a language and VM where agent programs wait for you, survive crashes, and leave receipts. Work that succeeds becomes a typed, tested procedure the next task can call.
macOS
curl -fsSL https://algal.computer/install.sh | shLinux
curl -fsSL https://algal.computer/install.sh | shWindows
curl -fsSL https://algal.computer/install.sh | shprogram route(email: text) -> text {
budget { max_agent_calls: 2 }
let intent = decide "What does this email need?" using email
as choice {
help: "Help with a problem",
sales: "Information before buying",
other: "Anything else"
}
return match intent.value {
help => generate "Draft a helpful support reply." using email,
sales => generate "Draft a concise sales reply." using email,
other => "Needs a human review."
}
}
I can help with that. What happens when you try to sign in?
- model calls
- 2
- result
- complete
program reply(email: text) -> text {
budget { max_agent_calls: 2 }
let intent = decide "What does this email need?" using email
as choice {
help: "Help with a problem",
sales: "Information before buying",
other: "Anything else"
}
let task = match intent.value {
help => "Draft a helpful support reply.",
sales => "Draft a concise sales reply.",
other => "Draft a clarifying question."
}
return generate task using email
}
I can help with that. What happens when you try to sign in?
- model calls
- 2
- result
- complete
import draft from "./draft.algal"
program inbox(sample: text, emails: json) -> json {
budget { max_agent_calls: 4 }
let preview = call draft using { email: sample, tone: "helpful" }
let replies = each draft over email in emails using { tone: "helpful" } max_items 3
return { preview: preview, replies: replies }
}
{
"preview": "Happy to help you get started. What would you like to do first?",
"replies": [
"I can help you sign in. What happens when you enter your email?",
"I can help update your delivery address. Has the order shipped?",
"Your invoice is available under Billing in your account."
]
}
- model calls
- 4
- result
- complete
{
"contract": "algal.organism.v1",
"key": "organism:habitat-propose",
"name": "HabitatPropose",
"budgets": {
"maxAgentCalls": 4,
"maxContextBytes": 65536,
"maxDepth": 4,
"maxOutputBytes": 65536,
"maxSteps": 32,
"maxWork": 10000
},
"cells": [
{
"id": "goal",
"kind": "input",
"outputs": {
"text": {
"type": "text"
}
{
"child": "sha256:7487c54f528d1f40086079cdc1efa63dca20e9153fa40909f3f7e2bbe4937906",
"population": [
"sha256:7487c54f528d1f40086079cdc1efa63dca20e9153fa40909f3f7e2bbe4937906"
]
}
- model calls
- 1
- result
- complete
ALGAL is a programming language for agent programs that outlive a single run. A program can pause for your approval, resume after a crash without redoing finished work, and leave receipts that replay exactly what it did. Work that succeeds is kept as a typed procedure with its evidence, so the next program starts from what the last one learned.
Ask your agent to set it up: algal.computer
Ben Guo
Code is data
A program is a value your system can read, write, and keep.
ALGAL programs are typed data with a content-derived identity. A Lisp-shaped surface lowers to the same manifest as readable source, so a person, a macro, or a model can author a procedure, and the host checks it the same way.
(program quote ((order json)) json
(with-total subtotal
(* (get order quantity) (get order unit_price))
(record subtotal subtotal
shipping (if (>= subtotal 50) 0 5)
total (+ subtotal (if (>= subtotal 50) 0 5)))))
The macro expansion is printed and hashed.
Generated code stays inspectable, and the manifest digest matches the readable source exactly.
(program gross ((order json)) json
(let gross (* (get order price) (get order quantity))
(let tax (* gross 0.08)
(record gross gross tax tax total (+ gross tax)))))
Immutable bindings, bounded fuel, no hidden effects.
Syntax never grants authority. Waits, tools, and limits are declared in the manifest.
Once a procedure works, it keeps its digest, its evidence, and its place in every larger program that calls it.
The demo
Watch a program wait for you.
The built-in demo needs no model account. A program stops for your decision, survives two crashes, and its history checks out offline. Read the launch post.
The program stops with status waiting. Nothing has been written yet.
The local report names the one action and where it goes. You copy approve or deny.
ALGAL · VM workbench
A program that can wait.
- Evidence saved
- Proposal saved
- Approval waiting
- Publication held
Your decision.
The program can propose. Only your next command can authorize the exact saved action.
- Allowed action
publish-local-report- Destination
publication.json
Paste the command into your terminal, then reopen this report. Copying a command does not execute it.
Every saved step, with its status and a short fingerprint.
ALGAL · VM workbench
A program that can wait.
- Evidence saved
- Proposal saved
- Approval waiting
- Publication held
- Generation 0ready
sha256:5f5d53…bed4ca - Generation 1uncertain
sha256:c073b6…41b524 - Generation 1suspended
sha256:2fe679…3e2f76
Killed twice on purpose: finished steps are reused, and an uncertain write is not resent.
Export the run to one file and check it on any machine.
Illustrations drawn from a recorded run of algal demo. Output is trimmed where marked with an ellipsis.
Anatomy
Turn an email
into a drafted reply.
This program classifies an email and drafts a reply. Open the source beside the graph to follow each step.
program reply(email: text) -> text {
budget { max_agent_calls: 2 }
let intent = decide "What does this email need?" using email
as choice {
help: "Help with a problem",
sales: "Information before buying",
other: "Anything else"
}
let task = match intent.value {
help => "Draft a helpful support reply.",
sales => "Draft a concise sales reply.",
other => "Draft a clarifying question."
}
return generate task using email
}
The model classifies the email, a pure match picks the task, and the model drafts the reply.
Each model call sees only the context named after using.
matchALGAL checks the program before it runs. Each model call receives only the context you name in the source.
Capabilities
Keep a task running
across interruptions.
Use ALGAL for approval queues, repeatable model decisions, and tasks whose history you need to inspect.
Keep program memory between runs in the local store, with semantic search for recalling related material.
Give each model decision its own context, expected answer format, and budget. The rest of the program follows deterministic logic.
Have a program propose another program. ALGAL checks it before running it within the parent's limits.
Score candidate programs on your test cases and choose which to keep. Their scores and history are saved.
Inspect a saved run and replay its logic without calling a model or connecting to the original services.
The habitat
Your host sets the tools,
models, and limits.
Your application chooses which models and tools a program can use, where it saves work, and how much it can spend.
Run a program with the native CLI or the TypeScript runtime. Both can resume the same saved run on a shared local store.
A program cannot give itself tool access or raise its own limits. Your application supplies those permissions.
Receipts
Every run
can be replayed offline.
A saved run records which steps ran and what they returned. Replay its logic or compare it with another run.
- 01
Verify
Replay the program logic using its recorded model and tool results, without contacting either service.
- 02
Diff
See which steps and work counts changed between runs.
- 03
Diagnose
Find the source expression behind a failure. Source diagnostics require the Bun CLI and a checkout.
Reproduction and selection
Programs write programs.
Evidence picks which to keep.
An ALGAL program, called an organism in the spec, can propose another program. Test candidates on your cases and choose which ones your application keeps.
- 01 / proposeCandidate programs
Model-produced plans or manifests
- 02 / checkPrograms with declared limits
Host compilation and checks
- 03 / measureTest results
Declared cases and work limits
- 04 / selectKeep a candidate
Your selection and its history
Try the selection loop with Apple Intelligence on a Mac. It requires Xcode and builds a separate model bridge on first use.
algal civ --live --apple --dir .algal/civ
algal civ-verify --dir .algal/civCivilization workflows · Habitats and self-reproduction · Watch an organism propose a child on the tour
Candidates compete on declared cases. The ones that hold up become components, and your host decides what stays.
Get started
Install one binary.
Run your first program.
Install the native CLI and run the built-in approval demo. It needs no model account or development tools.
- macOS
- Linux
- Windowsvia WSL2
# Check the installed build and available model providers
algal doctor
# Start a program that waits for your decision
algal demo start ./my-review
algal demo inspect ./my-reviewmy-review/report.html for the command to approve or deny the task. The demo uses scripted decisions and needs no model account.To explore crash recovery, follow the native demo guide.The idea
Every success becomes
a component.
ALGAL lets a model propose a procedure, tests it on cases you choose, and lets your application keep it. Each kept procedure raises the floor for the next task.
For an existing workflow, compare ALGAL with LangGraph, Temporal, and other tools before adopting a new language.
Where it runs
Run it
on your machine or in a habitat.
ALGAL runs approval queues, coding repairs checked by your own tests, reusable judgment pipelines, and run histories you inspect later. Run it as one native binary on your machine, or as a habitat on algal.cloud that keeps your programs alive across restarts, machines, and teams.
Your application supplies tool permissions, models, and limits. A program declares its decisions, budgets, and approval points, and cannot widen its own authority. Receipts record every step, so a reviewer can replay a run without your store, your credentials, or a model.
The adoption guide maps each job to a first program.