This Week in NET

Code Mode: Giving AI Agents an Entire API in 1,000 Tokens (With Demos)

This Week in NET

Show Notes

In this episode of This Week in NET, host João Tomé is joined by Matt Curry to break down Code Mode: a way to give AI agents access to the entire Cloudflare API (2,500+ endpoints) using two tools and roughly ~1,000 tokens of context. 

Instead of exposing thousands of individual tools (which quickly becomes expensive and brittle), Code Mode lets the model write JavaScript to search and execute against a compact API context. The result is massive compression, lower cost, and better performance.

We also include demos showing how agents can query real infrastructure, navigate multiple accounts, and build things like multiplayer experiences using Durable Objects and WebSockets.

⏱️ Timestamps 0:53 — Intro: agents, MCP, tokens, and what Code Mode means 2:53 — Why exposing 2,500+ endpoints as tools doesn’t scale 6:49 — How Code Mode works: generate an SDK and let the model write code 9:57 — Demo: querying deployed Workers and infrastructure 14:37 — Multiplayer with Durable Objects (live demo “wow” moment) 24:32 — Compression stats: 2 million tokens → ~1,000 tokens 27:26 — Code Mode SDK v2 and wrapping your own APIs 31:52 — The Sandbox: running untrusted code safely 38:03 — What’s next: progressive disclosure and MCP evolution

Mentioned blog posts: Code Mode: give agents an entire API in 1,000 tokens

More from This Week in NET

May 1, 2026

In this episode of This Week in NET, JQ Lau and Victor Hwang from our Network & Infrastructure Strategy team walk us through Cloudflare's 13th generation of servers — the machines that power a significant part of the internet across 330+ cities worldwide.

Apr 29, 2026

In this episode of This Week in NET, Vinti Batiste, VP of Sales for US Enterprise at Cloudflare, shares her 30-year journey across IBM, Cisco, and now Cloudflare — and what it really means to be in enterprise sales.

Apr 22, 2026

In this special Agents Week edition of This Week in NET, host João Tomé is joined by Ming Lu (Principal Product Manager) and Anni Wang (Product Manager) to recap Cloudflare’s first-ever Agents Week.

Apr 14, 2026

In this World Quantum Day special edition of This Week in NET, host João Tomé is joined by Bas Westerbaan (Principal Research Engineer) and Sharon Goldberg (Senior Director, Product) to explain why the timeline for post-quantum cryptography may be arriving sooner than expected.

Apr 10, 2026

In this short edition of This Week in NET, host João Tomé joins from the island of Madeira for a quick preview of Cloudflare’s first Agents Week.

See all episodes →