Skip to content

Commit dc5e6e0

Browse files
whoiskatrinthreepointoneirvinebroque
authored
add sandboxes announcement to changelog (#23197)
* add sandboxes announcement to changelog * Update src/content/changelog/agents/2025-06-24-announcing-sandboxes.mdx Co-authored-by: Sunil Pai <[email protected]> * fixing a type in the export * fix the date * fix the date * fix acorn build issue * smaller font * change the formatting again * updated the title Co-authored-by: Brendan Irvine-Broque <[email protected]> --------- Co-authored-by: Sunil Pai <[email protected]> Co-authored-by: Brendan Irvine-Broque <[email protected]>
1 parent 0c22436 commit dc5e6e0

File tree

1 file changed

+39
-0
lines changed

1 file changed

+39
-0
lines changed
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
---
2+
title: Run AI-generated code on-demand with Code Sandboxes (new)
3+
description: You can start creating sandboxes today by installing our new Sandbox package.
4+
products:
5+
- agents
6+
- workers
7+
- workflows
8+
date: 2025-06-25T15:00:00Z
9+
---
10+
11+
AI is supercharging app development for everyone, but we need a safe way to run untrusted, LLM-written code. We’re introducing [Sandboxes](https://www.npmjs.com/package/@cloudflare/sandbox), which let your Worker run actual processes in a secure, container-based environment.
12+
13+
```ts
14+
import { getSandbox } from "@cloudflare/sandbox";
15+
export { Sandbox } from "@cloudflare/sandbox";
16+
17+
export default {
18+
async fetch(request: Request, env: Env) {
19+
const sandbox = getSandbox(env.Sandbox, "my-sandbox");
20+
return sandbox.exec("ls", ["-la"]);
21+
},
22+
};
23+
```
24+
25+
### Methods
26+
27+
- `exec(command: string, args: string[], options?: { stream?: boolean })`:Execute a command in the sandbox.
28+
- `gitCheckout(repoUrl: string, options: { branch?: string; targetDir?: string; stream?: boolean })`: Checkout a git repository in the sandbox.
29+
- `mkdir(path: string, options: { recursive?: boolean; stream?: boolean })`: Create a directory in the sandbox.
30+
- `writeFile(path: string, content: string, options: { encoding?: string; stream?: boolean })`: Write content to a file in the sandbox.
31+
- `readFile(path: string, options: { encoding?: string; stream?: boolean })`: Read content from a file in the sandbox.
32+
- `deleteFile(path: string, options?: { stream?: boolean })`: Delete a file from the sandbox.
33+
- `renameFile(oldPath: string, newPath: string, options?: { stream?: boolean })`: Rename a file in the sandbox.
34+
- `moveFile(sourcePath: string, destinationPath: string, options?: { stream?: boolean })`: Move a file from one location to another in the sandbox.
35+
- `ping()`: Ping the sandbox.
36+
37+
Sandboxes are still experimental. We're using them to explore how isolated, container-like workloads might scale on Cloudflare — and to help define the developer experience around them.
38+
39+
You can try it today from your Worker, with just a few lines of code. Let us know what you build.

0 commit comments

Comments
 (0)