the goat that dont choose a play
In the Ukrainian vertep, the travelling puppet theatre, the goat is the liveliest figure on the stage. She dances, dies, comes back to life, and the crowd loves her. But she does not choose the play. That is a language model inside a program: clever, lively, and not to be trusted with the whole plot.
The model is not deterministic. The run is, because the model's answer is recorded as an input.
Follow Kalyna Credit, a fictional lender, as you:
- read its legal obligations as an engineer,
- build the decision,
- read the record as an auditor would,
- attack it,
- and operate it in production.
17 chapters, about 75,000 words, one runnable Rust crate per chapter. Every output block was printed by the program. The final chapter lists what the architecture does not give you.
Minimum price
$9.51
$35.00
You pay
Author earns
About
About the Book
Your agent did something. A person with the right to ask wants to know why. "The model said so" is not an answer.
The Goat Does Not Choose the Play teaches one architecture and then builds it, in a domain where the question is not optional: consumer credit decisions.
The program is a statechart. Actors run it. A language model, a person or a rule set sits at a choice point and may only pick among the moves the chart offers. Every input is journaled, so the run replays exactly and the record explains itself.
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 exactly the right picture of a language model inside a program: clever, lively, and not to be trusted with the whole plot.
What you will learn- Why an agent loop ("pick a tool, run it, paste the result back") cannot explain itself afterwards, and what to build instead.
- What "deterministic" does and does not mean for an agent. The model is not deterministic; the run is, because the model's answer is recorded as an input.
- Statecharts from the ground up: states, transitions, regions, history and time, read and written as W3C SCXML.
- Actors: many small machines, one mailbox each, and how they fit with event sourcing.
- Neurosymbolic agents: where a model belongs, how a chart keeps it there, and what rules and derivations add.
- Choice points and deciders: letting a model, a human or a rule set choose among legal moves, and handling the failure paths.
- What proof and conformance do cover, and, just as important, what they do not.
- How to read a regulation as an engineer and map each requirement to a mechanism.
- How to build, audit, attack and operate a regulated decision system: audit trails, counterfactuals, threats, identity, custody, shards, versions and incidents.
- Agents that talk to each other over protocols you can check.
A fictional lender, Kalyna Credit, decides consumer loans with a model's help. Lending is a good teacher because almost everything a regulator might ask is already written down: why was this applicant refused, who decided, what could the model have done, which version of the policy was in force, and can you show me.
You meet the lender in Chapter 1, take its legal obligations apart in Chapter 11, build its decision in Chapter 12, read its record as an auditor would in Chapter 13, attack it in Chapter 14, and run it in Chapter 15.
Every program runsThe book is built around Vertep, an open-source Rust system that implements SCXML statecharts, event-sourced virtual actors, deciders, rules, identity, wallets and verifiable protocols. But the book is about the ideas; every concept is explained so that a reader on another stack can carry it away.
- One runnable Rust 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.
- Written against Vertep 0.1.7.
The final chapter lists the questions this architecture does not answer, says when you should not use it, and offers a way to start that costs little. A statechart does not make a lending system safe, legal or fair. It makes a certain kind of question answerable. Where the book describes what a regulation asks of a system, it gives an engineer's reading and tells you to check it with counsel.
Who this 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.
What is insidePart I. The stage and the goat
- The Stage and the Goat
- What "Deterministic" Means for an Agent
Part II. Statecharts, Harel and actors 3. From Booleans to States 4. Reading and Writing Charts 5. Regions, History and Time 6. Actors: Many Small Machines, One Mailbox Each
Part III. Neurosymbolic agents 7. Neurosymbolic Agents 8. The Choice Point: Deciders 9. Rules and Derivations 10. Proof, Conformance and What They Do Not Cover
Part IV. Kalyna Credit: a regulated decision 11. The Regulated Domain: What the Rules Ask For 12. Building the Decision 13. The Audit Trail 14. Security: Threats, Identity, Custody 15. Operating It: Shards, Versions, Incidents 16. Agents That Talk: Protocols You Can Check 17. Limits, and What
Author
About the Author
Hey I am Volodymyr
Seasoned Developer's Journey from COBOL to Web 3.0, SSI, Privacy First Edge AI, and Beyond
As a seasoned developer with over 20 years of experience, I have worked with various programming languages, including some that are considered "dead," such as COBOL and Smalltalk. However, my passion for innovation and embracing cutting-edge technology has led me to focus on the emerging fields of Web 5.0, Self-Sovereign Identity (SSI),AI Agents, Knowledge Graphs, Agentiic memory systems, and the architecture of a decentralized world that empowers data democratization.
A firm believer in the potential of agent systems and the concept of a "soft" internet, I am dedicated to exploring and promoting these transformative ideas. In addition to writing, I also enjoy sharing my knowledge and insights through videoblogging. Most of my Medium posts serve as supplementary content to the videos on my YouTube channel, which you can explore here: https://www.youtube.com/c/VolodymyrPavlyshyn.
Join me on this exciting journey as we delve into the future of technology and the possibilities it holds.
Contents
Table of Contents
The Leanpub 60 Day 100% Happiness Guarantee
Within 60 days of purchase you can get a 100% refund on any Leanpub purchase, in two clicks.
See full terms...
Earn $8 on a $10 Purchase, and $16 on a $20 Purchase
We pay 80% royalties on purchases of $7.99 or more, and 80% royalties minus a 50 cent flat fee on purchases between $0.99 and $7.98. You earn $8 on a $10 sale, and $16 on a $20 sale. So, if we sell 5000 non-refunded copies of your book for $20, you'll earn $80,000.
(Yes, some authors have already earned much more than that on Leanpub.)
Learn more about writing on Leanpub
Free Updates. DRM Free.
If you buy a Leanpub book, you get free updates for as long as the author updates the book! Many authors use Leanpub to publish their books in-progress, while they are writing them. All readers get free updates, regardless of when they bought the book or how much they paid (including free).
Most Leanpub books are available in PDF (for computers) and EPUB (for phones, tablets and Kindle). The formats that a book includes are shown at the top right corner of this page.
Finally, Leanpub books don't have any DRM copy-protection nonsense, so you can easily read them on any supported device.
Learn more about Leanpub's ebook formats and where to read them
Write and Publish on Leanpub
You can use Leanpub to easily write, publish and sell in-progress and completed ebooks and online courses!
Leanpub is a powerful platform for serious authors, combining a simple, elegant writing and publishing workflow with a store focused on selling in-progress ebooks.
Leanpub is a magical typewriter for authors: just write in plain text, and to publish your ebook, just click a button. (Or, if you are producing your ebook your own way, you can even upload your own PDF and/or EPUB files and then publish with one click!) It really is that easy.