Browser AI from First Principles: On-Device Models, WebMCP, AI Agents, and the Programmable BrowserWhat happens when the browser stops being merely an interface to AI—and becomes an AI runtime itself? Browser AI from First Principles explores a fundamental shift in web architecture: models, context, tools, and increasingly agent behavior moving into the browser. Rather than treating browser AI as another API tutorial, this book builds the architecture from first principles. You will examine what changes when the browser manages the model, how applications should handle uncertain capability and model lifecycle, how on-device inference changes latency and privacy boundaries, and how to determine whether an AI feature actually works rather than merely producing plausible output. Along the way, you will build and evolve Browser AI Observatory: a DevTools-based instrument for inspecting capability state, downloads, sessions, streaming, context usage, latency, evaluation results, tool calls, permissions, and agent decisions. You will explore: • Chrome's browser-managed AI capabilities and the Prompt API • Summarization, writing, rewriting, proofreading, translation, and language detection • Session state, context limits, cold starts, model lifecycle, and fallback • Structured output, validation, repeatable evaluation, and regression testing • WebMCP and the transition from buttons to structured agent capabilities • Tool discovery, selection, arguments, execution, and result grounding • Prompt injection and the separation of model proposals from execution authority • Human approval, scoped permissions, provenance, and auditable agent actions • Personal browser policy and user-controlled interfaces • The construction of Browser AI Lens: a user-owned intelligent layer over the web The central principle is simple: successful inference is not the same as a successful system. A model can return fluent text and still violate the feature contract. An agent can choose a plausible tool and still be wrong. A local model can improve one privacy boundary without making the entire application private. A confirmation dialog cannot make an unsafe execution architecture safe. The book therefore treats evidence, evaluation, authority, and observability as first-class parts of browser AI engineering. The result is not just a collection of examples. The book develops a working architecture in which the browser can host AI capabilities, websites can expose structured tools, agents can propose actions, deterministic policy can constrain them, and users can retain control over what ultimately happens. Browser AI from First Principles is for developers, AI engineers, agent builders, and technical architects who want to understand where browser-native AI is heading—and who want to build systems that remain inspectable, testable, and under user control as the underlying models change. |
