The book
The Goat Does Not Choose the Play
Your agent did something, and a person with the right to ask wants to know why. “The model said so” is not an answer. This book teaches one architecture and then builds it, in a domain where the question is not optional: consumer credit decisions.
The picture
The liveliest figure on the stage does not choose the play.
In the Ukrainian vertep, the travelling nativity puppet theatre, the goat is the liveliest figure on the stage. She dances, she is struck down, she comes back to life, and the crowd loves her. But she does not choose the play. That is the right picture of a language model inside a program: clever, lively, and not to be trusted with the whole plot.
The book's answer is a statechart that offers the moves, a decider (a language model, a person or a rule set) that may only pick among them, and a journal in which every input is recorded. The model is not deterministic; the run is, because the model's answer is recorded as an input. So the run replays exactly, and the record explains itself.
What you get
Chapters in four parts
About 75,000 words, with figures and a companion code repository.
Runnable crate per chapter
Every block of program output in the text was printed by that program. Charts are XML and a small expression language; the host programs are short enough to read as pseudocode. You do not need to know Rust.
One running case
Kalyna Credit, a fictional lender, decides consumer loans with a model’s help. You read its legal obligations as an engineer, read its record as an auditor would, and operate it in production.
The book is written against Vertep 0.1.7, the open-source Rust system on this site. But it is about the architecture: every concept is explained so that a reader on another stack can carry it away. Where it describes what a regulation asks of a system, it gives an engineer’s reading and tells you to check it with counsel, and the last chapter lists what the architecture does not answer and when you should not use it.
Who it is for
- Engineers and architects building agents, LLM-driven or not, that must be able to say afterwards what happened and why.
- Technical leads who will be asked by a compliance officer to explain the design.
- Compliance, risk and audit people who have been handed a design and a suspicion.
You should be able to read code (Python or TypeScript is fine), have called an LLM API, and know what a state machine is in the loose sense. You do not need to know Harel statecharts, SCXML, actors, Datalog or Prolog, or session types: chapters 3 to 6 teach them.
Contents
Part I. The stage and the goat
- Why an agent loop cannot explain itself
- What “deterministic” means for an agent
Part II. Statecharts, Harel and actors
- From booleans to states
- Reading and writing charts
- Regions, history and time
- Actors: many small machines, one mailbox each
Part III. Neurosymbolic agents
- Neurosymbolic agents
- The choice point: deciders
- Rules and derivations
- Proof, conformance and what they do not cover
Part IV. Kalyna Credit: a regulated decision
- The regulated domain: what the rules ask for
- Building the decision
- The audit trail
- Security: threats, identity, custody
- Operating it: shards, versions, incidents
- Agents that talk: protocols you can check
- Limits, and what this does not answer
Appendices include a map from regulatory requirement to mechanism.
The author
Volodymyr Pavlyshyn writes about agent memory, knowledge graphs, self-sovereign identity and decentralised architecture, and is the author of Vertep. See the about page.
