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...
Building Reliable, Testable, and Governable AI Systems with DSLs, Contracts, and Executable Specifications
AI agents fail when goals are ambiguous, tools have excessive authority, state is unreliable, or retries repeat real-world effects. Agent Specification Engineering shows how to build dependable tool-using and multi-agent systems with executable contracts, typed tools, policy, state machines, tests, audit trails, and governance.
Interested in this book? Show your support by saying what you'd like to pay for it!
About the Book
Agent demos are fluent because the happy path is easy to hide. Production systems expose the missing decisions: ambiguous goals, excessive tool authority, stale context, invalid state, duplicate effects after timeout, unbounded delegation, unverifiable completion, and failures that no prompt can safely resolve.
Agent Specification Engineering presents a rigorous alternative to prompt-only development. Its central thesis is simple: models should interpret and propose inside an execution architecture whose contracts, schemas, policy, state, budgets, typed tools, domain services, approvals, and evidence define what can actually happen.
You will learn how to:
The book includes AgentSpec 0.1 as a concrete executable specification language, along with a JSON Schema and EBNF, five complete specifications, and a dependency-free Python 3.12 reference engine with offline tests.
Four production case studies cover:
Eight appendices provide language and schema references, threat and production checklists, evaluation scorecards, discussion notes for all 126 exercises, a 115-term glossary, and annotated further reading.
This book is for staff and principal engineers, AI and platform engineers, software architects, security and reliability practitioners, technical leads, and engineering managers responsible for systems that call tools or affect real data.
It assumes familiarity with APIs, schemas, testing, and distributed-system basics. It does not require formal-methods expertise or allegiance to any particular AI framework.
Unlike a prompt cookbook, the book treats model behavior as one component in a system of independently reviewable boundaries.
Unlike a framework manual, it separates portable purpose and contract semantics from provider-specific binding.
Unlike a governance-only overview, it provides executable artifacts, failure simulations, tests, diagrams, and release gates.
Agent Specification Engineering extends the language-design ideas introduced in Geison Flores’s AI DSL Development. The earlier book asks how to design a domain-specific language; this one asks what an executable agent specification must say about authority, state, tools, effects, evidence, failure, and operations.
If an AI system must remain reliable after the demo—when identity changes, dependencies fail, requests are duplicated, evidence conflicts, and models are wrong—this book gives your team the vocabulary and engineering method required to build the boundary.
About the Author
Geison Felipe Góes Flores is a technical author focused on the principles behind correct, auditable, and resilient financial systems. He wrote Fundamentals of Software Engineering for Fintechs to help professionals understand what happens beneath balances, transfers, payment confirmations, and financial APIs.
His work connects software architecture, distributed systems, accounting concepts, payment operations, reconciliation, security, observability, and invariant-driven testing. Rather than prescribing a single technology stack, Geison presents practical models for identifying where money or financial facts could be duplicated, lost, delayed, corrupted, or accepted without sufficient evidence.
Throughout the book, he transforms complex financial rules into mechanisms engineering teams can implement and verify: balanced ledger entries, explicit state machines, idempotency contracts, immutable histories, reconciliation procedures, audit trails, risk-oriented metrics, and controlled recovery paths.
Geison’s central belief is that trust is not merely a feature presented through an interface—it is a technical property earned through every modeling, architecture, implementation, and operational decision.
“A trustworthy financial system must be able to explain not only what happened, but why it happened and how its correctness can be demonstrated.”
With practical examples, pseudocode, SQL, checklists, exercises, and architecture review frameworks, Geison helps engineers, architects, technical leaders, and fintech teams turn financial complexity into systems they can understand, operate, and trust.
Within 60 days of purchase you can get a 100% refund on any Leanpub purchase, in two clicks.
See full terms...
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.)
In fact, authors have earned over $15 million writing, publishing and selling on Leanpub.
Learn more about writing on Leanpub
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
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.