Part 4 of 6

Execution: lifecycle, transactions and evals

A declared lifecycle for the model, transaction semantics for agent actions, eval-driven development and natural language as source code.

Sections 11–14
11 · State-machine programming

The model operates inside a declared lifecycle

The model may make decisions inside a state. Normal code controls which state transitions are legal.

RECEIVED CLASSIFIED SPECIFIED PLANNED APPROVED IMPLEMENTED VERIFIED READY PUBLISHED
automatic transition human approval gate verification required
Error transitions
IMPLEMENTED FAILED
VERIFIED REPAIR_REQUIRED
REPAIR_REQUIRED IMPLEMENTED
FAILED ROLLED_BACK
What this means for the business
You cannot manage what you cannot observe

A declared lifecycle gives every run a known state, a set of allowed transitions, and an end. Without one you cannot answer the two questions that always come up in an incident: where is this process now, and what will it cost if it keeps going. Explicit states also make progress reportable in business terms rather than in log lines, and give operations a defensible place to intervene.

Decision Require declared states, allowed transitions, and a hard iteration and budget cap for every autonomous feature.
12 · Transaction semantics

Treat agent actions like transactions

BEGIN Create plan Produce preview Validate preview Request approval Apply changes Run tests COMMIT
Any failure → ROLLBACK
Forward action
Compensating action
Create DNS record
Delete DNS record
Deploy website
Restore previous deployment
Schedule campaign
Cancel campaign
Create CRM automation
Disable or remove automation
Reserve domain
Release reservation where possible
Create payment configuration
Disable configuration

Some actions cannot be fully reversed: sending an email, charging a payment, publishing sensitive data, registering some domains, deleting external resources without backups. These require approval before execution.

What this means for the business
Half-applied changes are the expensive failure mode

Agent actions touch real systems, so they need the discipline you already apply to database work: plan, preview, apply, verify, commit, with a defined rollback. When that sequence is missing, a failure halfway through leaves the environment inconsistent, and the cleanup is manual, slow and usually done by your most senior people. Reversibility is also what makes it safe to grant more autonomy over time, because mistakes stop being permanent.

Decision Require preview and a rollback path for every write, and where rollback is genuinely impossible, require human approval instead.
13 · Eval-driven development

Test-driven development for probabilistic software

Because outputs vary, one trial proves nothing. Run multiple trials, compare score distributions against a baseline, and deploy only if better.

Traditional development
Write code → Run tests → Repair
Prompt-system development
Define evals → Establish baseline →
Modify prompt or workflow →
Run multiple trials → Compare results →
Deploy only if better
One version · many trials
baseline
score distribution → compare against baseline
LAYER 1
Schema validation: output parseable · required fields present · enums valid
LAYER 2
Deterministic checks: tests pass · links work · files exist · APIs respond · accessibility rules pass
LAYER 3
Requirement coverage: every requirement maps to an implementation · nothing major omitted · no unrequested destructive change
LAYER 4
Model or human grading: visual quality · writing quality · coherence · brand fit · originality
LAYER 5
Real-world outcome: user accepts the result · conversion improves · task completion improves · support requests decline

Essential rule: verify the final environment state, not merely the model's written claim that the task is complete.

What this means for the business
Without evals, every change is an unmeasured bet

An evaluation set is the regression suite for probabilistic software. It is what lets you say whether a new model, prompt or context change actually improved anything, instead of arguing from anecdotes and the last three examples anyone happened to try. Teams that invest here can adopt a new model within days and defend the decision with numbers; teams that do not are structurally unable to upgrade safely, and their quality discussions never converge.

Decision Fund a labelled evaluation set before scaling the feature, and make its pass rate a release gate rather than a report.
14 · Compiler architecture

Natural language as source code

Natural-language
request
Intent
representation
Structured
specification
Design
direction
Execution
plan
Tool calls &
code changes
Verified
artifact
Compiler stage
Prompt-to-product system
Lexing & parsing
Intent extraction
Semantic analysis
Resolve requirements and constraints
Intermediate representation
Product specification
Optimization
Select model, layout, components, workflow
Code generation
Generate code and tool operations
Static checking
Validate schema, policy and architecture
Runtime testing
Browser, functional, accessibility, visual tests
Linking
Connect modules, APIs, forms, CRM, automations
Packaging
Build deployment artifact
Deployment
Publish approved revision
The structured specification is an intermediate representation, not merely another prompt.
What this means for the business
Store the intermediate steps or lose the ability to diagnose

Treating a request as source code that passes through stages, from parsed intent to specification, plan, execution and verification, has one very practical benefit: when the output is wrong you can tell which stage was wrong. Systems built as a single opaque call cannot be diagnosed after the fact, so every incident restarts from guesswork and every fix is speculative. Persisting the intermediate artefacts is cheap; not having them is what makes post-mortems inconclusive.

Decision Require that intermediate artefacts are stored and retrievable per run, so incidents can be diagnosed rather than reproduced by luck.
Series

Continue the engineering guide

This is one part of a six-part guide on turning prompts into specification-driven probabilistic software.

Back to the series overview →

App & Cloud Architecture · Book a Product Discovery Call

More articles