- For many agent tasks, the best 'tool' is a small code-execution surface, allowing models to write ordinary code against typed capabilities and enforce security below the model.
- Traditional agent toolboxes are growing with many tools, but models already excel at code, which is a more familiar and efficient interface, reducing context usage and tool calls.
- Code mode compresses context (e.g., 88% less), reduces token consumption from tool schemas, and allows deterministic logic between calls, such as joins, filters, and error handling.
- Models already speak code; custom tools require learning new schemas, while code provides a familiar grammar with types, compilers, error feedback, and concurrency.
- Code mode enables browsers to be controlled via JavaScript (e.g., page.evaluate()) instead of needing many interaction tools, making the browser agent more general.
- Code mode improves context compression, composition (e.g., controlling browser, querying warehouse, normalizing CSV in one execution), durable artifacts, and self-debugging via compiler feedback.
- Agent progression: tool mode (one action at a time) → code mode (whole workflow) → stabilized mode (saved code, code only when environment changes).
- The author's internal agent, bb, uses a small core surface with 'exec' for JS execution, making new integrations cheaper by defining typed capabilities once.
- Security requires sandbox, credential brokering, capability enforcement, egress control, read/write separation, traces, and retry design; let the model write anything inside the box, then make the box physically incapable of unauthorized actions.
- The best agent harnesses pair a few high-consequence tools with a general execution surface, letting agents write code for most tasks.