Running the Agent SDK Directly in the Browser
Overview
A build that bundles and runs the Claude Agent SDK directly inside the browser, exploring whether an SDK designed for Node can execute client-side with the right polyfills and build setup.
Why It Exists
The agent SDK assumes a Node runtime. This build tests how far that assumption can be bent, bundling @anthropic-ai/claude-agent-sdk for the browser to see what works, what breaks, and what needs shimming. It is the lightweight companion build to the broader cross-environment agent-runtime work.
What We Built
A small esbuild-based project (claude-agent-browser-build) that compiles the agent SDK to an ESM browser bundle, with custom shims/ for Node built-ins and a minimal index.html / test.html harness plus a claude-browser-build.js driver. The build defines out process.env and targets the browser platform via esbuild-plugin-polyfill-node.
Technologies & Approach
TypeScript source compiled by esbuild with node-polyfill plugins; the SDK pinned as the single runtime dependency. Deliberately minimal, a focused spike, not a product.
Outcome / Impact
Validated the feasibility and the rough edges of browser-side SDK execution, feeding directly into the transport-based approach taken by the related universal agent-runtime platform (which moved heavy execution to an edge bridge instead of forcing everything into the browser).
Capabilities Demonstrated
- Bundling a Node-targeted SDK for the browser with polyfills and shims
- Rapid feasibility spikes on emerging agent tooling
- Informing architecture decisions through throwaway builds