Human checkpoint

A draft waits for an operator: y approves, n rejects, any other text is feedback for a revision.

The writer drafts an announcement, then the script stops and asks the operator. On a terminal prompt_human reads the answer; without a terminal it returns null and the script falls back to AGENTIC_APPROVE, which defaults to no. Feedback text sends the draft back for up to three revisions. Only an approved draft is written to announcement.txt, through tool_call write_file with a write grant that exists only on the approved path.

What it maps to

Human input: prompt_human on a terminal, an environment variable in automation. The default is to reject, never to publish unapproved text. See the concept map.

Script: human-checkpoint.lms

# Human checkpoint: a draft waits for an operator. y approves, n rejects, other text is feedback for a revision.
import "agentic.lms";
writer = agent("announcement writer", "write short, friendly release announcements");
draft = ask(writer, "Write a 2-sentence announcement: lmscript recipes for agent workflows are online.");
for (round in range(0, 3)) {
  println(f"draft {round + 1}: {draft}");
  answer = prompt_human("Approve? y / n / feedback: ");
  if (answer == null) { answer = env("AGENTIC_APPROVE", "n"); }
  answer = trim(answer);
  if (answer == "y") {
    # The write grant exists only on this approved path.
    saved = tool_call("write_file", {path: "announcement.txt", content: draft + "\n"}, {write: true});
    require(saved.ok, "could not save the announcement");
    println("decision=approved");
    exit(0);
  }
  if (answer == "n" || answer == "") {
    println("decision=rejected (no operator approval; set AGENTIC_APPROVE=y or answer y on a terminal)");
    exit(0);
  }
  draft = ask(writer, f"Revise this announcement.\nDraft: {draft}\nFeedback: {answer}");
}
println("decision=rejected after 3 revisions");

It imports the shared helpers from examples/agentic.lms, shown on the recipe index.

Run it

export OLLAMA_API_KEY=...
LLM_MODEL=ollama-cloud/deepseek-v4.1-flash lmscript examples/human-checkpoint.lms

Output (offline mock)

The site check runs this recipe against examples/mock-model.lms, a deterministic stand-in for the model, and compares this output.

draft 1: Agent workflow recipes for lmscript are online. Each one is a short script you can read, run offline and adapt.
decision=rejected (no operator approval; set AGENTIC_APPROVE=y or answer y on a terminal)

Live run

Recorded on 2026-11-01 with ollama-cloud/deepseek-v4.1-flash. It made 1 model call and used 162 tokens. The run used AGENTIC_APPROVE=y, so the approved draft was saved with tool_call write_file under a write grant. Live replies differ from run to run.

draft 1: Our lmscript recipes for agent workflows are now online! Check them out and start building smarter automations today.
decision=approved

Previous: Tool agent · Next: Fan-out and judge

Try it: download examples/human-checkpoint.lms and examples/agentic.lms into an examples/ directory, export the key for your provider, then run the command above. Run it on a terminal to answer interactively, or set AGENTIC_APPROVE=y to approve without one.