Skip to content
Merged
131 changes: 131 additions & 0 deletions src/content/changelog/agents/2025-08-05-agents-MCP-update.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,131 @@
---
title: Agents SDK adds MCP Elicitation support, http-streamable suppport, task queues, email integration and more
description: Major update brings MCP elicitation, enhanced transport options,auto transport selection, improved error handling, and reliable prop updates, task queues, and email support
products:
- agents
- workers
date: 2025-08-05
---

The latest releases of [@cloudflare/agents](https://github.com/cloudflare/agents) brings major improvements to MCP transport protocols support and agents connectivity. Key updates include:

### MCP elicitation support

MCP servers can now request user input during tool execution, enabling interactive workflows like confirmations, forms, and multi-step processes. This feature uses durable storage to preserve elicitation state even during agent hibernation, ensuring seamless user interactions across agent lifecycle events.

```ts
// Request user confirmation via elicitation
const confirmation = await this.elicitInput({
message: `Are you sure you want to increment the counter by ${amount}?`,
requestedSchema: {
type: "object",
properties: {
confirmed: {
type: "boolean",
title: "Confirm increment",
description: "Check to confirm the increment",
},
},
required: ["confirmed"],
},
});
```

Check out our [demo](https://github.com/whoiskatrin/agents/tree/main/examples/mcp-elicitation-demo) to see elicitation in action.

### HTTP streamable transport for MCP

MCP now supports HTTP streamable transport which is recommended over SSE. This transport type offers:

- **Better performance**: More efficient data streaming and reduced overhead
- **Improved reliability**: Enhanced connection stability and error recover- **Automatic fallback**: If streamable transport is not available, it gracefully falls back to SSE

```ts
export default MyMCP.serve("/mcp", {
binding: "MyMCP",
});
```

The SDK automatically selects the best available transport method, gracefully falling back from streamable-http to SSE when needed.

### Enhanced MCP connectivity

Significant improvements to MCP server connections and transport reliability:

- **Auto transport selection**: Automatically determines the best transport method, falling back from streamable-http to SSE as needed
- **Improved error handling**: Better connection state management and error reporting for MCP servers
- **Reliable prop updates**: Centralized agent property updates ensure consistency across different contexts

### Lightweight .queue for fast task deferral

You can use `.queue()` to enqueue background work — ideal for tasks like processing user messages, sending notifications etc.

```ts
class MyAgent extends Agent {
doSomethingExpensive(payload) {
// a long running process that you want to run in the background
}

queueSomething() {
await this.queue("doSomethingExpensive", somePayload); // this will NOT block further execution, and runs in the background
await this.queue("doSomethingExpensive", someOtherPayload); // the callback will NOT run until the previous callback is complete
// ... call as many times as you want
}
}
```

Want to try it yourself? Just define a method like processMessage in your agent, and you’re ready to scale.

### New email adapter

Want to build an AI agent that can receive and respond to emails automatically? With the new email adapter and onEmail lifecycle method, now you can.

```ts
export class EmailAgent extends Agent {
async onEmail(email: AgentEmail) {
const raw = await email.getRaw();
const parsed = await PostalMime.parse(raw);

// create a response based on the email contents
// and then send a reply

await this.replyToEmail(email, {
fromName: "Email Agent",
body: `Thanks for your email! You've sent us "${parsed.subject}". We'll process it shortly.`,
});
}
}
```

You route incoming mail like this:

```ts
export default {
async email(email, env) {
await routeAgentEmail(email, env, {
resolver: createAddressBasedEmailResolver("EmailAgent"),
});
},
};
```

You can find a full example [here](https://github.com/cloudflare/agents/tree/main/examples/email-agent).

### Automatic context wrapping for custom methods

Custom methods are now automatically wrapped with the agent's context, so calling `getCurrentAgent()` should work regardless of where in an agent's lifecycle it's called. Previously this would not work on RPC calls, but now just works out of the box.

```ts
export class MyAgent extends Agent {
async suggestReply(message) {
// getCurrentAgent() now correctly works, even when called inside an RPC method
const { agent } = getCurrentAgent()!;
return generateText({
prompt: `Suggest a reply to: "${message}" from "${agent.name}"`,
tools: [replyWithEmoji],
});
}
}
```

Try it out and tell us what you build!
156 changes: 156 additions & 0 deletions src/content/changelog/agents/2025-08-05-sandbox-sdk-major-update.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,156 @@
---
title: Cloudflare Sandbox SDK adds streaming, code interpreter, Git support, process control and more
description: The latest release transforms the Sandbox SDK into a full edge-native code execution platform, enabling secure, containerized runtimes with real-time streaming, language interpreters, Git integration, process lifecycle management, and port forwarding.
products:
- agents
- workers
date: 2025-08-05
---

We’ve shipped a major release for the [@cloudflare/sandbox](https://github.com/cloudflare/sandbox-sdk) SDK, turning it into a full-featured, container-based execution platform that runs securely on Cloudflare Workers.

This update adds live streaming of output, persistent Python and JavaScript code interpreters with rich output support (charts, tables, HTML, JSON), file system access, Git operations, full background process control, and the ability to expose running services via public URLs.

This makes it ideal for building AI agents, CI runners, cloud REPLs, data analysis pipelines, or full developer tools — all without managing infrastructure.

### Code interpreter (Python, JS, TS)

Create persistent code contexts with support for rich visual + structured outputs.

#### createCodeContext(options)

Creates a new code execution context with persistent state.

```ts
// Create a Python context
const pythonCtx = await sandbox.createCodeContext({ language: "python" });

// Create a JavaScript context
const jsCtx = await sandbox.createCodeContext({ language: "javascript" });
```

Options:

- language: Programming language ('python' | 'javascript' | 'typescript')
- cwd: Working directory (default: /workspace)
- envVars: Environment variables for the context

#### runCode(code, options)

Executes code with optional streaming callbacks.

```ts
// Simple execution
const execution = await sandbox.runCode('print("Hello World")', {
context: pythonCtx,
});

// With streaming callbacks
await sandbox.runCode(
`
for i in range(5):
print(f"Step {i}")
time.sleep(1)
`,
{
context: pythonCtx,
onStdout: (output) => console.log("Real-time:", output.text),
onResult: (result) => console.log("Result:", result),
},
);
```

Options:

- language: Programming language ('python' | 'javascript' | 'typescript')
- cwd: Working directory (default: /workspace)
- envVars: Environment variables for the context

#### Real-time streaming output

Returns a streaming response for real-time processing.

```ts
const stream = await sandbox.runCodeStream(
"import time; [print(i) for i in range(10)]",
);
// Process the stream as needed
```

#### Rich output handling

Interpreter outputs are auto-formatted and returned in multiple formats:

- text
- html (e.g., Pandas tables)
- png, svg (e.g., Matplotlib charts)
- json (structured data)
- chart (parsed visualizations)

```ts
const result = await sandbox.runCode(
`
import seaborn as sns
import matplotlib.pyplot as plt

data = sns.load_dataset("flights")
pivot = data.pivot("month", "year", "passengers")
sns.heatmap(pivot, annot=True, fmt="d")
plt.title("Flight Passengers")
plt.show()

pivot.to_dict()
`,
{ context: pythonCtx },
);

if (result.png) {
console.log("Chart output:", result.png);
}
```

### Preview URLs from Exposed Ports

Start background processes and expose them with live URLs.

```ts
await sandbox.startProcess("python -m http.server 8000");
const preview = await sandbox.exposePort(8000);

console.log("Live preview at:", preview.url);
```

### Full process lifecycle control

Start, inspect, and terminate long-running background processes.

```ts
const process = await sandbox.startProcess("node server.js");
console.log(`Started process ${process.id} with PID ${process.pid}`);

// Monitor the process
const logStream = await sandbox.streamProcessLogs(process.id);
for await (const log of parseSSEStream<LogEvent>(logStream)) {
console.log(`Server: ${log.data}`);
}
```

- listProcesses() - List all running processes
- getProcess(id) - Get detailed process status
- killProcess(id, signal) - Terminate specific processes
- killAllProcesses() - Kill all processes
- streamProcessLogs(id, options) - Stream logs from running processes
- getProcessLogs(id) - Get accumulated process output

### Git integration

Clone Git repositories directly into the sandbox.

```ts
await sandbox.gitCheckout("https://github.com/user/repo", {
branch: "main",
targetDir: "my-project",
});
```

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.
Loading