AI in TypeScript

Five books. One application.
No magic.

A five-book series that builds one AI application in TypeScript, from the first raw HTTP call to something you can put in front of strangers. Every layer is written by hand before a framework appears, so nothing in it is ever a black box.

Each book stands alone — you can start at any of them. Read in order, they build a single app that grows a capability per volume.

See the whole series on AmazonPaperback · Hardcover · Kindle
Your Amazon store

All editions are in English. Every buy link below follows this choice.

AI That Answers — book cover

Book 1 of 5 · Smilodon populator

AI That Answers

Your First LLM App in TypeScript: Prompts, Structured Output, and What Every Token Costs

Every tutorial gets you to “hello world” with a language model. Then you build the real thing, and the questions start. Why does the same prompt answer differently twice? What is resent on every turn? Why did the bill triple in a week?

  • The raw HTTP call before any framework, so no abstraction is magic
  • Streaming to a terminal and a browser, including the UTF-8 split trap
  • Structured output with Zod: one schema, one type, a validated object
  • Cost you can compute to the cent, and five levers to cut it
Get Book 1 on Amazon
AI That Reads — book cover

Book 2 of 5 · Megatherium americanum

AI That Reads

RAG in TypeScript: Embeddings, Vector Search, and Answers Grounded in Your Documents

A language model has never read your documents, and it will answer questions about them anyway — fluently, confidently, and wrongly. A bigger model does not fix it.

  • Chapter 2 writes the whole idea by hand in about fifty lines, no database
  • Thirty-one documents ship with the book, written to fail in specific ways
  • Hybrid search and reranking, because similarity misses the part number
  • An answer contract that makes “I don’t know” a valid, frequent response
Get Book 2 on Amazon
AI That Acts — book cover

Book 3 of 5 · Doedicurus clavicaudatus

AI That Acts

Tool Calling in TypeScript: APIs, Functions, and Your First Working AI Agent

A model that can “use tools” never executes anything. It emits a structured request and stops. Your code decides whether to run it — and everything that makes an agent safe or dangerous lives in that gap.

  • The agent loop written by hand in thirty lines, no framework
  • Tool surfaces as prompt engineering: the schema is the whole interface
  • A permission ladder sorted by how hard each action is to undo
  • MCP, and the trust boundary that crossing it creates
Get Book 3 on Amazon
AI That Plans — book cover

Book 4 of 5 · Phorusrhacos longissimus

AI That Plans

Stateful AI Agents with LangGraph.js: Memory, Multi-Step Workflows, and Multi-Agent Teams

Kill the process. An agent is four steps into a six-step job, you restart the service, and there is no record a run was in progress. Not a half-finished one. Nothing.

  • Checkpoints that outlive the process: kill the run, restart, resume
  • Human in the loop: pause inside a node, show a person, resume
  • Time travel — read any past state, patch a step, fork a run
  • One chapter arguing most multi-agent systems should have been one agent
Get Book 4 on Amazon
AI That Ships — book cover

Book 5 of 5 · Macrauchenia patachonica

AI That Ships

Evals, Guardrails, Cost Control, and Deploying AI Agents on Node.js

Change one line of the planner prompt. Not a rewrite — a clarification, the kind you make without thinking. Now answer this: what did it break? You cannot.

  • A golden set harvested from real failures, and the grading ladder
  • A regression gate in CI that actually blocks a merge
  • Prompt injection shown working, including the exfiltration channels
  • A hard budget cap that changes behaviour when it is hit
Get Book 5 on Amazon

Every listing runs

The code lives in a public repository, pinned to exact versions and re-run on a schedule against both those pins and the current releases. Where the repository and the printed page disagree, the repository is right — and the books say so.

Browse all five books

By Gabriel Anhaia · TypeScript throughout · no machine-learning background required