- About the Author
- Preface
- Part 1: Foundations
- Chapter 1: What “Agentic” Means
- Chapter 2: The Model as an API
- Chapter 3: The Project: Monorepo, BFF and an MCP Server
- Part 2: The Agent Loop
- Chapter 4: Building the Loop
- Chapter 5: Streaming Interfaces
- Chapter 6: Generative UI with A2UI
- Chapter 7: Run State: Persistence, State Machines and Resume
- Part 3: Humans in the Loop
- Chapter 8: Approvals and the Policy Gate
- Chapter 9: Steering a Running Agent
- Chapter 10: Interfaces That Earn Trust
- Part 4: Capability
- Chapter 11: Memory and Retrieval
- Chapter 12: Tools, MCP and the Inventory
- Chapter 13: Multiple Agents, and When Not to Use Them
- Chapter 14: Security: Untrusted Content in the Browser Era
- Part 5: Production
- Chapter 15: Evals and Testing Without a Judge
- Chapter 16: Shipping on a Budget: Observability, Cost and Limits
- Appendix A: Reference
- Appendix B: Provider and Framework Landscape
- Appendix C: Security Checklist
- Appendix D: Exercises and Where to Go Next
- Appendix E: Glossary
- Index
Agentic Application Development with React
Build a production-grade hotel booking agent with TypeScript, Gemini, MCP and A2UI
A traveler asks for a quiet hotel in Lisbon. Behind that one request, a model chooses tools, a server enforces approvals in code, and a person decides whether money moves. This book builds that system from the first message to the last booking, and tests it without paying for a single model call.
Minimum price
$9.00
$11.00
You pay
Author earns
Buying multiple copies for your team? See below for a discount!
About
About the Book
Most agent tutorials end at the demo, the model calls a function, prints the answer, and everything looks fine. Then you try to ship it. Tools fail, loops run away, the model books the wrong room, and nobody can say what happened.
This book starts where those tutorials stop. You build Stay, a hotel booking agent, the way you’d build anything that handles a person’s money:
- Tools that can fail without taking the run down
- A loop that can be stopped, not one you hope will end
- Approvals enforced by code, not by a line in a prompt
- State that survives a restart, so a crash never loses a booking
The stack: React 19 and TypeScript in the browser. Node, Hono and SQLite on the server. Gemini as the model. The Model Context Protocol for tools. A2UI for interface the server describes and the browser draws from components you trust.
Built to be trusted. Each chapter opens with a concrete situation, explains decisions in the order they were made, and ends with something that runs. Every code excerpt is copied from the example repository, and a script checks that the book and the code agree.
Follow along for USD 0. Recorded model responses ship with the code, so the tests, evals and demo replay without an API key.
What you’ll learn
- Write the agent loop and make it stoppable
- Stream a run to a React interface
- Render model-driven UI without trusting it
- Pause a run for human approval and resume it after a crash
- Give an agent memory and retrieval with SQLite full-text search
- Put tools behind MCP
- Split work across sub-agents, and know when not to
- Treat reviews and web content as hostile input (prompt injection)
- Test an agent with recorded conversations
- Keep spend inside a hard budget
Who it’s for
React and TypeScript developers who have called an LLM API and want to ship an agent that calls tools, shows its work, asks before it acts, remembers, and can be tested. No prior knowledge of MCP, A2UI or SQLite full-text search is needed.
Team Discounts
Team Discounts
Get a team discount on this book!
Up to 3 members
- Minimum price
- $22.00
- Suggested price
- $27.00
Up to 5 members
- Minimum price
- $36.00
- Suggested price
- $44.00
Up to 10 members
- Minimum price
- $63.00
- Suggested price
- $77.00
Up to 15 members
- Minimum price
- $90.00
- Suggested price
- $110
Up to 25 members
- Minimum price
- $135
- Suggested price
- $165
Author
About the Author
Sandeep Kumar Patel is a senior web developer with more than 17 years of experience building web applications in object-oriented JavaScript and JSON. In 2012 he founded tutorialsavvy, a programming blog that developers have been reading ever since.
He is GATE-2005 Information Technology (IT) qualified and holds a Master's degree from VIT University, Vellore.
Contents
Table of Contents
Get the free sample chapters
Click the buttons to get the free sample in PDF or EPUB, or read the sample online here
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.