Code Mode: Let the Code do the Talking
summary
An approach generates executable JavaScript that runs next to services instead of repeated JSON tool calls, drastically shrinking context: 2,600 API endpoints that would require 1.2 million tokens → 1,000 tokens (≈99.9% reduction). Demos show a Mythical server executing generated code and a canvas example where the model inspects stroke state and plays tic‑tac‑toe, revealing emergent behavior. Architecture uses sandboxed runtimes like V8 isolates, capability‑based security, observable short‑lived execution and long‑running workflows with per‑instance state.
AI-written summary · about
chapters (15)
- 0:00Introduction and speaker background
- 1:16What is "Code Mode"?
- 1:31Limitations of traditional tool calling at scale
- 2:03The shift to generating executable code
- 3:01Scaling API usage at Cloudflare
- 4:05Why code generation is more efficient
- 5:28Live demonstration of the Mythical server
- 7:20A new way of interacting with systems
- 9:09Example: The Kenton canvas and tic-tac-toe anecdote
- 11:46New software architecture: The "Harness"
- 13:28Observability and security in sandboxed environments
- 14:15Long-running workflows and generative UI
- 16:41Future outlook: Building for the next generation of users
- 17:50The resurgence of capability-based security
- 18:33Conclusion and final thoughts








