Back Issues This Week → Current Issue → Popular →

All issuesVolume 335, Issue 3IT Vendor NewsCloudflare

Code Mode: Give Agents An Entire Api In 1,000 Tokens

Cloudflare, Friday, February 20th, 2026

Model Context Protocol (MCP) has become the standard way for AI agents to use external tools. But there is a tension at its core: agents need many tools to do useful work, yet every tool added fills the model's context window, leaving less room for the actual task.

Code Mode is a technique we first introduced for reducing context window usage during agent tool use. Instead of describing every operation as a separate tool, let the model write code against a typed SDK and execute the code safely in a Dynamic Worker Loader. The code acts as a compact plan. The model can explore tool operations, compose multiple calls, and return just the data it needs. Anthropic independently explored the same pattern in their Code Execution with MCP post.

more →  ·  More from Cloudflare →