# REST sends data across the network. What if it could send callable objects instead? | Kenton Varda

> For agents: start with the [agent guide](https://ratstack.sh/llms.txt). Every page is Markdown by default; add `Accept: text/html` for HTML.

[JavaScript Conferences by GitNation](https://www.youtube.com/@JavaScriptConferences) · Published 2026-05-21 · 28:56 · B tier · Cloudflare

[Watch on YouTube](https://www.youtube.com/watch?v=6ExqctHGuVw) · [All RatTube videos](/tube)

## Summary

Kenton Varda presents Cap'n Web through remote objects with callable methods. A chat API moves from endpoint-shaped methods toward objects representing individual rooms, where access can be checked when a room object is obtained.

The examples also use callbacks for subscriptions and [disposal](/lore/scopes-own-resources) to remove a subscription when the client goes away. Varda discusses exposing typed interfaces to agents and the care needed when wrapping existing objects so unintended methods are not exposed.

## Section notes

- [0:43](https://www.youtube.com/watch?v=6ExqctHGuVw\&t=43s): The introduction presents network communication as remote function calls.
- [5:22](https://www.youtube.com/watch?v=6ExqctHGuVw\&t=322s): A chat API begins with a direct conversion of endpoints to methods.
- [10:37](https://www.youtube.com/watch?v=6ExqctHGuVw\&t=637s): Room objects group methods and provide a point for access checks.
- [15:42](https://www.youtube.com/watch?v=6ExqctHGuVw\&t=942s): Disposing a client stub removes its subscription, including on disconnect.
- [20:44](https://www.youtube.com/watch?v=6ExqctHGuVw\&t=1244s): Typed interfaces offer an alternative to ambiguous request details for agents.
- [25:57](https://www.youtube.com/watch?v=6ExqctHGuVw\&t=1557s): Wrapping objects requires care to avoid exposing unintended functionality.

## Key concepts

- [disposal](/lore/scopes-own-resources)

## Our take

Kenton Varda on Cap'n Web, which returns references to live server objects instead of data: promise pipelining, lifecycle management, and why capability-based RPC is a better security model for agents than handing them tokens.

## Related videos

- [Production-grade app architecture with Effect (Workshop Part 1 – Effect Days 2025 )](/tube/production-grade-app-architecture-with-effect)
- [Durable Objects Finally Make Sense](/tube/durable-objects-finally-make-sense)
- [Structured Concurrency: The hidden power behind Effect | Antoine Coulon (Effect Days 2025)](/tube/structured-concurrency-hidden-power-behind-effect)
- [Cloudflare Workers Explained](/tube/cloudflare-workers-explained)

Summary based on the transcript. Written 2026-11-15.
