Kenton Varda
@kentonvarda.com
1.7K followers 130 following 170 posts
Tech lead for workers.cloudflare.com Also made: capnproto.org, lanparty.house, sandstorm.io @KentonVarda on Twitter.
Posts Media Videos Starter Packs
Pinned
kentonvarda.com
I don't have a problem with making new RPC systems! I can stop any time I want! But I don't want to. So I made a new one for you. It's called Cap'n Web. It's like Cap'n Proto RPC, except focused on working great in browsers and JavaScript/TypeScript servers. blog.cloudflare.com/capnweb-java...
An image of a circular fabric patch showing some sort of superhero in a nautical hat? Cap'n Web: Protect & Connect, it says. Looks like AI slop.
kentonvarda.com
Personally, I don't use the "for you" tab, I only use "following", and I basically don't see any politics at all. (I tend to unfollow anyone who posts politics TBH.)

I was actually doing that even before the acquisition, so didn't see much change after.
kentonvarda.com
Exactly as I remember it, in excruciating detail. Why does my brain continue to store this while forgetting people's names?
kentonvarda.com
Wait... I think someone made, like, a flash animated version of this?

I can still hear it in my head, including the heart beating at the end.
kentonvarda.com
Wow I remember this one. Despite not thinking about it once for 25 years. Why is this occupying space in my brain?
kentonvarda.com
Is it not Durable Objects?
kentonvarda.com
I don't personally know much about atproto or next.js, but this all sounds easily doable in Workers. @dom96.picheta.me built @listifications.app on top of Workers, FWIW.
kentonvarda.com
That's the next step I think. MCP is convenient because it's designed for the whole end-to-end experience of connecting an agent to an arbitrary MCP server including auth, etc. But once we fully solve those for e.g. OpenAPI, we should be able to go direct.
kentonvarda.com
No, the example should work correctly if you follow the instructions in the readme. It works for me. But only in local dev. To deploy it to prod you would need to be in the closed beta for worker loaders.
kentonvarda.com
Yes exactly. It's cheaper sandboxes. Also, the capability-based model is well known to be a great fit for sandboxing -- much cleaner than trying to filter and block arbitrary network requests.
kentonvarda.com
Anyway, please don't murder me for the quip that kinda sorta compares LLMs to Shakespeare.

/me runs away
kentonvarda.com
Dynamic Worker loading, of course, has applications far beyond just MCP or AI. It's a general-purpose capability-based sandboxing mechanism. If I had more time I'd build Sandstorm.io 2.0 on this...
kentonvarda.com
This is all based on a new Workers Runtime feature called Dynamic Worker Loading, which lets you dynamically load arbitrary code into a fresh isolate. Isolates are wayyyyyy cheaper and faster to load than containers. Perfect for executing one-offs. developers.cloudflare.com/workers/runt...
Dynamic Worker Loaders
The Dynamic Worker Loader API, which allows dynamically spawning isolates that run arbitrary code.
developers.cloudflare.com
kentonvarda.com
This works better than direct tool calls becaues LLMs actually have WAY more training data for writing code than for calling tools. After all, tool-calling is a sort of artificial thing just for LLMs. Code is everywhere.
kentonvarda.com
Hey Bluesky, I know how people here just LOVE everything AI, so I wanted to show you what @threepointone.bsky.social and I have been up to. We made an agent that calls MCP not as "tools", but by converting the tools into a TypeScript API, and writing code against that. blog.cloudflare.com/code-mode/
Code Mode: the better way to use MCP
It turns out we've all been using MCP wrong. Most agents today use MCP by exposing the
blog.cloudflare.com
kentonvarda.com
Oh! The stub is being disposed because you are returning it which transfers ownership to the caller. Try `return customerSession.dup()` instead. See the docs in the readme about automatic disposal.
kentonvarda.com
Sorry, I meant, "not one per RPC".
kentonvarda.com
Call `newWebSocketRpcSession()` once for gateway->backend. Get a stub back. Use that same stub to serve many incoming requests from clients. Each call to newWebSocketRpcSession() only creates exactly one connection, not one per call.
kentonvarda.com
The capability model naturally keeps the objects distinct from each other so you don't have to worry about, say, traffic for different users getting mixed up. Every method call is directed at a specific object.
kentonvarda.com
Absolutely, Cap'n {Web,Proto} is great at this. You can have any number of capabilities (object references) on a single connection.
kentonvarda.com
Yeah. For Go in particular, the solution will probably be that you use Cap'n Proto on the backend, Cap'n Web on the frontend (in browser), and there's a translating proxy you can stick in between.
kentonvarda.com
In the future we may add "three-party handoff", where when Alice has a stub pointing at Bob, and Alice gives that stub to Carol, Carol would automatically form a direct connection to Bob. The way to support that is well-understood, albeit complex, so it wasn't in v1.
kentonvarda.com
Cap'n Web (like Cap'n Proto) is great for many-party distributed systems. You can receive a stub from one session and then forward it on across another connection, and it'll automatically arrange proxying, so it "just works".
kentonvarda.com
The RPC systems will continue until y'all accept the object-capability model as your lord and savior.