Europe 2026
Code Mode: Let the Code do the Talking - Sunil Pai, Cloudflare
Overview
This talk introduces "code mode," an alternative approach to AI agent interaction that moves beyond traditional JSON-based tool calling. Instead of complex back-and-forth with models to select and execute tools, code mode allows AI agents to generate and execute code directly within a controlled environment. This method leverages the inherent capabilities of code, such as looping and state management, and significantly reduces token usage and execution time, especially when dealing with extensive API surfaces.
Who should watch
- AI engineers building or integrating AI agents.
- Product Managers exploring new interaction paradigms for AI applications.
- Developers looking to improve the efficiency and scalability of AI agent tool usage.
- Builders interested in the future architecture of AI-powered systems.
- Those facing challenges with complex tool composition and large API integrations for AI agents.
Key takeaways
- Traditional AI agent tool calling (JSON back-and-forth) becomes inefficient and complex at scale, especially with hundreds of tools.
- Code mode enables AI agents to generate and execute code (e.g., JavaScript) directly, offering benefits like type checking, syntax error detection, and efficient execution.
- This approach drastically reduces token count; for example, exposing 2,600 Cloudflare API endpoints was reduced from 1.2 million tokens to 1,000 tokens by using search and execute code functions.
- Code generation allows for complex programming constructs like looping, state management, and parallelization within agent interactions.
- LLMs are breaking the boundary between technical users who write scripts and non-technical users who rely on custom interfaces, as they can now generate code to interact with systems.
- A new software architecture involves a "harness" with a secure sandbox environment for executing agent-generated code, granting capabilities explicitly.
- Sandboxes should start with minimal capabilities and have explicit permissions granted, focusing on fast startup and full observability.
- This paradigm shift enables the generation of long-running workflows, stateful agents, and highly personalized UIs for individual users.
Notable quotes
*The distinction is breaking. In a world like this, you need to let the code do the talking.*
*Everyone's building this harness and this architecture of the harness is not just that it can generate code, but it has a safe space to execute this code into which capabilities are exposed.*
Unofficial community note. Prefer the recording for nuance.