Forget what you think you know about AI agents. Forget clunky tool-use chains. Forget the endless prompting loops. Cloudflare’s Matt Carey is here to tell you you’ve been holding Model Context Protocol (MCP) all wrong.
This isn’t about an AI learning to type code. It’s about giving an agent, a digital entity designed to perform tasks, the keys to an entire kingdom – specifically, all 2,500-ish Cloudflare API endpoints. And it does this by fitting that massive surface area into about 1,000 tokens of context. Yes, you read that right. One thousand tokens. That’s less than a short blog post. The sheer audacity is almost admirable.
It’s called Code Mode. And it runs on the Agents SDK, a project Carey works on at Cloudflare. The core idea is a dynamic Worker loader. This loader executes model-written code within a V8 isolate. Secure. Isolated. Fast. This is where the magic happens – or at least, where the potential for magic happens.
Why Has Everyone Been Thinking About MCP Wrong?
The prevailing wisdom around MCP, for those even bothering to track these esoteric protocols, was largely about managing context between models and their tools. Think simple function calls. Think, dare I say it, basic. Carey’s take, and Cloudflare’s implementation via Code Mode, blows that out of the water. It’s not just about a single function. It’s about a whole API. A whole universe of possibilities for an agent.
This week I’m talking with Matt Carey about Code Mode and how most of us have been thinking about MCP all wrong.
He’s not just talking about theoretical constructs. He’s sharing his own workflow. Using Claude. He’s wrestling with the messy reality of agent memory – where it fits, how it works, and how it doesn’t inevitably lead to your Git repos being force-pushed into oblivion (his Zaggy git wrapper is a proof to that particular hell). This isn’t just product announcement hype; it’s lived experience.
The Agents SDK and the Promise of True Autonomy
The Agents SDK itself is a big deal. It’s the plumbing. It’s what allows these agents to actually do things. And when you combine that with Code Mode, you start to see a path to genuine autonomy. Not just agents that can suggest actions, but agents that can execute them. Programmatically. Securely. And, crucially, efficiently.
Consider the sponsors of this discussion – Coder.com, Tailscale, RWX, Fly.io. These aren’t random companies. They represent the infrastructure that makes powerful AI agents viable. Secure coding environments. smoothly networking. High-velocity CI/CD. Global deployment. It’s a whole ecosystem converging, and Cloudflare’s Code Mode is positioning itself as a critical linchpin.
Think about the friction developers face. Debugging. Integrating third-party services. Managing complex deployment pipelines. Now imagine an agent, powered by Code Mode, that can dive into your codebase, understand your requirements (expressed in a few thousand tokens, not pages of prose), and then directly interact with your CI/CD to deploy a fix. That’s not science fiction anymore. It’s a design goal.
Is This Just Another Abstraction Layer?
It’s tempting to dismiss this as just another layer of abstraction. Another way for a smart system to talk to a dumb one. But that’s where the skepticism needs to kick in. Is this truly different? Carey argues yes. By drastically reducing the context window required to expose an entire API, they’re solving a fundamental bottleneck. It’s not about cramming more into the model’s head; it’s about making the interface to the world so efficient that the model doesn’t need an encyclopedic memory of it.
This is where the comparison to older programming paradigms falls flat. We’re not talking about REST APIs as we knew them. We’re talking about a protocol that allows an AI to traverse and interact with a vast API surface without needing to know every single endpoint by heart, just how to find and use them via a token-constrained mechanism. It’s elegant. If it works as advertised, it’s a genuine leap forward.
Memory and the Agent’s Future
Memory is the elephant in the room for agents. How do they retain context? How do they learn from past interactions? Carey’s discussion on memory for agents, and the inspiration drawn from homelabs and personal AI projects, hints at a more distributed, perhaps more granular, approach. It’s not just a big monolithic memory bank. It’s about specialized memory modules, contextual recall, and ultimately, a more nuanced understanding of state. This is vital. Without it, agents are just glorified scripts.
And the idea of agents “taking inspiration from homelabs”? That’s the kind of meta-commentary that separates good tech journalism from corporate press releases. It acknowledges the experimental, DIY spirit that often drives innovation. Proxmox, Swamp Club – these are the battlegrounds where new ideas are forged, often outside the gilded cages of corporate R&D.
The implications here are vast. If Cloudflare can pull this off, it changes the game for AI development. It lowers the barrier to entry for building sophisticated AI agents. It allows for much more powerful integrations. And, perhaps most importantly, it forces us to reconsider what we mean when we talk about AI and its capabilities. We’re moving beyond mere chatbots. We’re entering the era of digital collaborators.
🧬 Related Insights
- Read more: This Ansible Playbook Auto-Finds RPMs — Smart Fix or DevOps Distraction?
- Read more: Webhook Security: Verifying Requests with HMAC Signatures
Frequently Asked Questions
What is Cloudflare’s Code Mode? Cloudflare’s Code Mode is a feature within their Agents SDK that allows AI agents to access and interact with entire APIs (like Cloudflare’s ~2,500 endpoints) using a highly compressed context window of around 1,000 tokens.
How does Code Mode differ from traditional MCP? Traditional Model Context Protocol (MCP) often focuses on simpler function calls or tool usage. Code Mode dramatically expands this by enabling agents to effectively command vast API surfaces, essentially treating them as discoverable and executable libraries within a severely constrained context.
Will this make AI agents more powerful? Yes, the goal is to significantly enhance the power and autonomy of AI agents by providing them with efficient, programmatic access to complex systems and APIs, enabling them to perform a wider range of tasks more effectively.