Vertep

Why Vertep

The model may choose. The chart decides what is allowed.

AI agents are starting to make decisions that matter: a loan, a claim, a treatment request. The usual way to build one is a loop around a prompt, and the usual answer to "why did it do that?" is a shrug and a transcript. Vertep is the other way to build it: a statechart that states the legal moves, a journal that records every step, and a model that picks among the moves and nothing else.

The problem

A prompt loop is a program whose state is a transcript.

1

Nothing outside the model knows what is allowed

Where is the process now? Somewhere in a growing prompt. What may it do next? Whatever the model says. A prompt injection in a retrieved document can ask for any tool with any arguments.

2

It cannot be replayed

Run it again and the model answers differently. A failure in production can be described but not reproduced, and a decision cannot be re-examined, only remembered.

3

The reasons are written afterwards

Explanations of a model's answer are usually produced after the fact, by the same kind of system that gave the answer. They can be fluent and wrong, and nothing ties them to what actually happened.

4

It has no clock and no escalation

What if the model hangs? What if a person must approve a step and goes home for the weekend? Each patch adds an if, and the patches grow into a state machine without its diagram or its guarantees.

The idea

Put the model at a choice point inside a program it does not control.

The program is a statechart, a standard (W3C SCXML) way to say which states a process can be in and which moves are legal from each. Most of the chart is ordinary logic. At a few states it cannot decide alone, and those are marked as decide states.

At a decide state the chart works out which moves are enabled right now, and offers only those to a decider: a language model, a person or a rule. The answer is accepted only if it was on the list. Whatever the model prefers, a move the chart does not offer is not available.

Every input, and every answer, is written to a journal before the chart acts on it. The journal is the whole truth of the process, so the process can be replayed without the model, and examined as of any step.

  <state id="underwriting" vt:decide="underwriter" vt:candidates="approve decline refer">
    <transition event="approve" cond="ctx.dti &lt;= 43 &amp;&amp; ctx.amount &lt;= 50000" target="approved"/>
    <transition event="decline" target="declined"/>
    <transition event="refer" target="officer_review"/>
    <transition event="error.decide.invalid" target="officer_review"/>
  </state>

From the credit-decision example. approve exists only while the ratio is at most 43% and the amount at most 50 000. Above that, the model is never offered it.

How it compares, honestly

Vertep is not the only way to do any one of these things. It is an unusual combination.

Agent frameworks built on a prompt loop

They are fast to start and flexible. They do not give you a chart that bounds the model, a replay without it, or a record that was written before the action. If your agent only drafts text for a person to read, you may not need more.

Durable-execution engines such as Temporal

They are mature, widely used and excellent at long-running workflows written as code. Vertep's differences are that the process is a chart, which is data that can be hashed, versioned, diagrammed and queried as RDF, and that a model's choice is a first-class journaled step. If you need production-hardened workflows today, in a language they support, they are the safer choice.

Statechart libraries such as XState

They are excellent for interfaces and for application logic in JavaScript. Vertep implements the W3C SCXML algorithm in full for server-side, durable, multi-actor use, and adds the journal, the deciders and the proofs.

Where Vertep stands today

  • Version 0.1.x. APIs may change between minor versions before 1.0.
  • Built in the open, quickly. The specification is complete for what is built; real-world use is what is missing. That is the reason to try it on a small case and tell us what breaks.
  • Strong: the SCXML core, the journal and replay, the deciders, the Lean model, the Rust and JavaScript bindings.
  • Younger: clusters, federation, durable objects, wallets and agent protocols. They are built and specified, with fewer users and open items, which the roadmap lists.
  • Not yet there: redaction of personal data in a journal, an explanation export, published benchmarks. These are specified in the drafts m12-decision-records and m13-production-readiness.

Try it in ten minutes

git clone https://github.com/Volland/vertep && cd vertep
cargo run -p vertep-examples --bin credit-decision

Three loan applications are decided by a scripted stand-in for a model, then an auditor opens the same journal with no decider at all. Read the walkthrough, then change a threshold in loan.scxml and watch what the model is offered. If something is unclear or broken, open an issue: right now that is the most useful thing you can do.