Skip to content

Commit d7ee3a5

Browse files
committed
Add @cloudflare/codemode v0.1.0 changelog entry
1 parent 6b6e88d commit d7ee3a5

1 file changed

Lines changed: 72 additions & 0 deletions

File tree

Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,72 @@
1+
---
2+
title: "@cloudflare/codemode v0.1.0: a new runtime agnostic modular architecture"
3+
description: "The Code Mode SDK has been rewritten with `createCodeTool()`, `DynamicWorkerExecutor`, and a new `Executor` interface that allows for Bring Your Own (BYO) sandbox."
4+
products:
5+
- agents
6+
- workers
7+
date: 2026-02-20
8+
---
9+
10+
import { TypeScriptExample, WranglerConfig } from "~/components";
11+
12+
The [`@cloudflare/codemode`](https://www.npmjs.com/package/@cloudflare/codemode) package has been rewritten into a modular, runtime-agnostic SDK. Code Mode lets LLMs write and execute TypeScript that orchestrates your tools, instead of calling them one at a time. The new `Executor` interface is runtime agnostic and comes with a prebuilt `DynamicWorkerExecutor` to run generated code in a [Dynamic Worker Loader](/workers/runtime-apis/bindings/worker-loader/).
13+
14+
## Breaking changes
15+
16+
- Removed `experimental_codemode()` and `CodeModeProxy` — the package no longer owns an LLM call or model choice
17+
- New import path: `createCodeTool()` is now exported from `@cloudflare/codemode/ai`
18+
19+
## New features
20+
21+
- **`createCodeTool()`** — Returns a standard AI SDK `Tool` to use in your AI agents.
22+
- **`Executor` interface** — Minimal `execute(code, fns)` contract. Implement for any code sandboxing primitive or runtime.
23+
- **`sanitizeToolName()`** — Converts MCP-style tool names (hyphens, dots) to valid JS identifiers
24+
- **`needsApproval` filtering** — Tools with `needsApproval` are automatically excluded from code generation.
25+
26+
### `DynamicWorkerExecutor`
27+
Runs code in a [Dynamic Worker](/workers/runtime-apis/bindings/worker-loader/). It comes with the following features:
28+
29+
- **Network isolation**`fetch()` and `connect()` blocked by default (`globalOutbound: null`) when using `DynamicWorkerExecutor`
30+
- **Console capture**`console.log/warn/error` captured and returned in `ExecuteResult.logs`
31+
- **Execution timeout** — Configurable via `timeout` option (default 30s)
32+
33+
## Usage
34+
35+
<TypeScriptExample>
36+
37+
```ts
38+
import { createCodeTool } from "@cloudflare/codemode/ai";
39+
import { DynamicWorkerExecutor } from "@cloudflare/codemode";
40+
import { streamText } from "ai";
41+
42+
const executor = new DynamicWorkerExecutor({ loader: env.LOADER });
43+
const codemode = createCodeTool({ tools: myTools, executor });
44+
45+
const result = streamText({
46+
model,
47+
tools: { codemode },
48+
messages,
49+
});
50+
```
51+
52+
</TypeScriptExample>
53+
54+
## Wrangler configuration
55+
56+
<WranglerConfig>
57+
58+
```jsonc
59+
{
60+
"worker_loaders": [{ "binding": "LOADER" }],
61+
}
62+
```
63+
64+
</WranglerConfig>
65+
66+
See the [Code Mode documentation](/agents/api-reference/codemode/) for full API reference and examples.
67+
68+
## Upgrade
69+
70+
```sh
71+
npm i @cloudflare/codemode@latest
72+
```

0 commit comments

Comments
 (0)