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

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

[Cloudflare](https://www.youtube.com/@cloudflare) · Published 2026-02-26 · 42:27 · B tier · Agents and MCP

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

## Summary

This discussion demonstrates [code mode](/lore/one-program-can-replace-several-tool-calls) over Cloudflare's API. It contrasts exposing a small hand-picked tool list with letting an agent discover operations and compose them through a compact tool interface.

The live session experiments with Workers, KV, [Durable Objects](/lore/workers-answer-requests-durable-objects-own-named-state), access controls, and analytics, then asks the agent to clean up its resources. The speakers also discuss progressive disclosure and plans for [MCP](/lore/mcp-is-another-surface) portals.

## Section notes

- [1:15](https://www.youtube.com/watch?v=-ZikRWR1Gb4\&t=75s): The episode introduces broad API access through two tools.
- [7:32](https://www.youtube.com/watch?v=-ZikRWR1Gb4\&t=452s): Small per-product MCP servers limit the exposed API surface.
- [15:23](https://www.youtube.com/watch?v=-ZikRWR1Gb4\&t=923s): Explicit guidance helps make the short live demonstration more predictable.
- [23:12](https://www.youtube.com/watch?v=-ZikRWR1Gb4\&t=1392s): The session requests cleanup after experimenting with several Cloudflare services.
- [31:13](https://www.youtube.com/watch?v=-ZikRWR1Gb4\&t=1873s): Progressive disclosure offers alternatives to loading every tool into context.
- [38:16](https://www.youtube.com/watch?v=-ZikRWR1Gb4\&t=2296s): Code mode for MCP portals is described as coming soon.

## Key concepts

- [code mode](/lore/one-program-can-replace-several-tool-calls)
- [MCP](/lore/mcp-is-another-surface)
- [Durable Objects](/lore/workers-answer-requests-durable-objects-own-named-state)

## Our take

This Week in NET on code mode, with demos: more than 2,500 Cloudflare API endpoints behind two tools and about a thousand tokens of context.

## Related videos

- [The Future of MCP — David Soria Parra, Anthropic](/tube/future-of-mcp-david-soria-parra)
- [Code Mode: Let the Code do the Talking - Sunil Pai, Cloudflare](/tube/code-mode-let-code-do-talking)
- [Don't Build Agents, Build Skills Instead – Barry Zhang & Mahesh Murag, Anthropic](/tube/dont-build-agents-build-skills)
- [All Code Is Slop (Except Mine) — Lauren Tan, SpaceXSI](/tube/all-code-is-slop-except-mine-lauren-tan)

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