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

Terminal
curl -fsSL https://algal.computer/install.sh | sh
Apple silicon

Open source · MIT license · macOS, Linux, and algal.cloud

route.algalSource
program 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."
  }
}
Result · scripted model answers
I can help with that. What happens when you try to sign in?
model calls
2
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.

quote.lisp
01 / Write it as an S-expression
(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.

02 / Compose it
(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.

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.

reply.algalOne program, two views
01 / Read the intentSource
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.

2 model attempts, at most0 model calls in match
02 / See the structureExpand
Generated reply program graph: email flows into a typed decision, a pure decision check and match, then generation. Email also flows directly into generation as explicit context.
Select a step to inspect its inputs, output, and connection to the source.

ALGAL 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.

waits

Wait for an approval or message, then resume in a new process. Confirmed work is reused; a write with an unknown outcome stays blocked.

remembers

Keep program memory between runs in the local store, with semantic search for recalling related material.

decides

Give each model decision its own context, expected answer format, and budget. The rest of the program follows deterministic logic.

reproduces

Have a program propose another program. ALGAL checks it before running it within the parent's limits.

evolves

Score candidate programs on your test cases and choose which to keep. Their scores and history are saved.

replays

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.

See recorded runs on the tour

  1. 01

    Verify

    Replay the program logic using its recorded model and tool results, without contacting either service.

  2. 02

    Diff

    See which steps and work counts changed between runs.

  3. 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.

  1. 01 / proposeCandidate programs

    Model-produced plans or manifests

  2. 02 / checkPrograms with declared limits

    Host compilation and checks

  3. 03 / measureTest results

    Declared cases and work limits

  4. 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/civ

Civilization 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

Download an archive from the releases page

Checksums, install instructions, and platform support

# 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-review
Open my-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.

Read the vision Where the idea comes from

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.

Choose a first use case